mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 18:57:32 +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));
|
writeInteger(uint32_t(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto slotId = array.head();
|
for (auto it = array.createIterator(); !it.done(); it.move())
|
||||||
while (slotId != NULL_SLOT) {
|
it->accept(*this);
|
||||||
auto slot = resources_->getVariant(slotId);
|
|
||||||
VariantImpl(slot, resources_).accept(*this);
|
|
||||||
slotId = slot->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytesWritten();
|
return bytesWritten();
|
||||||
}
|
}
|
||||||
@ -81,12 +77,8 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
|||||||
writeInteger(uint32_t(n));
|
writeInteger(uint32_t(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto slotId = object.head();
|
for (auto it = object.createIterator(); !it.done(); it.move())
|
||||||
while (slotId != NULL_SLOT) {
|
it->accept(*this);
|
||||||
auto slot = resources_->getVariant(slotId);
|
|
||||||
VariantImpl(slot, resources_).accept(*this);
|
|
||||||
slotId = slot->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytesWritten();
|
return bytesWritten();
|
||||||
}
|
}
|
||||||
|
@ -266,10 +266,6 @@ class VariantImpl {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SlotId head() const {
|
|
||||||
return getCollectionData()->head;
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator createIterator() const;
|
iterator createIterator() const;
|
||||||
|
|
||||||
VariantData* getElement(size_t index) const;
|
VariantData* getElement(size_t index) const;
|
||||||
|
Reference in New Issue
Block a user