mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 18:27:37 +02:00
Add VariantData::removeElement()
This commit is contained in:
@ -15,6 +15,8 @@
|
||||
ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
||||
|
||||
VariantData* collectionAddElement(CollectionData* array, MemoryPool* pool);
|
||||
void collectionRemoveElement(CollectionData* data, size_t index,
|
||||
MemoryPool* pool);
|
||||
template <typename T>
|
||||
T parseNumber(const char* s);
|
||||
void slotRelease(VariantSlot* slot, MemoryPool* pool);
|
||||
@ -275,6 +277,10 @@ class VariantData {
|
||||
flags_ = uint8_t((flags_ & OWNED_KEY_BIT) | (src.flags_ & ~OWNED_KEY_BIT));
|
||||
}
|
||||
|
||||
void removeElement(size_t index, MemoryPool* pool) {
|
||||
collectionRemoveElement(asArray(), index, pool);
|
||||
}
|
||||
|
||||
template <typename TAdaptedString>
|
||||
void removeMember(TAdaptedString key, MemoryPool* pool) {
|
||||
collectionRemoveMember(asObject(), key, pool);
|
||||
|
@ -13,8 +13,6 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
|
||||
|
||||
bool collectionCopy(CollectionData* dst, const CollectionData* src,
|
||||
MemoryPool* pool);
|
||||
void collectionRemoveElement(CollectionData* data, size_t index,
|
||||
MemoryPool* pool);
|
||||
|
||||
template <typename TVisitor>
|
||||
inline typename TVisitor::result_type variantAccept(const VariantData* var,
|
||||
@ -157,7 +155,7 @@ inline void variantRemoveElement(VariantData* var, size_t index,
|
||||
MemoryPool* pool) {
|
||||
if (!var)
|
||||
return;
|
||||
collectionRemoveElement(var->asArray(), index, pool);
|
||||
var->removeElement(index, pool);
|
||||
}
|
||||
|
||||
template <typename TAdaptedString>
|
||||
|
Reference in New Issue
Block a user