Add VariantData::removeMember()

This commit is contained in:
Benoit Blanchon
2023-05-25 10:18:13 +02:00
parent a97bcb6b2d
commit 78d4f721ff
2 changed files with 6 additions and 4 deletions

View File

@ -261,6 +261,11 @@ class VariantData {
flags_ = uint8_t((flags_ & OWNED_KEY_BIT) | (src.flags_ & ~OWNED_KEY_BIT));
}
template <typename TAdaptedString>
void removeMember(TAdaptedString key, MemoryPool* pool) {
collectionRemoveMember(asObject(), key, pool);
}
void reset() {
flags_ = VALUE_IS_NULL;
}

View File

@ -15,9 +15,6 @@ bool collectionCopy(CollectionData* dst, const CollectionData* src,
MemoryPool* pool);
void collectionRemoveElement(CollectionData* data, size_t index,
MemoryPool* pool);
template <typename TAdaptedString>
void collectionRemoveMember(CollectionData* data, TAdaptedString key,
MemoryPool* pool);
template <typename TVisitor>
inline typename TVisitor::result_type variantAccept(const VariantData* var,
@ -183,7 +180,7 @@ void variantRemoveMember(VariantData* var, TAdaptedString key,
MemoryPool* pool) {
if (!var)
return;
collectionRemoveMember(var->asObject(), key, pool);
var->removeMember(key, pool);
}
inline bool variantIsNull(const VariantData* var) {