diff options
author | nyamatongwe <unknown> | 2013-05-24 00:04:54 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2013-05-24 00:04:54 +1000 |
commit | 85237dd55cd67cf9f72a751f5a275a910350e5cd (patch) | |
tree | 6a0072e11ce30bf18130cf7fcc3baa37d5fd92fe /src/Document.h | |
parent | d6e875c9b3a507551eb32ca3fff159eb07189fd9 (diff) | |
download | scintilla-mirror-85237dd55cd67cf9f72a751f5a275a910350e5cd.tar.gz |
Made methods const where they can be and are logically const as well.
Diffstat (limited to 'src/Document.h')
-rw-r--r-- | src/Document.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/Document.h b/src/Document.h index e6e225e8f..f3b49e1fe 100644 --- a/src/Document.h +++ b/src/Document.h @@ -128,23 +128,23 @@ public: firstChangeableLineAfter = -1; } - bool NeedsDrawing(int line) { + bool NeedsDrawing(int line) const { return isEnabled && (line <= firstChangeableLineBefore || line >= firstChangeableLineAfter); } - bool IsFoldBlockHighlighted(int line) { + bool IsFoldBlockHighlighted(int line) const { return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock; } - bool IsHeadOfFoldBlock(int line) { + bool IsHeadOfFoldBlock(int line) const { return beginFoldBlock == line && line < endFoldBlock; } - bool IsBodyOfFoldBlock(int line) { + bool IsBodyOfFoldBlock(int line) const { return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock; } - bool IsTailOfFoldBlock(int line) { + bool IsTailOfFoldBlock(int line) const { return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock; } @@ -204,7 +204,7 @@ public: WatcherWithUserData(DocWatcher *watcher_=0, void *userData_=0) : watcher(watcher_), userData(userData_) { } - bool operator==(const WatcherWithUserData &other) { + bool operator==(const WatcherWithUserData &other) const { return (watcher == other.watcher) && (userData == other.userData); } }; @@ -259,9 +259,9 @@ public: virtual void Init(); int LineEndTypesSupported() const; bool SetDBCSCodePage(int dbcsCodePage_); - int GetLineEndTypesAllowed() { return cb.GetLineEndTypes(); } + int GetLineEndTypesAllowed() const { return cb.GetLineEndTypes(); } bool SetLineEndTypesAllowed(int lineEndBitSet_); - int GetLineEndTypesActive() { return cb.GetLineEndTypes(); } + int GetLineEndTypesActive() const { return cb.GetLineEndTypes(); } virtual void InsertLine(int line); virtual void RemoveLine(int line); @@ -272,16 +272,16 @@ public: void SCI_METHOD SetErrorStatus(int status); int SCI_METHOD LineFromPosition(int pos) const; - int ClampPositionIntoDocument(int pos); - bool IsCrLf(int pos); + int ClampPositionIntoDocument(int pos) const; + bool IsCrLf(int pos) const; int LenChar(int pos); bool InGoodUTF8(int pos, int &start, int &end) const; int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); int NextPosition(int pos, int moveDir) const; - bool NextCharacter(int &pos, int moveDir); // Returns true if pos changed + bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed int SCI_METHOD CodePage() const; bool SCI_METHOD IsDBCSLeadByte(char ch) const; - int SafeSegment(const char *text, int length, int lengthSegment); + int SafeSegment(const char *text, int length, int lengthSegment) const; // Gateways to modifying document void ModifiedAt(int pos); @@ -292,18 +292,18 @@ public: void * SCI_METHOD ConvertToDocument(); int Undo(); int Redo(); - bool CanUndo() { return cb.CanUndo(); } - bool CanRedo() { return cb.CanRedo(); } + bool CanUndo() const { return cb.CanUndo(); } + bool CanRedo() const { return cb.CanRedo(); } void DeleteUndoHistory() { cb.DeleteUndoHistory(); } bool SetUndoCollection(bool collectUndo) { return cb.SetUndoCollection(collectUndo); } - bool IsCollectingUndo() { return cb.IsCollectingUndo(); } + bool IsCollectingUndo() const { return cb.IsCollectingUndo(); } void BeginUndoAction() { cb.BeginUndoAction(); } void EndUndoAction() { cb.EndUndoAction(); } void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } void SetSavePoint(); - bool IsSavePoint() { return cb.IsSavePoint(); } + bool IsSavePoint() const { return cb.IsSavePoint(); } const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); } const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); } int GapPosition() const { return cb.GapPosition(); } @@ -318,14 +318,14 @@ public: static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted); void ConvertLineEnds(int eolModeSet); void SetReadOnly(bool set) { cb.SetReadOnly(set); } - bool IsReadOnly() { return cb.IsReadOnly(); } + bool IsReadOnly() const { return cb.IsReadOnly(); } bool InsertChar(int pos, char ch); bool InsertCString(int position, const char *s); void DelChar(int pos); void DelCharBack(int pos); - char CharAt(int position) { return cb.CharAt(position); } + char CharAt(int position) const { return cb.CharAt(position); } void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const { cb.GetCharRange(buffer, position, lengthRetrieve); } @@ -352,7 +352,7 @@ public: int SCI_METHOD GetLevel(int line) const; void ClearLevels(); int GetLastChild(int lineParent, int level=-1, int lastLine=-1); - int GetFoldParent(int line); + int GetFoldParent(int line) const; void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine); void Indent(bool forwards); @@ -361,7 +361,7 @@ public: int NextWordEnd(int pos, int delta); int SCI_METHOD Length() const { return cb.Length(); } void Allocate(int newSize) { cb.Allocate(newSize); } - bool MatchesWordOptions(bool word, bool wordStart, int pos, int length); + bool MatchesWordOptions(bool word, bool wordStart, int pos, int length) const; bool HasCaseFolder(void) const; void SetCaseFolder(CaseFolder *pcf_); long FindText(int minPos, int maxPos, const char *search, bool caseSensitive, bool word, @@ -376,10 +376,10 @@ public: void SCI_METHOD StartStyling(int position, char mask); bool SCI_METHOD SetStyleFor(int length, char style); bool SCI_METHOD SetStyles(int length, const char *styles); - int GetEndStyled() { return endStyled; } + int GetEndStyled() const { return endStyled; } void EnsureStyledTo(int pos); void LexerChanged(); - int GetStyleClock() { return styleClock; } + int GetStyleClock() const { return styleClock; } void IncrementStyleClock(); void SCI_METHOD DecorationSetCurrentIndicator(int indicator) { decorations.SetCurrentIndicator(indicator); @@ -391,13 +391,13 @@ public: int GetMaxLineState(); void SCI_METHOD ChangeLexerState(int start, int end); - StyledText MarginStyledText(int line); + StyledText MarginStyledText(int line) const; void MarginSetStyle(int line, int style); void MarginSetStyles(int line, const unsigned char *styles); void MarginSetText(int line, const char *text); void MarginClearAll(); - StyledText AnnotationStyledText(int line); + StyledText AnnotationStyledText(int line) const; void AnnotationSetText(int line, const char *text); void AnnotationSetStyle(int line, int style); void AnnotationSetStyles(int line, const unsigned char *styles); @@ -407,21 +407,21 @@ public: bool AddWatcher(DocWatcher *watcher, void *userData); bool RemoveWatcher(DocWatcher *watcher, void *userData); - CharClassify::cc WordCharClass(unsigned char ch); - bool IsWordPartSeparator(char ch); + CharClassify::cc WordCharClass(unsigned char ch) const; + bool IsWordPartSeparator(char ch) const; int WordPartLeft(int pos); int WordPartRight(int pos); int ExtendStyleRange(int pos, int delta, bool singleLine = false); bool IsWhiteLine(int line) const; - int ParaUp(int pos); - int ParaDown(int pos); - int IndentSize() { return actualIndentInChars; } + int ParaUp(int pos) const; + int ParaDown(int pos) const; + int IndentSize() const { return actualIndentInChars; } int BraceMatch(int position, int maxReStyle); private: - bool IsWordStartAt(int pos); - bool IsWordEndAt(int pos); - bool IsWordAt(int start, int end); + bool IsWordStartAt(int pos) const; + bool IsWordEndAt(int pos) const; + bool IsWordAt(int start, int end) const; void NotifyModifyAttempt(); void NotifySavePoint(bool atSavePoint); |