summaryrefslogtreecommitdiff
path: root/json-glib
Commit message (Collapse)AuthorAgeFilesLines
...
* Parse bare root valuesEmmanuele Bassi2007-10-101-50/+29
| | | | | | | | If the root node contains just a bare value (true, false, null, fundamental type) then it's still valid JSON. Also, use the commodity JsonNode API to avoid using values in the parser code.
* Add json_node_dup_string()Emmanuele Bassi2007-10-082-0/+21
| | | | | The newly added json_node_dup_string() is a convenience function for getting a copy of the string contained inside a JsonNode.
* Fix documentation about the ownership of the nodesEmmanuele Bassi2007-10-072-7/+13
| | | | | When adding a JsonNode to a JsonObject or a JsonArray, the containers take ownership of the node.
* Add convenience accessors for fundamental types in JsonNodeEmmanuele Bassi2007-10-052-0/+213
| | | | | | This commit adds some convenience accessors for setting and getting fundamental types in and from a JsonNode, to avoid jumping through all the GValue hoops.
* Use doubles when parsing, not floatsEmmanuele Bassi2007-10-051-4/+4
| | | | | | GScanner advertise the floating point values as floats, but it really uses doubles. Hence, we need to use G_TYPE_DOUBLE when saving the parsed constants into a GValue.
* Add line/position getters to JsonParserEmmanuele Bassi2007-10-052-12/+55
| | | | | | Add two methods to JsonParser to retrieve the currently parsed line and position within that line. These methods works only while parsing, so within the signal handlers and inside subclasses.
* Document the newly added signalsEmmanuele Bassi2007-10-052-1/+73
|
* Add more signals to the JsonParser classEmmanuele Bassi2007-10-053-6/+141
| | | | | | | JsonParser should emit signals in critical places, like: start/end of the parsing process; start and end of a JsonObject and a JsonArray; completion of every member and element of a JsonObject and a JsonArray. These signals require the addition of some custom marshaller.
* Implement the GType functions for JsonObject and JsonArrayEmmanuele Bassi2007-10-053-2/+28
| | | | | | | | | | The type functions for the JsonObject and JsonArray types were declared, albeit with the wrong return value, but not implemented. This commit fixed the return value and implements them. JsonObject and JsonArray are boxed types because we don't need them to be GObjects (no signals, no inheritance and their implementation must be completely opaque for the developer).
* Add GObject serialization support for JSON-GLibEmmanuele Bassi2007-10-023-0/+204
| | | | | This commit adds json-gobject.h and json_serialize_gobject() to JSON-GLib, to serialize a GObject instance into a JSON data stream.
* Add objects supportEmmanuele Bassi2007-10-021-3/+122
| | | | | JsonGenerator can now create objects and array-nested objects, with and without pretty printing. The test suite has been updated accordingly.
* Add nested arrays supportEmmanuele Bassi2007-10-011-0/+10
| | | | | JsonGenerator now supports nested arrays, both with and without pretty printing. The tests suite has been updated accordingly.
* Simple arrays generationEmmanuele Bassi2007-10-011-5/+155
| | | | | | | JsonGenerator now can create simple arrays, with "pretty" enabled and disabled. Simple arrays are just one-level, value-only arrays. The test unit has been updated to exercise this new feature.
* Add missing json-generator.h headerEmmanuele Bassi2007-10-011-0/+1
|
* Document the new public functionsEmmanuele Bassi2007-10-014-0/+117
| | | | | Now that we moved the constructors and setters for the JSON data types into the public symbols we need to document them to get back to 100% doc coverage.
* Move data types ctors and setters into the public headersEmmanuele Bassi2007-10-018-48/+32
| | | | | | | Now that we are providing a generator class we need to provide the constructors and setters for JsonNode, JsonObject and JsonArray. This also means that the json-private.h header is now useless, so we can remove it from the build and repository.
* Add stub class for JsonGeneratorEmmanuele Bassi2007-10-013-0/+339
| | | | | | JsonGenerator is an object that creates JSON data streams from a data model tree. This commit adds the JsonGenerator class to the build and API reference.
* Complete API reference of JSON-GLibEmmanuele Bassi2007-10-012-0/+39
| | | | With this commit, we reach 100% coverage.
* Implement json_node_get_parent()Emmanuele Bassi2007-10-011-0/+16
| | | | | It seems that the parent accessor fell through. This commit implements the declared json_node_get_parent() function.
* Add licensing informations to the source codeEmmanuele Bassi2007-10-017-14/+202
|
* Add API reference for JSON-GLibEmmanuele Bassi2007-10-012-1/+9
| | | | | Use gtk-doc to build the various bits and pieces of the API reference for JSON-GLib.
* Swallow the comma earlier in the parserEmmanuele Bassi2007-10-011-9/+16
| | | | | The comma is used as a member and element separator, so it should be swallowed by the parser as soon as possible.
* Add JSON object parsingEmmanuele Bassi2007-10-011-15/+220
| | | | | | This commit completes the JsonParser class by adding the ability to parse JSON objects, either alone or inside arrays. JsonParser is now a JSON parser.
* Declare json_node_take_object() and json_node_take_array()Emmanuele Bassi2007-10-011-0/+4
| | | | | | | JsonParser uses the take variant of JsonNode setters for objects and arrays since it's the one creating the objects. This way, we avoid leaks and the extra complexity of unreffing the newly created complex containers after setting them into the JsonNodes.
* Chain up nodes to their parentEmmanuele Bassi2007-10-011-1/+5
| | | | | When parsing a JSON node we need to correctly set up the parent node of the newly created ones.
* Add JsonNode, a generic container for JSON typesEmmanuele Bassi2007-10-019-231/+427
| | | | | | | | | | | | | | | | | This huge commit removes JsonData and adds JsonNode, the generic container for fundamental and complex data types extracted from a JSON stream. The contents of a JsonNode can be extracted from it in form of a GValue for fundamental types (integers, floats, strings, booleans) or in form of JsonObject and JsonArray objects. JsonObject and JsonArray now accept JsonNodes instead of GValues. The JsonParser object builds the data model tree when parsing a JSON stream; the tree can be recursed by getting the root node and walking it using the GValue API for the fundamental types and the objects/arrays API for complex types. The API has been updated and the tests now recurse through the generated data model tree.
* Add JsonData, an opaque container for JSON data typesEmmanuele Bassi2007-09-214-16/+138
| | | | | | | JsonData is like GValue, but it stores JSON data types (objects and arrays) and allows us to retrieve them safely. This way we can actually know the type of the objects returned by the parser and by the other object walking functions.
* Skip the token check after parsing a nested arrayEmmanuele Bassi2007-09-211-0/+2
| | | | | | Since there cannot be any other token except for the comma, which we eat anyway, there's no point in going through the switch() check after we have finished parsing a nested array.
* Parse JSON arraysEmmanuele Bassi2007-09-211-17/+97
| | | | | | | Add the array parsing code. The parser identifies and builds nested levels of arrays, but the storage is not quite right. That is a problem of the parser object, though, so this can be considered a first raw pass at the problem.
* Top-levels in JSON can only be objects or arraysEmmanuele Bassi2007-09-211-10/+14
| | | | | JSON is an object serialisation format (thanks, RFC4627), so it can only express objects and/or arrays as top-levels.
* Add stubs to JsonParser for actually parsing a JSON streamEmmanuele Bassi2007-09-212-4/+290
| | | | | | | | | | | | | | | | | Initial commit for getting JsonParser to work. Because GScanner API is old and mostly sucks, we need to do some magic with signals. If json_parser_load_from_data() fails, the passed GError will be set with a JSON_PARSER_ERROR code and message; unfortunately, we can't get the nice error message out of GScanner. We can, however, override the default message handler and make it emit a signal on the JsonParser object. So, to make a long story short: the GError passed to the load_from_data() method is filled with a short error message; the *real* error message is passed to the ::error signal handlers so they can actually use it. GScanner should really get a way to retrieve the last error message.
* Add marshallers generation to the buildEmmanuele Bassi2007-09-212-5/+26
| | | | | Use glib-genmarshal to generate the marshallers we need. For the time being, we just need a (void,pointer).
* Initial import of JSON-GLibEmmanuele Bassi2007-09-209-0/+769
JSON-GLib is a JSON parser library written with GLib and GObject. JSON is the JavaScript Object Notation, and it's used to define objects and object hierarchies in a human-readable way.