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