diff options
author | nyamatongwe <unknown> | 2011-06-07 11:37:15 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-06-07 11:37:15 +1000 |
commit | 43c5ebb9044c5f279f732d11b922c369bd7d373b (patch) | |
tree | 2331bbdc3e458e0794d152f43c26d33c53966b1e | |
parent | cfd7180e33b49c884738f4975584f0d010a28b99 (diff) | |
download | scintilla-mirror-43c5ebb9044c5f279f732d11b922c369bd7d373b.tar.gz |
Add accessor to RunStyles for number of runs so Decoration can use public API.
Make RunStyles internal methods private.
RunFromPosition is const so marker as const.
-rw-r--r-- | src/Decoration.cxx | 2 | ||||
-rw-r--r-- | src/RunStyles.cxx | 6 | ||||
-rw-r--r-- | src/RunStyles.h | 5 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/Decoration.cxx b/src/Decoration.cxx index e4ac0e07c..90bde57f2 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -28,7 +28,7 @@ Decoration::~Decoration() { } bool Decoration::Empty() { - return rs.starts->Partitions() == 1; + return rs.Runs() == 1; } DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0), diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index 0f2196972..c3414b4e8 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -21,7 +21,7 @@ using namespace Scintilla; #endif // Find the first run at a position -int RunStyles::RunFromPosition(int position) { +int RunStyles::RunFromPosition(int position) const { int run = starts->PartitionFromPosition(position); // Go to first element with this position while ((run > 0) && (position == starts->PositionFromPartition(run-1))) { @@ -216,6 +216,10 @@ void RunStyles::DeleteRange(int position, int deleteLength) { } } +int RunStyles::Runs() const { + return starts->Partitions(); +} + bool RunStyles::AllSame() const { for (int run = 1; run < starts->Partitions(); run++) { if (styles->ValueAt(run) != styles->ValueAt(run - 1)) diff --git a/src/RunStyles.h b/src/RunStyles.h index a3b7ac7d1..d79e28618 100644 --- a/src/RunStyles.h +++ b/src/RunStyles.h @@ -15,10 +15,10 @@ namespace Scintilla { #endif class RunStyles { -public: +private: Partitioning *starts; SplitVector<int> *styles; - int RunFromPosition(int position); + int RunFromPosition(int position) const; int SplitRun(int position); void RemoveRun(int run); void RemoveRunIfEmpty(int run); @@ -37,6 +37,7 @@ public: void InsertSpace(int position, int insertLength); void DeleteAll(); void DeleteRange(int position, int deleteLength); + int Runs() const; bool AllSame() const; bool AllSameAs(int value) const; }; |