mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 10:17:39 +02:00
MsgPackSerializer: use iterators to serialize array and objects
This commit is contained in:
@ -59,12 +59,8 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
||||
writeInteger(uint32_t(n));
|
||||
}
|
||||
|
||||
auto slotId = array.head();
|
||||
while (slotId != NULL_SLOT) {
|
||||
auto slot = resources_->getVariant(slotId);
|
||||
VariantImpl(slot, resources_).accept(*this);
|
||||
slotId = slot->next;
|
||||
}
|
||||
for (auto it = array.createIterator(); !it.done(); it.move())
|
||||
it->accept(*this);
|
||||
|
||||
return bytesWritten();
|
||||
}
|
||||
@ -81,12 +77,8 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
||||
writeInteger(uint32_t(n));
|
||||
}
|
||||
|
||||
auto slotId = object.head();
|
||||
while (slotId != NULL_SLOT) {
|
||||
auto slot = resources_->getVariant(slotId);
|
||||
VariantImpl(slot, resources_).accept(*this);
|
||||
slotId = slot->next;
|
||||
}
|
||||
for (auto it = object.createIterator(); !it.done(); it.move())
|
||||
it->accept(*this);
|
||||
|
||||
return bytesWritten();
|
||||
}
|
||||
|
@ -266,10 +266,6 @@ class VariantImpl {
|
||||
}
|
||||
#endif
|
||||
|
||||
SlotId head() const {
|
||||
return getCollectionData()->head;
|
||||
}
|
||||
|
||||
iterator createIterator() const;
|
||||
|
||||
VariantData* getElement(size_t index) const;
|
||||
|
Reference in New Issue
Block a user