aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-05-04 08:51:17 +1000
committerNeil <nyamatongwe@gmail.com>2020-05-04 08:51:17 +1000
commitdb846a25067c22b097d637c66c2ffa8fb4c38769 (patch)
tree20d323fe6d943e50dd9cb711d3afaba16ee6b736 /src
parent60cd87963a771c22eda56365f4059c1fa117e3a3 (diff)
downloadscintilla-mirror-db846a25067c22b097d637c66c2ffa8fb4c38769.tar.gz
Backport: Feature [feature-requests:1347]. Add methods to insert multiple partitions.
Backport of changeset 8228:753e94011b20.
Diffstat (limited to 'src')
-rw-r--r--src/Partitioning.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Partitioning.h b/src/Partitioning.h
index bb3320b80..171a694d9 100644
--- a/src/Partitioning.h
+++ b/src/Partitioning.h
@@ -124,6 +124,26 @@ public:
stepPartition++;
}
+ void InsertPartitions(T partition, const T *positions, size_t length) {
+ if (stepPartition < partition) {
+ ApplyStep(partition);
+ }
+ body->InsertFromArray(partition, positions, 0, length);
+ stepPartition += static_cast<T>(length);
+ }
+
+ void InsertPartitionsWithCast(T partition, const ptrdiff_t *positions, size_t length) {
+ // Used for 64-bit builds when T is 32-bits
+ if (stepPartition < partition) {
+ ApplyStep(partition);
+ }
+ T *pInsertion = body->InsertEmpty(partition, length);
+ for (size_t i = 0; i < length; i++) {
+ pInsertion[i] = static_cast<T>(positions[i]);
+ }
+ stepPartition += static_cast<T>(length);
+ }
+
void SetPartitionStartPosition(T partition, T pos) noexcept {
ApplyStep(partition+1);
if ((partition < 0) || (partition > body->Length())) {