Commit Graph

11 Commits

Author SHA1 Message Date
Andreas Kling
014f8ca8c4 AK: Allow JsonValue to store 64-bit integers internally
Add dedicated internal types for Int64 and UnsignedInt64. This makes it
a bit more straightforward to work with 64-bit numbers (instead of just
implicitly storing them as doubles.)
2019-10-29 16:36:50 +01:00
Andreas Kling
9c434d8c6a JsonObject: Add JsonObject::has(key) 2019-10-21 14:47:18 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Sergey Bugaev
216b7b3b80 JSON: Port JsonArray and JsonObject serialization to serializers
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-27 14:56:09 +02:00
Andreas Kling
f6998b1817 JSON: Templatize the JSON serialization code
This makes it possible to use something other than a StringBuilder for
serialization (and to produce something other than a String.) :^)
2019-08-07 21:29:32 +02:00
Andreas Kling
82826104e0 Json: Add efficient copy and move constructors for Json{Array,Object}
This helps avoid copying JsonValues during parsing.
2019-08-04 11:45:16 +02:00
Andreas Kling
a8aadf73e9 AK: Add JsonObject::set(key, &&value) overload.
This dodges a whole bunch of value copying in JsonParser.
2019-07-08 13:08:21 +02:00
Andreas Kling
dd36f797d5 JsonObject: Let the compiler generate a copy constructor.
This was only needed while HashMap was noncopyable. :^)
2019-06-24 12:03:11 +02:00
Andreas Kling
aa3df518e7 AK: Rename JsonObject::to_string() and pals to serialized().
And the variant that serializes into a StringBuilder is called serialize().
2019-06-18 09:37:47 +02:00
Andreas Kling
ee347effac AK: Use a single StringBuilder throughout JSON serialization. 2019-06-17 21:36:54 +02:00
Andreas Kling
04a8fc9bd7 AK: Add some classes for JSON encoding.
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.
2019-06-17 19:47:35 +02:00