Author: fabien
Date: 2009-07-03 16:54:34 -0700 (Fri, 03 Jul 2009)
New Revision: 6819
Log:
UTF8: Fl_Text_Display and related:
    + Added more const constraints to Fl_Text_Selection and Fl_Text_Buffer 
methods.


Modified:
   branches/branch-1.3/FL/Fl_Text_Buffer.H
   branches/branch-1.3/src/Fl_Text_Buffer.cxx

Modified: branches/branch-1.3/FL/Fl_Text_Buffer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Text_Buffer.H     2009-07-03 23:32:47 UTC (rev 
6818)
+++ branches/branch-1.3/FL/Fl_Text_Buffer.H     2009-07-03 23:54:34 UTC (rev 
6819)
@@ -51,20 +51,20 @@
     void set(int start, int end);
     void set_rectangular(int start, int end, int rectStart, int rectEnd);
     void update(int pos, int nDeleted, int nInserted);
-    char rectangular() { return mRectangular; }
-    int start() { return mStart; }
-    int end() { return mEnd; }
-    int rect_start() { return mRectStart; }
-    int rect_end() { return mRectEnd; }
+    char rectangular() const { return mRectangular; }
+    int start() const { return mStart; }
+    int end() const { return mEnd; }
+    int rect_start() const { return mRectStart; }
+    int rect_end() const { return mRectEnd; }
     /**
        Returns a non-zero number if any text has been selected, or 0
        if no text is selected.
     */
-    char selected() { return mSelected; }
+    char selected() const { return mSelected; }
     void selected(char b) { mSelected = b; }
-    int includes(int pos, int lineStartPos, int dispIndex);
-    int position(int* start, int* end);
-    int position(int* start, int* end, int* isRect, int* rectStart, int* 
rectEnd);
+    int includes(int pos, int lineStartPos, int dispIndex) const;
+    int position(int* start, int* end) const;
+    int position(int* start, int* end, int* isRect, int* rectStart, int* 
rectEnd) const;
 
 
   protected:
@@ -101,11 +101,11 @@
     ~Fl_Text_Buffer();
 
   /**    Returns the number of characters in the buffer.  */
-    int length() { return mLength; }
+    int length() const { return mLength; }
     char* text() const;
     void text(const char* text);
-    char* text_range(int start, int end);
-    char character(int pos);
+    char* text_range(int start, int end) const;
+    char character(int pos) const;
     char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
     void insert(int pos, const char* text);
   /**    Appends the text string to the end of the buffer.  */
@@ -145,11 +145,11 @@
     void remove_rectangular(int start, int end, int rectStart, int rectEnd);
     void clear_rectangular(int start, int end, int rectStart, int rectEnd);
     /** Gets the tab width.  */
-    int tab_distance() { return mTabDist; }
+    int tab_distance() const { return mTabDist; }
     void tab_distance(int tabDist);
     void select(int start, int end);
     /** Returns a non 0 value if text has been selected, 0 otherwise */
-    int selected() { return mPrimary.selected(); }
+    int selected() const { return mPrimary.selected(); }
     void unselect();
     void select_rectangular(int start, int end, int rectStart, int rectEnd);
     int selection_position(int* start, int* end);
@@ -226,16 +226,16 @@
     int count_lines(int startPos, int endPos);
     int skip_lines(int startPos, int nLines);
     int rewind_lines(int startPos, int nLines);
-    int findchar_forward(int startPos, char searchChar, int* foundPos);
-    int findchar_backward(int startPos, char searchChar, int* foundPos);
-    int findchars_forward(int startPos, const char* searchChars, int* 
foundPos);
-    int findchars_backward(int startPos, const char* searchChars, int* 
foundPos);
+    int findchar_forward(int startPos, char searchChar, int* foundPos) const;
+    int findchar_backward(int startPos, char searchChar, int* foundPos) const;
+    int findchars_forward(int startPos, const char* searchChars, int* 
foundPos) const;
+    int findchars_backward(int startPos, const char* searchChars, int* 
foundPos) const;
 
     int search_forward(int startPos, const char* searchString, int* foundPos,
-                       int matchCase = 0);
+                       int matchCase = 0) const;
 
     int search_backward(int startPos, const char* searchString, int* foundPos,
-                        int matchCase = 0);
+                        int matchCase = 0) const;
 
     int substitute_null_characters(char* string, int length);
     void unsubstitute_null_characters(char* string);

