diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-13 09:03:51 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-13 09:03:51 +1000 |
commit | 14c1607adb7afa9782e8dc7c8b23ea7e3ec60a6b (patch) | |
tree | 6a545f5ba601f553746a0e47b226dff28111d19e /src/Document.cxx | |
parent | 908a138a46e39a39bb1a4aa1fcdab9a3432c0c3b (diff) | |
download | scintilla-mirror-14c1607adb7afa9782e8dc7c8b23ea7e3ec60a6b.tar.gz |
Backport: Use 'override' for methods that are overridden.
Group some method declarations and definitions for AddRef/Release and PerLine.
Backport of changeset 6684:bd4aae09fb4b.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 1c9b1ceda..ea76f942d 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -128,6 +128,20 @@ Document::~Document() { } } +// Increase reference count and return its previous value. +int Document::AddRef() { + return refCount++; +} + +// Decrease reference count and return its previous value. +// Delete the document if reference count reaches zero. +int SCI_METHOD Document::Release() { + const int curRefCount = --refCount; + if (curRefCount == 0) + delete this; + return curRefCount; +} + void Document::Init() { for (const std::unique_ptr<PerLine> &pl : perLineData) { if (pl) @@ -135,6 +149,20 @@ void Document::Init() { } } +void Document::InsertLine(Sci::Line line) { + for (const std::unique_ptr<PerLine> &pl : perLineData) { + if (pl) + pl->InsertLine(line); + } +} + +void Document::RemoveLine(Sci::Line line) { + for (const std::unique_ptr<PerLine> &pl : perLineData) { + if (pl) + pl->RemoveLine(line); + } +} + LineMarkers *Document::Markers() const { return static_cast<LineMarkers *>(perLineData[ldMarkers].get()); } @@ -189,34 +217,6 @@ bool Document::SetLineEndTypesAllowed(int lineEndBitSet_) { } } -void Document::InsertLine(Sci::Line line) { - for (const std::unique_ptr<PerLine> &pl : perLineData) { - if (pl) - pl->InsertLine(line); - } -} - -void Document::RemoveLine(Sci::Line line) { - for (const std::unique_ptr<PerLine> &pl : perLineData) { - if (pl) - pl->RemoveLine(line); - } -} - -// Increase reference count and return its previous value. -int Document::AddRef() { - return refCount++; -} - -// Decrease reference count and return its previous value. -// Delete the document if reference count reaches zero. -int SCI_METHOD Document::Release() { - const int curRefCount = --refCount; - if (curRefCount == 0) - delete this; - return curRefCount; -} - void Document::SetSavePoint() { cb.SetSavePoint(); NotifySavePoint(true); |