Skip to content

Commit a5164f7

Browse files
committed
CollectionIterator: remove data()
1 parent a9996d2 commit a5164f7

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/ArduinoJson/Array/ArrayImpl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline VariantData* VariantImpl::getOrAddElement(size_t index) {
4040
}
4141
if (it.done())
4242
index++;
43-
VariantData* element = it.data();
43+
VariantData* element = it->data();
4444
while (index > 0) {
4545
element = addElement();
4646
if (!element)
@@ -51,7 +51,7 @@ inline VariantData* VariantImpl::getOrAddElement(size_t index) {
5151
}
5252

5353
inline VariantData* VariantImpl::getElement(size_t index) const {
54-
return at(index).data();
54+
return at(index)->data();
5555
}
5656

5757
inline void VariantImpl::removeElement(iterator it) {

src/ArduinoJson/Collection/CollectionImpl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ inline void VariantImpl::removeOne(iterator it) {
6565
if (it.done())
6666
return;
6767
auto coll = getCollectionData();
68-
auto curr = it.data();
68+
auto curr = it->data();
6969
auto prev = getPreviousSlot(curr);
7070
auto next = curr->next;
7171
if (prev)
@@ -74,14 +74,14 @@ inline void VariantImpl::removeOne(iterator it) {
7474
coll->head = next;
7575
if (next == NULL_SLOT)
7676
coll->tail = prev.id();
77-
freeVariant({it.data(), it.currentId_});
77+
freeVariant({it->data(), it.currentId_});
7878
}
7979

8080
inline void VariantImpl::removePair(VariantImpl::iterator it) {
8181
if (it.done())
8282
return;
8383

84-
auto keySlot = it.data();
84+
auto keySlot = it->data();
8585

8686
auto valueId = keySlot->next;
8787
auto valueSlot = getVariant(valueId);

src/ArduinoJson/Collection/CollectionIterator.hpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,13 @@ class CollectionIterator {
4343
}
4444

4545
bool operator==(const CollectionIterator& other) const {
46-
return data() == other.data();
46+
return value_.data() == other->data();
4747
}
4848

4949
bool operator!=(const CollectionIterator& other) const {
5050
return !operator==(other);
5151
}
5252

53-
VariantData* data() {
54-
return value_.data();
55-
}
56-
57-
const VariantData* data() const {
58-
return value_.data();
59-
}
60-
6153
private:
6254
CollectionIterator(SlotId slotId, ResourceManager* resources)
6355
: value_(resources->getVariant(slotId), resources), currentId_(slotId) {}

src/ArduinoJson/Object/ObjectImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inline VariantData* VariantImpl::getMember(TAdaptedString key) const {
1515
if (it.done())
1616
return nullptr;
1717
it.next();
18-
return it.data();
18+
return it->data();
1919
}
2020

2121
template <typename TAdaptedString>

0 commit comments

Comments
 (0)