diff options
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 b3b445b02..3aba79f57 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -124,6 +124,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) @@ -131,6 +145,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()); } @@ -185,34 +213,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); |