summaryrefslogtreecommitdiff
path: root/AK/JsonArray.h
AgeCommit message (Collapse)Author
2021-01-15AK: Add JsonArray(const Vector<T>) constructorLinus Groh
This simplifies creating a JsonArray from a Vector<T> (when there's a JsonValue(T) constructor overload for T, that is).
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2020-09-25Meta+AK: Make clang-format-10 cleanBen Wiederhake
2020-03-06AK: Simplify JsonObject and JsonArray API a little bitAndreas Kling
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.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-10-23AK: Add JsonArray::ensure_capacity()Andreas Kling
This is helpful for anyone who knows up-front how many items are gonna be appended to the JsonArray.
2019-08-27JSON: Port JsonArray and JsonObject serialization to serializersSergey Bugaev
This way, primitive JsonValue serialization is still handled by JsonValue::serialize(), but JsonArray and JsonObject serialization always goes through serializer classes. This is no less efficient if you have the whole JSON in memory already.
2019-08-07JSON: Templatize the JSON serialization codeAndreas Kling
This makes it possible to use something other than a StringBuilder for serialization (and to produce something other than a String.) :^)
2019-08-04Json: Add efficient copy and move constructors for Json{Array,Object}Andreas Kling
This helps avoid copying JsonValues during parsing.
2019-08-04JsonArray: Expose the value vector to the outside for convenienceAndreas Kling
Sometimes it's easier to just work with a const Vector<JsonValue>&, so give clients the option of doing that.
2019-06-24JsonArray: Add for_each() helper.Andreas Kling
2019-06-18AK: Rename JsonObject::to_string() and pals to serialized().Andreas Kling
And the variant that serializes into a StringBuilder is called serialize().
2019-06-17AK: Use a single StringBuilder throughout JSON serialization.Andreas Kling
2019-06-17AK: Add some classes for JSON encoding.Andreas Kling
This patch adds JsonValue, JsonObject and JsonArray. You can use them to build up a JsonObject and then serialize it to a string via to_string(). This patch only implements encoding, no decoding yet.