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 | |
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')
-rw-r--r-- | src/CallTip.cxx | 2 | ||||
-rw-r--r-- | src/CallTip.h | 2 | ||||
-rw-r--r-- | src/CellBuffer.cxx | 6 | ||||
-rw-r--r-- | src/CellBuffer.h | 6 | ||||
-rw-r--r-- | src/Decoration.cxx | 4 | ||||
-rw-r--r-- | src/Decoration.h | 4 | ||||
-rw-r--r-- | src/Document.cxx | 30 | ||||
-rw-r--r-- | src/Document.h | 64 | ||||
-rw-r--r-- | src/Editor.cxx | 24 | ||||
-rw-r--r-- | src/Editor.h | 24 | ||||
-rw-r--r-- | src/KeyMap.cxx | 2 | ||||
-rw-r--r-- | src/KeyMap.h | 2 | ||||
-rw-r--r-- | src/PerLine.cxx | 6 | ||||
-rw-r--r-- | src/PerLine.h | 6 | ||||
-rw-r--r-- | src/RESearch.h | 2 | ||||
-rw-r--r-- | src/RunStyles.cxx | 8 | ||||
-rw-r--r-- | src/RunStyles.h | 8 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 4 | ||||
-rw-r--r-- | src/ScintillaBase.h | 4 |
19 files changed, 104 insertions, 104 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 8931f413d..c12a6e8eb 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -69,7 +69,7 @@ bool CallTip::IsTabCharacter(char ch) const { return (tabSize > 0) && (ch == '\t'); } -int CallTip::NextTabPos(int x) { +int CallTip::NextTabPos(int x) const { if (tabSize > 0) { // paranoia... not called unless this is true x -= insetX; // position relative to text x = (x + tabSize) / tabSize; // tab "number" diff --git a/src/CallTip.h b/src/CallTip.h index eafaa2f2e..840aa26ac 100644 --- a/src/CallTip.h +++ b/src/CallTip.h @@ -35,7 +35,7 @@ class CallTip { bool highlight, bool draw); int PaintContents(Surface *surfaceWindow, bool draw); bool IsTabCharacter(char c) const; - int NextTabPos(int x); + int NextTabPos(int x) const; public: Window wCallTip; diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 769f72464..694260821 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -496,7 +496,7 @@ void CellBuffer::SetSavePoint() { uh.SetSavePoint(); } -bool CellBuffer::IsSavePoint() { +bool CellBuffer::IsSavePoint() const { return uh.IsSavePoint(); } @@ -728,7 +728,7 @@ void CellBuffer::DeleteUndoHistory() { uh.DeleteUndoHistory(); } -bool CellBuffer::CanUndo() { +bool CellBuffer::CanUndo() const { return uh.CanUndo(); } @@ -750,7 +750,7 @@ void CellBuffer::PerformUndoStep() { uh.CompletedUndoStep(); } -bool CellBuffer::CanRedo() { +bool CellBuffer::CanRedo() const { return uh.CanRedo(); } diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 6fe698e13..45613bfa0 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -191,7 +191,7 @@ public: /// The save point is a marker in the undo stack where the container has stated that /// the buffer was saved. Undo and redo can move over the save point. void SetSavePoint(); - bool IsSavePoint(); + bool IsSavePoint() const; bool SetUndoCollection(bool collectUndo); bool IsCollectingUndo() const; @@ -202,11 +202,11 @@ public: /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is /// called that many times. Similarly for redo. - bool CanUndo(); + bool CanUndo() const; int StartUndo(); const Action &GetUndoStep() const; void PerformUndoStep(); - bool CanRedo(); + bool CanRedo() const; int StartRedo(); const Action &GetRedoStep() const; void PerformRedoStep(); diff --git a/src/Decoration.cxx b/src/Decoration.cxx index 4594a3a7a..cda460a48 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -29,7 +29,7 @@ Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { Decoration::~Decoration() { } -bool Decoration::Empty() { +bool Decoration::Empty() const { return (rs.Runs() == 1) && (rs.AllSameAs(0)); } @@ -159,7 +159,7 @@ void DecorationList::DeleteAnyEmpty() { } } -int DecorationList::AllOnFor(int position) { +int DecorationList::AllOnFor(int position) const { int mask = 0; for (Decoration *deco=root; deco; deco = deco->next) { if (deco->rs.ValueAt(position)) { diff --git a/src/Decoration.h b/src/Decoration.h index fedff9773..23d70c7ca 100644 --- a/src/Decoration.h +++ b/src/Decoration.h @@ -20,7 +20,7 @@ public: Decoration(int indicator_); ~Decoration(); - bool Empty(); + bool Empty() const; }; class DecorationList { @@ -51,7 +51,7 @@ public: void InsertSpace(int position, int insertLength); void DeleteRange(int position, int deleteLength); - int AllOnFor(int position); + int AllOnFor(int position) const; int ValueAt(int indicator, int position); int Start(int indicator, int position); int End(int indicator, int position); diff --git a/src/Document.cxx b/src/Document.cxx index 7911ffc58..8523a00fa 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -392,7 +392,7 @@ int Document::GetLastChild(int lineParent, int level, int lastLine) { return lineMaxSubord; } -int Document::GetFoldParent(int line) { +int Document::GetFoldParent(int line) const { int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; int lineLook = line - 1; while ((lineLook > 0) && ( @@ -479,11 +479,11 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in highlightDelimiter.firstChangeableLineAfter = firstChangeableLineAfter; } -int Document::ClampPositionIntoDocument(int pos) { +int Document::ClampPositionIntoDocument(int pos) const { return Platform::Clamp(pos, 0, Length()); } -bool Document::IsCrLf(int pos) { +bool Document::IsCrLf(int pos) const { if (pos < 0) return false; if (pos >= (Length() - 1)) @@ -688,7 +688,7 @@ int Document::NextPosition(int pos, int moveDir) const { return pos; } -bool Document::NextCharacter(int &pos, int moveDir) { +bool Document::NextCharacter(int &pos, int moveDir) const { // Returns true if pos changed int posNext = NextPosition(pos, moveDir); if (posNext == pos) { @@ -746,7 +746,7 @@ static inline bool IsSpaceOrTab(int ch) { // 2) Break before punctuation // 3) Break after whole character -int Document::SafeSegment(const char *text, int length, int lengthSegment) { +int Document::SafeSegment(const char *text, int length, int lengthSegment) const { if (length <= lengthSegment) return length; int lastSpaceBreak = -1; @@ -1275,7 +1275,7 @@ bool Document::IsWhiteLine(int line) const { return true; } -int Document::ParaUp(int pos) { +int Document::ParaUp(int pos) const { int line = LineFromPosition(pos); line--; while (line >= 0 && IsWhiteLine(line)) { // skip empty lines @@ -1288,7 +1288,7 @@ int Document::ParaUp(int pos) { return LineStart(line); } -int Document::ParaDown(int pos) { +int Document::ParaDown(int pos) const { int line = LineFromPosition(pos); while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines line++; @@ -1302,7 +1302,7 @@ int Document::ParaDown(int pos) { return LineEnd(line-1); } -CharClassify::cc Document::WordCharClass(unsigned char ch) { +CharClassify::cc Document::WordCharClass(unsigned char ch) const { if ((SC_CP_UTF8 == dbcsCodePage) && (!UTF8IsAscii(ch))) return CharClassify::ccWord; return charClass.GetClass(ch); @@ -1393,7 +1393,7 @@ int Document::NextWordEnd(int pos, int delta) { * Check that the character at the given position is a word or punctuation character and that * the previous character is of a different character class. */ -bool Document::IsWordStartAt(int pos) { +bool Document::IsWordStartAt(int pos) const { if (pos > 0) { CharClassify::cc ccPos = WordCharClass(CharAt(pos)); return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && @@ -1406,7 +1406,7 @@ bool Document::IsWordStartAt(int pos) { * Check that the character at the given position is a word or punctuation character and that * the next character is of a different character class. */ -bool Document::IsWordEndAt(int pos) { +bool Document::IsWordEndAt(int pos) const { if (pos < Length()) { CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1)); return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && @@ -1419,7 +1419,7 @@ bool Document::IsWordEndAt(int pos) { * Check that the given range is has transitions between character classes at both * ends and where the characters on the inside are word or punctuation characters. */ -bool Document::IsWordAt(int start, int end) { +bool Document::IsWordAt(int start, int end) const { return IsWordStartAt(start) && IsWordEndAt(end); } @@ -1464,7 +1464,7 @@ void CaseFolderTable::StandardASCII() { } } -bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length) { +bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length) const { return (!word && !wordStart) || (word && IsWordAt(pos, pos + length)) || (wordStart && IsWordStartAt(pos)); @@ -1765,7 +1765,7 @@ void SCI_METHOD Document::ChangeLexerState(int start, int end) { NotifyModified(mh); } -StyledText Document::MarginStyledText(int line) { +StyledText Document::MarginStyledText(int line) const { LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldMargin]); return StyledText(pla->Length(line), pla->Text(line), pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); @@ -1795,7 +1795,7 @@ void Document::MarginClearAll() { static_cast<LineAnnotation *>(perLineData[ldMargin])->ClearAll(); } -StyledText Document::AnnotationStyledText(int line) { +StyledText Document::AnnotationStyledText(int line) const { LineAnnotation *pla = static_cast<LineAnnotation *>(perLineData[ldAnnotation]); return StyledText(pla->Length(line), pla->Text(line), pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); @@ -1891,7 +1891,7 @@ void Document::NotifyModified(DocModification mh) { } } -bool Document::IsWordPartSeparator(char ch) { +bool Document::IsWordPartSeparator(char ch) const { return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); } 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); diff --git a/src/Editor.cxx b/src/Editor.cxx index 65348f588..6d833c5d2 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -333,7 +333,7 @@ Point Editor::DocumentPointFromView(Point ptView) { return ptDocument; } -int Editor::TopLineOfMain() { +int Editor::TopLineOfMain() const { if (wMargin.GetID()) return 0; else @@ -489,7 +489,7 @@ int Editor::XFromPosition(SelectionPosition sp) { return pt.x - vs.textStart + xOffset; } -int Editor::LineFromLocation(Point pt) { +int Editor::LineFromLocation(Point pt) const { return cs.DocFromDisplay(pt.y / vs.lineHeight + topLine); } @@ -722,11 +722,11 @@ void Editor::InvalidateRange(int start, int end) { RedrawRect(RectangleFromRange(start, end)); } -int Editor::CurrentPosition() { +int Editor::CurrentPosition() const { return sel.MainCaret(); } -bool Editor::SelectionEmpty() { +bool Editor::SelectionEmpty() const { return sel.Empty(); } @@ -1740,7 +1740,7 @@ void Editor::LinesSplit(int pixelWidth) { } } -int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) { +int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const { if (vs.markers[markerCheck].markType == SC_MARK_EMPTY) return markerDefault; return markerCheck; @@ -2426,14 +2426,14 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou } } -ColourDesired Editor::SelectionBackground(ViewStyle &vsDraw, bool main) { +ColourDesired Editor::SelectionBackground(ViewStyle &vsDraw, bool main) const { return main ? (primarySelection ? vsDraw.selbackground : vsDraw.selbackground2) : vsDraw.selAdditionalBackground; } ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, - ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { + ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const { if (inSelection == 1) { if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { return SelectionBackground(vsDraw, true); @@ -6217,7 +6217,7 @@ bool Editor::PointInSelMargin(Point pt) { } } -Window::Cursor Editor::GetMarginCursor(Point pt) { +Window::Cursor Editor::GetMarginCursor(Point pt) const { int x = 0; for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) @@ -6483,7 +6483,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b ShowCaretAtCurrentPosition(); } -bool Editor::PositionIsHotspot(int position) { +bool Editor::PositionIsHotspot(int position) const { return vs.styles[pdoc->StyleAt(position) & pdoc->stylingBitsMask].hotspot; } @@ -6527,7 +6527,7 @@ void Editor::SetHotSpotRange(Point *pt) { } } -void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) { +void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) const { hsStart_ = hsStart; hsEnd_ = hsEnd; } @@ -6787,7 +6787,7 @@ void Editor::SetFocusState(bool focusState) { } } -int Editor::PositionAfterArea(PRectangle rcArea) { +int Editor::PositionAfterArea(PRectangle rcArea) const { // The start of the document line after the display line after the area // This often means that the line after a modification is restyled which helps // detect multiline comment additions and heals single line comments @@ -7046,7 +7046,7 @@ void Editor::FoldExpand(int line, int action, int level) { Redraw(); } -int Editor::ContractedFoldNext(int lineStart) { +int Editor::ContractedFoldNext(int lineStart) const { for (int line = lineStart; line<pdoc->LinesTotal();) { if (!cs.GetExpanded(line) && (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG)) return line; diff --git a/src/Editor.h b/src/Editor.h index 328bed8d0..3888d2b87 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -308,7 +308,7 @@ protected: // ScintillaBase subclass needs access to much of Editor // scroll views where it will be equivalent to the current scroll position. virtual Point GetVisibleOriginInMain(); Point DocumentPointFromView(Point ptView); // Convert a point from view space to document - int TopLineOfMain(); // Return the line at Main's y coordinate 0 + int TopLineOfMain() const; // Return the line at Main's y coordinate 0 virtual PRectangle GetClientRectangle(); PRectangle GetTextRectangle(); @@ -324,7 +324,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int PositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false); SelectionPosition SPositionFromLineX(int lineDoc, int x); int PositionFromLineX(int line, int x); - int LineFromLocation(Point pt); + int LineFromLocation(Point pt) const; void SetTopLine(int topLineNew); bool AbandonPaint(); @@ -337,8 +337,8 @@ protected: // ScintillaBase subclass needs access to much of Editor bool UserVirtualSpace() const { return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); } - int CurrentPosition(); - bool SelectionEmpty(); + int CurrentPosition() const; + bool SelectionEmpty() const; SelectionPosition SelectionStart(); SelectionPosition SelectionEnd(); void SetRectangularRange(); @@ -399,13 +399,13 @@ protected: // ScintillaBase subclass needs access to much of Editor void LinesJoin(); void LinesSplit(int pixelWidth); - int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault); + int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) const; void PaintSelMargin(Surface *surface, PRectangle &rc); LineLayout *RetrieveLineLayout(int lineNumber); void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width=LineLayout::wrapWidthInfinite); - ColourDesired SelectionBackground(ViewStyle &vsDraw, bool main); - ColourDesired TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll); + ColourDesired SelectionBackground(ViewStyle &vsDraw, bool main) const; + ColourDesired TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) const; void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, @@ -529,7 +529,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool PositionInSelection(int pos); bool PointInSelection(Point pt); bool PointInSelMargin(Point pt); - Window::Cursor GetMarginCursor(Point pt); + Window::Cursor GetMarginCursor(Point pt) const; void TrimAndSetSelection(int currentPos_, int anchor_); void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine); void WordSelection(int pos); @@ -547,7 +547,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual bool HaveMouseCapture() = 0; void SetFocusState(bool focusState); - int PositionAfterArea(PRectangle rcArea); + int PositionAfterArea(PRectangle rcArea) const; void StyleToPositionInView(Position pos); virtual void IdleWork(); virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo=0); @@ -566,7 +566,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void SetFoldExpanded(int lineDoc, bool expanded); void FoldLine(int line, int action); void FoldExpand(int line, int action, int level); - int ContractedFoldNext(int lineStart); + int ContractedFoldNext(int lineStart) const; void EnsureLineVisible(int lineDoc, bool enforcePolicy); void FoldChanged(int line, int levelNow, int levelPrev); void NeedShown(int pos, int len); @@ -575,10 +575,10 @@ protected: // ScintillaBase subclass needs access to much of Editor int GetTag(char *tagValue, int tagNumber); int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); - bool PositionIsHotspot(int position); + bool PositionIsHotspot(int position) const; bool PointIsHotspot(Point pt); void SetHotSpotRange(Point *pt); - void GetHotSpotRange(int &hsStart, int &hsEnd); + void GetHotSpotRange(int &hsStart, int &hsEnd) const; int CodePage() const; virtual bool ValidCodePage(int /* codePage */) const { return true; } diff --git a/src/KeyMap.cxx b/src/KeyMap.cxx index ab8be2f9e..740776104 100644 --- a/src/KeyMap.cxx +++ b/src/KeyMap.cxx @@ -49,7 +49,7 @@ void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) { kmap.push_back(ktc); } -unsigned int KeyMap::Find(int key, int modifiers) { +unsigned int KeyMap::Find(int key, int modifiers) const { for (size_t i = 0; i < kmap.size(); i++) { if ((key == kmap[i].key) && (modifiers == kmap[i].modifiers)) { return kmap[i].msg; diff --git a/src/KeyMap.h b/src/KeyMap.h index ee4d29ce2..3fbbeab69 100644 --- a/src/KeyMap.h +++ b/src/KeyMap.h @@ -40,7 +40,7 @@ public: ~KeyMap(); void Clear(); void AssignCmdKey(int key, int modifiers, unsigned int msg); - unsigned int Find(int key, int modifiers); // 0 returned on failure + unsigned int Find(int key, int modifiers) const; // 0 returned on failure }; #ifdef SCI_NAMESPACE diff --git a/src/PerLine.cxx b/src/PerLine.cxx index 7e25e4823..a066bd647 100644 --- a/src/PerLine.cxx +++ b/src/PerLine.cxx @@ -282,7 +282,7 @@ int LineLevels::SetLevel(int line, int level, int lines) { return prev; } -int LineLevels::GetLevel(int line) { +int LineLevels::GetLevel(int line) const { if (levels.Length() && (line >= 0) && (line < levels.Length())) { return levels[line]; } else { @@ -325,7 +325,7 @@ int LineState::GetLineState(int line) { return lineStates[line]; } -int LineState::GetMaxLineState() { +int LineState::GetMaxLineState() const { return lineStates.Length(); } @@ -383,7 +383,7 @@ bool LineAnnotation::MultipleStyles(int line) const { return 0; } -int LineAnnotation::Style(int line) { +int LineAnnotation::Style(int line) const { if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) return reinterpret_cast<AnnotationHeader *>(annotations[line])->style; else diff --git a/src/PerLine.h b/src/PerLine.h index 646924ee0..70d0023e4 100644 --- a/src/PerLine.h +++ b/src/PerLine.h @@ -72,7 +72,7 @@ public: void ExpandLevels(int sizeNew=-1); void ClearLevels(); int SetLevel(int line, int level, int lines); - int GetLevel(int line); + int GetLevel(int line) const; }; class LineState : public PerLine { @@ -87,7 +87,7 @@ public: int SetLineState(int line, int state); int GetLineState(int line); - int GetMaxLineState(); + int GetMaxLineState() const; }; class LineAnnotation : public PerLine { @@ -101,7 +101,7 @@ public: virtual void RemoveLine(int line); bool MultipleStyles(int line) const; - int Style(int line); + int Style(int line) const; const char *Text(int line) const; const unsigned char *Styles(int line) const; void SetText(int line, const char *text); diff --git a/src/RESearch.h b/src/RESearch.h index 1f30ffb6d..702259d52 100644 --- a/src/RESearch.h +++ b/src/RESearch.h @@ -61,7 +61,7 @@ private: unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ int failure; CharClassify *charClass; - bool iswordc(unsigned char x) { + bool iswordc(unsigned char x) const { return charClass->IsWord(x); } }; diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index 82d924a23..fdcfc2b96 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -87,7 +87,7 @@ int RunStyles::ValueAt(int position) const { return styles->ValueAt(starts->PartitionFromPosition(position)); } -int RunStyles::FindNextChange(int position, int end) { +int RunStyles::FindNextChange(int position, int end) const { int run = starts->PartitionFromPosition(position); if (run < starts->Partitions()) { int runChange = starts->PositionFromPartition(run); @@ -106,11 +106,11 @@ int RunStyles::FindNextChange(int position, int end) { } } -int RunStyles::StartRun(int position) { +int RunStyles::StartRun(int position) const { return starts->PositionFromPartition(starts->PartitionFromPosition(position)); } -int RunStyles::EndRun(int position) { +int RunStyles::EndRun(int position) const { return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); } @@ -258,7 +258,7 @@ int RunStyles::Find(int value, int start) const { return -1; } -void RunStyles::Check() { +void RunStyles::Check() const { if (Length() < 0) { throw std::runtime_error("RunStyles: Length can not be negative."); } diff --git a/src/RunStyles.h b/src/RunStyles.h index 521c701fa..b096ad800 100644 --- a/src/RunStyles.h +++ b/src/RunStyles.h @@ -30,9 +30,9 @@ public: ~RunStyles(); int Length() const; int ValueAt(int position) const; - int FindNextChange(int position, int end); - int StartRun(int position); - int EndRun(int position); + int FindNextChange(int position, int end) const; + int StartRun(int position) const; + int EndRun(int position) const; // Returns true if some values may have changed bool FillRange(int &position, int value, int &fillLength); void SetValueAt(int position, int value); @@ -44,7 +44,7 @@ public: bool AllSameAs(int value) const; int Find(int value, int start) const; - void Check(); + void Check() const; }; #ifdef SCI_NAMESPACE diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 64411ed1a..31db93eca 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -367,13 +367,13 @@ void ScintillaBase::AutoCompleteCompleted() { SetLastXChosen(); } -int ScintillaBase::AutoCompleteGetCurrent() { +int ScintillaBase::AutoCompleteGetCurrent() const { if (!ac.Active()) return -1; return ac.GetSelection(); } -int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) { +int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) const { if (ac.Active()) { int item = ac.GetSelection(); if (item != -1) { diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index bbd7f8fdf..95761390d 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -68,8 +68,8 @@ protected: void AutoCompleteStart(int lenEntered, const char *list); void AutoCompleteCancel(); void AutoCompleteMove(int delta); - int AutoCompleteGetCurrent(); - int AutoCompleteGetCurrentText(char *buffer); + int AutoCompleteGetCurrent() const; + int AutoCompleteGetCurrentText(char *buffer) const; void AutoCompleteCharacterAdded(char ch); void AutoCompleteCharacterDeleted(); void AutoCompleteCompleted(); |