added highlights to the scrollbar
This commit is contained in:
@@ -132,7 +132,7 @@ public:
|
||||
return acceptedItems;
|
||||
}
|
||||
|
||||
// replaces a single item, return true if successful
|
||||
// replace an single item, return index if successful, -1 if unsuccessful
|
||||
int replaceItem(const T &item, const T &replacement)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(this->mutex);
|
||||
@@ -166,6 +166,38 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
// replace an item at index, return true if worked
|
||||
bool replaceItem(size_t index, const T &replacement)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(this->mutex);
|
||||
|
||||
int x = 0;
|
||||
|
||||
for (size_t i = 0; i < this->chunks->size(); i++) {
|
||||
Chunk &chunk = this->chunks->at(i);
|
||||
|
||||
size_t start = i == 0 ? this->firstChunkOffset : 0;
|
||||
size_t end = i == chunk->size() - 1 ? this->lastChunkEnd : chunk->size();
|
||||
|
||||
for (size_t j = start; j < end; j++) {
|
||||
if (x == index) {
|
||||
Chunk newChunk = std::make_shared<std::vector<T>>();
|
||||
newChunk->resize(chunk->size());
|
||||
|
||||
for (size_t k = 0; k < chunk->size(); k++) {
|
||||
newChunk->at(k) = chunk->at(k);
|
||||
}
|
||||
|
||||
newChunk->at(j) = replacement;
|
||||
this->chunks->at(i) = newChunk;
|
||||
|
||||
return x;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void insertAfter(const std::vector<T> &items, const T &index)
|
||||
|
||||
messages::LimitedQueueSnapshot<T> getSnapshot()
|
||||
|
||||
Reference in New Issue
Block a user