mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 10:17:39 +02:00
CollectionIterator: remove data()
This commit is contained in:
@ -40,7 +40,7 @@ inline VariantData* VariantImpl::getOrAddElement(size_t index) {
|
||||
}
|
||||
if (it.done())
|
||||
index++;
|
||||
VariantData* element = it.data();
|
||||
VariantData* element = it->data();
|
||||
while (index > 0) {
|
||||
element = addElement();
|
||||
if (!element)
|
||||
@ -51,7 +51,7 @@ inline VariantData* VariantImpl::getOrAddElement(size_t index) {
|
||||
}
|
||||
|
||||
inline VariantData* VariantImpl::getElement(size_t index) const {
|
||||
return at(index).data();
|
||||
return at(index)->data();
|
||||
}
|
||||
|
||||
inline void VariantImpl::removeElement(iterator it) {
|
||||
|
@ -65,7 +65,7 @@ inline void VariantImpl::removeOne(iterator it) {
|
||||
if (it.done())
|
||||
return;
|
||||
auto coll = getCollectionData();
|
||||
auto curr = it.data();
|
||||
auto curr = it->data();
|
||||
auto prev = getPreviousSlot(curr);
|
||||
auto next = curr->next;
|
||||
if (prev)
|
||||
@ -74,14 +74,14 @@ inline void VariantImpl::removeOne(iterator it) {
|
||||
coll->head = next;
|
||||
if (next == NULL_SLOT)
|
||||
coll->tail = prev.id();
|
||||
freeVariant({it.data(), it.currentId_});
|
||||
freeVariant({it->data(), it.currentId_});
|
||||
}
|
||||
|
||||
inline void VariantImpl::removePair(VariantImpl::iterator it) {
|
||||
if (it.done())
|
||||
return;
|
||||
|
||||
auto keySlot = it.data();
|
||||
auto keySlot = it->data();
|
||||
|
||||
auto valueId = keySlot->next;
|
||||
auto valueSlot = getVariant(valueId);
|
||||
|
@ -43,21 +43,13 @@ class CollectionIterator {
|
||||
}
|
||||
|
||||
bool operator==(const CollectionIterator& other) const {
|
||||
return data() == other.data();
|
||||
return value_.data() == other->data();
|
||||
}
|
||||
|
||||
bool operator!=(const CollectionIterator& other) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
VariantData* data() {
|
||||
return value_.data();
|
||||
}
|
||||
|
||||
const VariantData* data() const {
|
||||
return value_.data();
|
||||
}
|
||||
|
||||
private:
|
||||
CollectionIterator(SlotId slotId, ResourceManager* resources)
|
||||
: value_(resources->getVariant(slotId), resources), currentId_(slotId) {}
|
||||
|
@ -15,7 +15,7 @@ inline VariantData* VariantImpl::getMember(TAdaptedString key) const {
|
||||
if (it.done())
|
||||
return nullptr;
|
||||
it.next();
|
||||
return it.data();
|
||||
return it->data();
|
||||
}
|
||||
|
||||
template <typename TAdaptedString>
|
||||
|
Reference in New Issue
Block a user