From 2c2e5fab6110b483459236ae1320decc5b138cbc Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 3 Mar 2018 13:42:08 +1100 Subject: Backport: Split LineVector into interface and implementation classes to allow future choice between 32-bit and 64-bit position implementations. Backport of changeset 6682:59913262eb19. --- src/CellBuffer.h | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'src/CellBuffer.h') diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 7c999a36e..544a26711 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -22,33 +22,7 @@ public: /** * The line vector contains information about each of the lines in a cell buffer. */ -class LineVector { - - Partitioning starts; - PerLine *perLine; - -public: - - LineVector(); - // Deleted so LineVector objects can not be copied. - LineVector(const LineVector &) = delete; - void operator=(const LineVector &) = delete; - ~LineVector(); - void Init(); - void SetPerLine(PerLine *pl); - - void InsertText(Sci::Line line, Sci::Position delta); - void InsertLine(Sci::Line line, Sci::Position position, bool lineStart); - void SetLineStart(Sci::Line line, Sci::Position position); - void RemoveLine(Sci::Line line); - Sci::Line Lines() const { - return starts.Partitions(); - } - Sci::Line LineFromPosition(Sci::Position pos) const; - Sci::Position LineStart(Sci::Line line) const { - return starts.PositionFromPartition(line); - } -}; +class ILineVector; enum actionType { insertAction, removeAction, startAction, containerAction }; @@ -142,7 +116,7 @@ private: bool collectingUndo; UndoHistory uh; - LineVector lv; + std::unique_ptr plv; bool UTF8LineEndOverlaps(Sci::Position position) const; void ResetLineEnds(); @@ -175,7 +149,7 @@ public: void SetPerLine(PerLine *pl); Sci::Line Lines() const; Sci::Position LineStart(Sci::Line line) const; - Sci::Line LineFromPosition(Sci::Position pos) const { return lv.LineFromPosition(pos); } + Sci::Line LineFromPosition(Sci::Position pos) const; void InsertLine(Sci::Line line, Sci::Position position, bool lineStart); void RemoveLine(Sci::Line line); const char *InsertString(Sci::Position position, const char *s, Sci::Position insertLength, bool &startSequence); -- cgit v1.2.3