diff options
author | Neil <nyamatongwe@gmail.com> | 2020-05-04 08:51:17 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2020-05-04 08:51:17 +1000 |
commit | 2175e34a7449f59ee6f9fa2466cbe13b6a92232e (patch) | |
tree | 4f79f04036f88905bea500406c8443db1545eee9 /src | |
parent | 4b450a69452a14fd9af6c426b91d04165fedc94a (diff) | |
download | scintilla-mirror-2175e34a7449f59ee6f9fa2466cbe13b6a92232e.tar.gz |
Feature [feature-requests:1347]. Add methods to insert multiple partitions.
Diffstat (limited to 'src')
-rw-r--r-- | src/Partitioning.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Partitioning.h b/src/Partitioning.h index 11c64bc83..195daae9b 100644 --- a/src/Partitioning.h +++ b/src/Partitioning.h @@ -122,6 +122,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())) { |