Modified: branches/branch-1.3/src/Fl_Text_Buffer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Buffer.cxx  2009-07-03 23:32:47 UTC (rev 
6818)
+++ branches/branch-1.3/src/Fl_Text_Buffer.cxx  2009-07-03 23:54:34 UTC (rev 
6819)
@@ -202,7 +202,7 @@
    include the character pointed to by \p end.
    When you are done with the text, free it using the free() function.
 */
-char * Fl_Text_Buffer::text_range(int start, int end) {
+char * Fl_Text_Buffer::text_range(int start, int end) const {
   char * s = NULL;
   int copiedLength, part1Length;
 
@@ -239,7 +239,7 @@
 
 /**  Returns the character at the specified position pos in the buffer.
      Positions start at 0 */
-char Fl_Text_Buffer::character(int pos) {
+char Fl_Text_Buffer::character(int pos) const {
   if (pos < 0 || pos >= mLength)
     return '\0';
   if (pos < mGapStart)
@@ -1177,7 +1177,7 @@
    returns 1 if found, 0 if not.
 */
 int Fl_Text_Buffer::search_forward(int startPos, const char *searchString,
-                                    int *foundPos, int matchCase)
+                                    int *foundPos, int matchCase) const
 {
   if (!searchString) return 0;
   int bp;
@@ -1201,7 +1201,7 @@
    returns 1 if found, 0 if not.
 */
 int Fl_Text_Buffer::search_backward(int startPos, const char *searchString,
-                                     int *foundPos, int matchCase)
+                                     int *foundPos, int matchCase) const
 {
   if (!searchString) return 0;
   int bp;
@@ -1226,7 +1226,7 @@
   returns 1 if found, 0 if not.
 */
 int Fl_Text_Buffer::findchars_forward(int startPos, const char *searchChars,
-                                    int *foundPos) {
+                                    int *foundPos) const {
   int pos, gapLen = mGapEnd - mGapStart;
   const char *c;
 
@@ -1260,7 +1260,7 @@
    returns 1 if found, 0 if not.
 */
 int Fl_Text_Buffer::findchars_backward(int startPos, const char *searchChars,
-                                     int *foundPos) {
+                                     int *foundPos) const {
   int pos, gapLen = mGapEnd - mGapStart;
   const char *c;
 
@@ -1975,7 +1975,7 @@
   mRectEnd = rectEnd;
 }
 
-int Fl_Text_Selection::position(int *startpos, int *endpos) {
+int Fl_Text_Selection::position(int *startpos, int *endpos) const {
   if (!mSelected)
     return 0;
   *startpos = mStart;
@@ -1985,7 +1985,7 @@
 }
 
 int Fl_Text_Selection::position(int *startpos, int *endpos,
-                                 int *isRect, int *rectStart, int *rectEnd) {
+                                 int *isRect, int *rectStart, int *rectEnd) 
const {
   if (!mSelected)
     return 0;
   *isRect = mRectangular;
@@ -2002,7 +2002,7 @@
    Return true if position \p pos with indentation \p dispIndex is in
    the Fl_Text_Selection.
 */
-int Fl_Text_Selection::includes(int pos, int lineStartPos, int dispIndex) {
+int Fl_Text_Selection::includes(int pos, int lineStartPos, int dispIndex) 
const {
   return selected() &&
          ((!rectangular() && pos >= start() && pos < end()) ||
            (rectangular() && pos >= start() && lineStartPos <= end() &&
@@ -2272,7 +2272,7 @@
    count lines quickly, hence searching for a single character: newline)
 */
 int Fl_Text_Buffer::findchar_forward(int startPos, char searchChar,
-                                    int *foundPos) {
+                                    int *foundPos) const {
   int pos, gapLen = mGapEnd - mGapStart;
 
   if (startPos < 0 || startPos >= mLength) {
@@ -2308,7 +2308,7 @@
    count lines quickly, hence searching for a single character: newline)
 */
 int Fl_Text_Buffer::findchar_backward(int startPos, char searchChar,
-                                     int *foundPos) {
+                                     int *foundPos) const{
   int pos, gapLen = mGapEnd - mGapStart;
 
   if (startPos <= 0 || startPos > mLength) {

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to