mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
AK: Simplify JsonObject and JsonArray API a little bit
Instead of set(const JsonValue&) and set(JsonValue&&), just do set(JsonValue) and let callers move() if they want. This removes some ambiguity and the compiler is smart enough to optimize it anyway.
This commit is contained in:
parent
211e938234
commit
dc039fdc7e
2 changed files with 2 additions and 8 deletions
|
@ -68,8 +68,7 @@ public:
|
||||||
const JsonValue& operator[](int index) const { return at(index); }
|
const JsonValue& operator[](int index) const { return at(index); }
|
||||||
|
|
||||||
void clear() { m_values.clear(); }
|
void clear() { m_values.clear(); }
|
||||||
void append(const JsonValue& value) { m_values.append(value); }
|
void append(JsonValue value) { m_values.append(move(value)); }
|
||||||
void append(JsonValue&& value) { m_values.append(move(value)); }
|
|
||||||
|
|
||||||
template<typename Builder>
|
template<typename Builder>
|
||||||
typename Builder::OutputType serialized() const;
|
typename Builder::OutputType serialized() const;
|
||||||
|
|
|
@ -85,16 +85,11 @@ public:
|
||||||
return m_members.contains(key);
|
return m_members.contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(const String& key, JsonValue&& value)
|
void set(const String& key, JsonValue value)
|
||||||
{
|
{
|
||||||
m_members.set(key, move(value));
|
m_members.set(key, move(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(const String& key, const JsonValue& value)
|
|
||||||
{
|
|
||||||
m_members.set(key, JsonValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void for_each_member(Callback callback) const
|
void for_each_member(Callback callback) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue