From 14c1607adb7afa9782e8dc7c8b23ea7e3ec60a6b Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 13 Apr 2018 09:03:51 +1000 Subject: Backport: Use 'override' for methods that are overridden. Group some method declarations and definitions for AddRef/Release and PerLine. Backport of changeset 6684:bd4aae09fb4b. --- src/Document.cxx | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src/Document.cxx') 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 &pl : perLineData) { if (pl) @@ -135,6 +149,20 @@ void Document::Init() { } } +void Document::InsertLine(Sci::Line line) { + for (const std::unique_ptr &pl : perLineData) { + if (pl) + pl->InsertLine(line); + } +} + +void Document::RemoveLine(Sci::Line line) { + for (const std::unique_ptr &pl : perLineData) { + if (pl) + pl->RemoveLine(line); + } +} + LineMarkers *Document::Markers() const { return static_cast(perLineData[ldMarkers].get()); } @@ -189,34 +217,6 @@ bool Document::SetLineEndTypesAllowed(int lineEndBitSet_) { } } -void Document::InsertLine(Sci::Line line) { - for (const std::unique_ptr &pl : perLineData) { - if (pl) - pl->InsertLine(line); - } -} - -void Document::RemoveLine(Sci::Line line) { - for (const std::unique_ptr &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); -- cgit v1.2.3