diff options
author | nyamatongwe <devnull@localhost> | 2007-07-08 09:30:43 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2007-07-08 09:30:43 +0000 |
commit | fb28596c0e8ba57de486ffb693b5ea82d37d98ee (patch) | |
tree | c2a9301f4873ed34d101c18bcc67c1e286ae2c9b | |
parent | 1e2b21b4105e62e1a08c38631162760a60c616de (diff) | |
download | scintilla-mirror-fb28596c0e8ba57de486ffb693b5ea82d37d98ee.tar.gz |
Added const to methods that should not logically need to modify object.
-rw-r--r-- | src/CellBuffer.cxx | 8 | ||||
-rw-r--r-- | src/CellBuffer.h | 12 | ||||
-rw-r--r-- | src/Document.cxx | 10 | ||||
-rw-r--r-- | src/Document.h | 12 | ||||
-rw-r--r-- | src/Partitioning.h | 4 |
5 files changed, 23 insertions, 23 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 15db9a72a..157c91bdc 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -563,7 +563,7 @@ CellBuffer::CellBuffer() { CellBuffer::~CellBuffer() { } -char CellBuffer::CharAt(int position) { +char CellBuffer::CharAt(int position) const { return substance.ValueAt(position); } @@ -653,7 +653,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startS return data; } -int CellBuffer::Length() { +int CellBuffer::Length() const { return substance.Length(); } @@ -662,11 +662,11 @@ void CellBuffer::Allocate(int newSize) { style.ReAllocate(newSize); } -int CellBuffer::Lines() { +int CellBuffer::Lines() const { return lv.Lines(); } -int CellBuffer::LineStart(int line) { +int CellBuffer::LineStart(int line) const { if (line < 0) return 0; else if (line >= Lines()) diff --git a/src/CellBuffer.h b/src/CellBuffer.h index e790a8196..c51eab78d 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -67,11 +67,11 @@ public: void InsertLine(int line, int position); void SetLineStart(int line, int position); void RemoveLine(int line); - int Lines() { + int Lines() const { return starts.Partitions(); } int LineFromPosition(int pos); - int LineStart(int line) { + int LineStart(int line) const { return starts.PositionFromPartition(line); } @@ -168,14 +168,14 @@ public: ~CellBuffer(); /// Retrieving positions outside the range of the buffer works and returns 0 - char CharAt(int position); + char CharAt(int position) const; void GetCharRange(char *buffer, int position, int lengthRetrieve); char StyleAt(int position); - int Length(); + int Length() const; void Allocate(int newSize); - int Lines(); - int LineStart(int line); + int Lines() const; + int LineStart(int line) const; int LineFromPosition(int pos) { return lv.LineFromPosition(pos); } const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); diff --git a/src/Document.cxx b/src/Document.cxx index 4461e0e72..686758d92 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -149,11 +149,11 @@ void Document::DeleteAllMarks(int markerNum) { NotifyModified(mh); } -int Document::LineStart(int line) { +int Document::LineStart(int line) const { return cb.LineStart(line); } -int Document::LineEnd(int line) { +int Document::LineEnd(int line) const { if (line == LinesTotal() - 1) { return LineStart(line + 1); } else { @@ -652,7 +652,7 @@ void Document::SetLineIndentation(int line, int indent) { } } -int Document::GetLineIndentPosition(int line) { +int Document::GetLineIndentPosition(int line) const { if (line < 0) return 0; int pos = LineStart(line); @@ -793,7 +793,7 @@ void Document::ConvertLineEnds(int eolModeSet) { EndUndoAction(); } -bool Document::IsWhiteLine(int line) { +bool Document::IsWhiteLine(int line) const { int currentChar = LineStart(line); int endLine = LineEnd(line); while (currentChar < endLine) { @@ -1238,7 +1238,7 @@ const char *Document::SubstituteByPosition(const char *text, int *length) { return substituted; } -int Document::LinesTotal() { +int Document::LinesTotal() const { return cb.Lines(); } diff --git a/src/Document.h b/src/Document.h index b9774efe0..4b13da060 100644 --- a/src/Document.h +++ b/src/Document.h @@ -160,7 +160,7 @@ public: int GetLineIndentation(int line); void SetLineIndentation(int line, int indent); - int GetLineIndentPosition(int line); + int GetLineIndentPosition(int line) const; int GetColumn(int position); int FindColumn(int line, int column); void Indent(bool forwards, int lineBottom, int lineTop); @@ -187,8 +187,8 @@ public: void DeleteMarkFromHandle(int markerHandle); void DeleteAllMarks(int markerNum); int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } - int LineStart(int line); - int LineEnd(int line); + int LineStart(int line) const; + int LineEnd(int line) const; int LineEndPosition(int position); int VCHomePosition(int position); @@ -202,13 +202,13 @@ public: int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); int NextWordStart(int pos, int delta); int NextWordEnd(int pos, int delta); - int Length() { return cb.Length(); } + int Length() const { return cb.Length(); } void Allocate(int newSize) { cb.Allocate(newSize); } long FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length); long FindText(int iMessage, unsigned long wParam, long lParam); const char *SubstituteByPosition(const char *text, int *length); - int LinesTotal(); + int LinesTotal() const; void ChangeCase(Range r, bool makeUpperCase); @@ -237,7 +237,7 @@ public: int WordPartLeft(int pos); int WordPartRight(int pos); int ExtendStyleRange(int pos, int delta, bool singleLine = false); - bool IsWhiteLine(int line); + bool IsWhiteLine(int line) const; int ParaUp(int pos); int ParaDown(int pos); int IndentSize() { return actualIndentInChars; } diff --git a/src/Partitioning.h b/src/Partitioning.h index 175eba7b5..752e69614 100644 --- a/src/Partitioning.h +++ b/src/Partitioning.h @@ -89,7 +89,7 @@ public: body = 0; } - int Partitions() { + int Partitions() const { return body->Length()-1; } @@ -141,7 +141,7 @@ public: body->Delete(partition); } - int PositionFromPartition(int partition) { + int PositionFromPartition(int partition) const { PLATFORM_ASSERT(partition >= 0); PLATFORM_ASSERT(partition < body->Length()); if ((partition < 0) || (partition >= body->Length())) { |