summaryrefslogtreecommitdiff
path: root/AK/JsonObject.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-08 13:08:21 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-08 13:08:21 +0200
commita8aadf73e98a6aca7a610744e4d9971739338d84 (patch)
treebc72918fa305a939d5a118c0ee7eb405882ea58a /AK/JsonObject.h
parent7bb1e465c627cdf4305e306d6c261f8b39c4a7f8 (diff)
downloadserenity-a8aadf73e98a6aca7a610744e4d9971739338d84.zip
AK: Add JsonObject::set(key, &&value) overload.
This dodges a whole bunch of value copying in JsonParser.
Diffstat (limited to 'AK/JsonObject.h')
-rw-r--r--AK/JsonObject.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/AK/JsonObject.h b/AK/JsonObject.h
index cb8a71a40f..2796db1c53 100644
--- a/AK/JsonObject.h
+++ b/AK/JsonObject.h
@@ -22,9 +22,14 @@ public:
return (*it).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, value);
+ m_members.set(key, JsonValue(value));
}
template<typename Callback>