You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
446 B
26 lines
446 B
/* |
|
* Copyright (C) 2022 Riyyi |
|
* |
|
* SPDX-License-Identifier: MIT |
|
*/ |
|
|
|
#include "util/json/object.h" |
|
#include "util/json/value.h" |
|
|
|
namespace Util::JSON { |
|
|
|
void Object::emplace(const std::string& name, Value value) |
|
{ |
|
m_members.emplace(name, std::move(value)); |
|
} |
|
|
|
Value& Object::operator[](const std::string& name) |
|
{ |
|
if (m_members.find(name) == m_members.end()) { |
|
emplace(name, {}); |
|
} |
|
|
|
return m_members.at(name); |
|
} |
|
|
|
} // namespace Util::JSON
|
|
|