Add tests, fix missing bool in Accept and operator[] insert
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
This commit is contained in:
@@ -407,7 +407,22 @@ namespace AZ::Dom
|
||||
|
||||
Value& Value::operator[](KeyType name)
|
||||
{
|
||||
return FindMember(name)->second;
|
||||
Object::ContainerType& object = GetObjectInternal();
|
||||
auto existingEntry = AZStd::find_if(
|
||||
object.begin(), object.end(),
|
||||
[&name](const Object::EntryType& entry)
|
||||
{
|
||||
return entry.first == name;
|
||||
});
|
||||
if (existingEntry != object.end())
|
||||
{
|
||||
return existingEntry->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
object.emplace_back(name, Value());
|
||||
return object[object.size() - 1].second;
|
||||
}
|
||||
}
|
||||
|
||||
const Value& Value::operator[](KeyType name) const
|
||||
@@ -924,6 +939,10 @@ namespace AZ::Dom
|
||||
{
|
||||
result = visitor.Double(arg);
|
||||
}
|
||||
else if constexpr (AZStd::is_same_v<Alternative, bool>)
|
||||
{
|
||||
result = visitor.Bool(arg);
|
||||
}
|
||||
else if constexpr (AZStd::is_same_v<Alternative, AZStd::string_view>)
|
||||
{
|
||||
result = visitor.String(arg, copyStrings ? Lifetime::Temporary : Lifetime::Persistent);
|
||||
|
||||
Reference in New Issue
Block a user