diff --git a/AK/JsonArray.h b/AK/JsonArray.h index 9e318e47cb..afba071cb8 100644 --- a/AK/JsonArray.h +++ b/AK/JsonArray.h @@ -10,6 +10,30 @@ public: JsonArray() {} ~JsonArray() {} + JsonArray(const JsonArray& other) + : m_values(other.m_values) + { + } + + JsonArray(JsonArray&& other) + : m_values(move(other.m_values)) + { + } + + JsonArray& operator=(const JsonArray& other) + { + if (this != &other) + m_values = other.m_values; + return *this; + } + + JsonArray& operator=(JsonArray&& other) + { + if (this != &other) + m_values = move(other.m_values); + return *this; + } + int size() const { return m_values.size(); } bool is_empty() const { return m_values.is_empty(); } @@ -18,6 +42,7 @@ public: void clear() { m_values.clear(); } void append(const JsonValue& value) { m_values.append(value); } + void append(JsonValue&& value) { m_values.append(move(value)); } String serialized() const; void serialize(StringBuilder&) const; diff --git a/AK/JsonObject.h b/AK/JsonObject.h index 2796db1c53..a21e9f03c3 100644 --- a/AK/JsonObject.h +++ b/AK/JsonObject.h @@ -9,7 +9,31 @@ namespace AK { class JsonObject { public: JsonObject() { } - ~JsonObject() { } + ~JsonObject() {} + + JsonObject(const JsonObject& other) + : m_members(other.m_members) + { + } + + JsonObject(JsonObject&& other) + : m_members(move(other.m_members)) + { + } + + JsonObject& operator=(const JsonObject& other) + { + if (this != &other) + m_members = other.m_members; + return *this; + } + + JsonObject& operator=(JsonObject&& other) + { + if (this != &other) + m_members = move(other.m_members); + return *this; + } int size() const { return m_members.size(); } bool is_empty() const { return m_members.is_empty(); }