mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +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
Notes:
sideshowbarker
2024-07-19 08:53:13 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/dc039fdc7ef
2 changed files with 2 additions and 8 deletions
|
@ -68,8 +68,7 @@ public:
|
|||
const JsonValue& operator[](int index) const { return at(index); }
|
||||
|
||||
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>
|
||||
typename Builder::OutputType serialized() const;
|
||||
|
|
|
@ -85,16 +85,11 @@ public:
|
|||
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));
|
||||
}
|
||||
|
||||
void set(const String& key, const JsonValue& value)
|
||||
{
|
||||
m_members.set(key, JsonValue(value));
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_member(Callback callback) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue