From 1596a6d6b4540980cd6a8249460d881d6d190c1f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 26 May 2012 15:15:07 +1000 Subject: Add GetRangePointer and GetGapPosition methods. --- src/SplitVector.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/SplitVector.h') diff --git a/src/SplitVector.h b/src/SplitVector.h index 44d5ddc0e..0ccf6c9f4 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -261,6 +261,24 @@ public: body[lengthBody] = 0; return body; } + + T *RangePointer(int position, int rangeLength) { + if (position < part1Length) { + if ((position + rangeLength) > part1Length) { + // Range overlaps gap, so move gap to start of range. + GapTo(position); + return body + position + gapLength; + } else { + return body + position ; + } + } else { + return body + position + gapLength; + } + } + + int GapPosition() const { + return part1Length; + } }; #endif -- cgit v1.2.3