diff options
| author | Fabien Costantini <fabien@onepost.net> | 2009-07-04 00:06:32 +0000 |
|---|---|---|
| committer | Fabien Costantini <fabien@onepost.net> | 2009-07-04 00:06:32 +0000 |
| commit | 9182195f17e669f7a71c18e520116c18d922c101 (patch) | |
| tree | 6f1b3371ed8bbc18f7e46147dd6fa0982ff44471 | |
| parent | e982ba24a9e7b3cf7730101a872e250c6ade91bd (diff) | |
UTF8: Fl_Text_Display and related:
+ Even more const constraints added to Fl_Text_Selection and Fl_Text_Buffer methods.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6820 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Text_Buffer.H | 30 | ||||
| -rw-r--r-- | src/Fl_Text_Buffer.cxx | 28 |
2 files changed, 29 insertions, 29 deletions
diff --git a/FL/Fl_Text_Buffer.H b/FL/Fl_Text_Buffer.H index 9732b8760..e519609d5 100644 --- a/FL/Fl_Text_Buffer.H +++ b/FL/Fl_Text_Buffer.H @@ -106,7 +106,7 @@ class FL_EXPORT Fl_Text_Buffer { void text(const char* text); 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); + char* text_in_rectangle(int start, int end, int rectStart, int rectEnd) const; void insert(int pos, const char* text); /** Appends the text string to the end of the buffer. */ void append(const char* t) { insert(length(), t); } @@ -210,20 +210,20 @@ class FL_EXPORT Fl_Text_Buffer { */ void call_predelete_callbacks() { call_predelete_callbacks(0, 0); } - char* line_text(int pos); - int line_start(int pos); - int line_end(int pos); - int word_start(int pos); - int word_end(int pos); - int expand_character(int pos, int indent, char *outStr); + char* line_text(int pos) const; + int line_start(int pos) const; + int line_end(int pos) const; + int word_start(int pos) const; + int word_end(int pos) const; + int expand_character(int pos, int indent, char *outStr) const; static int expand_character(char c, int indent, char* outStr, int tabDist, char nullSubsChar); static int character_width(char c, int indent, int tabDist, char nullSubsChar); - int count_displayed_characters(int lineStartPos, int targetPos); + int count_displayed_characters(int lineStartPos, int targetPos) const; int skip_displayed_characters(int lineStartPos, int nChars); - int count_lines(int startPos, int endPos); + int count_lines(int startPos, int endPos) const; int skip_lines(int startPos, int nLines); int rewind_lines(int startPos, int nLines); int findchar_forward(int startPos, char searchChar, int* foundPos) const; @@ -240,7 +240,7 @@ class FL_EXPORT Fl_Text_Buffer { int substitute_null_characters(char* string, int length); void unsubstitute_null_characters(char* string); /** Returns the current nul substitution character. */ - char null_substitution_character() { return mNullSubsChar; } + char null_substitution_character() const { return mNullSubsChar; } /** Returns the primary selection. */ Fl_Text_Selection* primary_selection() { return &mPrimary; } /** Returns the secondary selection. */ @@ -250,8 +250,8 @@ class FL_EXPORT Fl_Text_Buffer { protected: void call_modify_callbacks(int pos, int nDeleted, int nInserted, - int nRestyled, const char* deletedText); - void call_predelete_callbacks(int pos, int nDeleted); + int nRestyled, const char* deletedText) const; + void call_predelete_callbacks(int pos, int nDeleted) const; int insert_(int pos, const char* text); void remove_(int start, int end); @@ -267,17 +267,17 @@ class FL_EXPORT Fl_Text_Buffer { int* nInserted, int* endPos); void redisplay_selection(Fl_Text_Selection* oldSelection, - Fl_Text_Selection* newSelection); + Fl_Text_Selection* newSelection) const; void move_gap(int pos); void reallocate_with_gap(int newGapStart, int newGapLen); - char* selection_text_(Fl_Text_Selection* sel); + char* selection_text_(Fl_Text_Selection* sel) const; void remove_selection_(Fl_Text_Selection* sel); void replace_selection_(Fl_Text_Selection* sel, const char* text); void rectangular_selection_boundaries(int lineStartPos, int rectStart, int rectEnd, int* selStart, - int* selEnd); + int* selEnd) const; void update_selections(int pos, int nDeleted, int nInserted); diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index dc19517d1..8534ad934 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -557,7 +557,7 @@ void Fl_Text_Buffer::clear_rectangular(int start, int end, int rectStart, with the text, free it using the free() function. */ char * Fl_Text_Buffer::text_in_rectangle(int start, int end, - int rectStart, int rectEnd) { + int rectStart, int rectEnd) const { int lineStart, selLeft, selRight, len; char *textOut, *outPtr, *retabbedStr; const char *textIn; @@ -916,12 +916,12 @@ void Fl_Text_Buffer::remove_predelete_callback( character position. When you are done with the text, free it using the free() function. */ -char * Fl_Text_Buffer::line_text(int pos) { +char * Fl_Text_Buffer::line_text(int pos) const { return text_range(line_start(pos), line_end(pos)); } /** Returns the position of the start of the line containing position \p pos. */ -int Fl_Text_Buffer::line_start(int pos) { +int Fl_Text_Buffer::line_start(int pos) const { if (!findchar_backward(pos, '\n', &pos)) return 0; return pos + 1; @@ -931,13 +931,13 @@ int Fl_Text_Buffer::line_start(int pos) { (which is either a pointer to the newline character ending the line, or a pointer to one character beyond the end of the buffer) */ -int Fl_Text_Buffer::line_end(int pos) { +int Fl_Text_Buffer::line_end(int pos) const { if (!findchar_forward(pos, '\n', &pos)) pos = mLength; return pos; } /** Returns the position corresponding to the start of the word */ -int Fl_Text_Buffer::word_start(int pos) { +int Fl_Text_Buffer::word_start(int pos) const { while (pos && (isalnum(character(pos)) || character(pos) == '_')) { pos--; } @@ -946,7 +946,7 @@ int Fl_Text_Buffer::word_start(int pos) { } /** Returns the position corresponding to the end of the word.*/ -int Fl_Text_Buffer::word_end(int pos) { +int Fl_Text_Buffer::word_end(int pos) const { while (pos < length() && (isalnum(character(pos)) || character(pos) == '_')) { pos++; } @@ -963,7 +963,7 @@ int Fl_Text_Buffer::word_end(int pos) { for figuring tabs. Output string is guranteed to be shorter or equal in length to FL_TEXT_MAX_EXP_CHAR_LEN */ -int Fl_Text_Buffer::expand_character(int pos, int indent, char *outStr) { +int Fl_Text_Buffer::expand_character(int pos, int indent, char *outStr) const { int ret; char c = character(pos); ret = expand_character(c, indent, outStr, @@ -1058,7 +1058,7 @@ int Fl_Text_Buffer::character_width(char c, int indent, int tabDist, char nullSu shown on the screen to represent characters in the buffer, where tabs and control characters are expanded) */ -int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, int targetPos) { +int Fl_Text_Buffer::count_displayed_characters(int lineStartPos, int targetPos) const { int pos, charCount = 0; char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ]; @@ -1092,7 +1092,7 @@ int Fl_Text_Buffer::skip_displayed_characters(int lineStartPos, int nChars) { Counts the number of newlines between \p startPos and \p endPos in buffer. The character at position \p endPos is not counted. */ -int Fl_Text_Buffer::count_lines(int startPos, int endPos) { +int Fl_Text_Buffer::count_lines(int startPos, int endPos) const { int pos, gapLen = mGapEnd - mGapStart; int lineCount = 0; @@ -2012,7 +2012,7 @@ int Fl_Text_Selection::includes(int pos, int lineStartPos, int dispIndex) const -char * Fl_Text_Buffer::selection_text_(Fl_Text_Selection *sel) { +char * Fl_Text_Buffer::selection_text_(Fl_Text_Selection *sel) const { int start, end, isRect, rectStart, rectEnd; char *s; @@ -2098,7 +2098,7 @@ static void addPadding(char *string, int startIndent, int toIndent, changed area(s) on the screen and any other listeners. */ void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted, - int nInserted, int nRestyled, const char *deletedText) { + int nInserted, int nRestyled, const char *deletedText) const { int i; for (i = 0; i < mNModifyProcs; i++) @@ -2110,7 +2110,7 @@ void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted, Calls the stored pre-delete callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners. */ -void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) { +void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) const { int i; for (i=0; i<mNPredeleteProcs; i++) @@ -2122,7 +2122,7 @@ void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) { screen for a change in a selection. */ void Fl_Text_Buffer::redisplay_selection(Fl_Text_Selection *oldSelection, - Fl_Text_Selection *newSelection) { + Fl_Text_Selection *newSelection) const { int oldStart, oldEnd, newStart, newEnd, ch1Start, ch1End, ch2Start, ch2End; /* If either selection is rectangular, add an additional character to @@ -2399,7 +2399,7 @@ static int textWidth(const char *text, int tabDist, char nullSubsChar) { margin for subsequent columnar pastes of this data. */ void Fl_Text_Buffer::rectangular_selection_boundaries(int lineStartPos, - int rectStart, int rectEnd, int *selStart, int *selEnd) { + int rectStart, int rectEnd, int *selStart, int *selEnd) const { int pos, width, indent = 0; char c; |
