|
Objectively
Ultra-lightweight object oriented framework for GNU C.
|
#include <assert.h>#include <stddef.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "Boole.h"#include "JSONContext.h"#include "Array.h"#include "Data.h"#include "Dictionary.h"#include "Null.h"#include "Number.h"Go to the source code of this file.
Data Structures | |
| struct | JSONReader |
| Internal state for JSON text parsing. More... | |
| struct | JSONWriter |
| Internal state for JSON text generation. More... | |
Macros | |
| #define | _Class _JSONContext |
Functions | |
| Class * | _JSONContext (void) |
| static void | addError (JSONContext *self, int code, const char *key, const char *description) |
| Records an error on the context. | |
| static bool | consumeBytes (JSONReader *reader, const char *bytes) |
Consumes and validates a fixed byte sequence from reader. | |
| static Data * | dataFromObject (JSONContext *self, const ident obj, int options) |
| static Data * | dataFromStruct (JSONContext *self, const JSONProperties *properties, const ident instance) |
| static Data * | dataFromStructs (JSONContext *self, const JSONProperties *properties, const ident instances, size_t count) |
| static void | dealloc (Object *self) |
| static void | destroy (Class *clazz) |
| static Dictionary * | dictionaryFromStruct (JSONContext *self, const JSONProperties *properties, const ident instance) |
| Serializes a C struct instance to a Dictionary. | |
| static JSONContext * | init (JSONContext *self) |
| static void | initialize (Class *clazz) |
| static ident | objectFromData (JSONContext *self, const Data *data, int options) |
| static Array * | readArray (JSONReader *reader) |
Reads a JSON array from reader. | |
| static Boole * | readBoole (JSONReader *reader) |
Reads a JSON boolean from reader. | |
| static int | readByte (JSONReader *reader) |
| Advances the reader by one byte. | |
| static int | readByteUntil (JSONReader *reader, const char *stop) |
Advances the reader until one of the bytes in stop is found. | |
| static ident | readElement (JSONReader *reader) |
Reads any JSON element from reader. | |
| static String * | readLabel (JSONReader *reader) |
Reads a JSON object key label from reader. | |
| static Null * | readNull (JSONReader *reader) |
Reads a JSON null from reader. | |
| static Number * | readNumber (JSONReader *reader) |
Reads a JSON number from reader. | |
| static Dictionary * | readObject (JSONReader *reader) |
Reads a JSON object (Dictionary) from reader. | |
| static String * | readString (JSONReader *reader) |
Reads a JSON-escaped string from reader. | |
| static bool | structFromData (JSONContext *self, const JSONProperties *properties, const Data *data, ident instance) |
| static bool | structFromDictionary (JSONContext *self, const JSONProperties *properties, const Dictionary *dictionary, ident instance) |
| Deserializes a Dictionary into a C struct. | |
| static size_t | structsFromArray (JSONContext *self, const JSONProperties *properties, const Array *array, ident instances, size_t count) |
| Deserializes a JSON Array into an array of C structs. | |
| static size_t | structsFromData (JSONContext *self, const JSONProperties *properties, const Data *data, ident instances, size_t count) |
| static void | writeArray (JSONWriter *writer, const Array *array) |
Writes a JSON array to writer. | |
| static void | writeBoole (JSONWriter *writer, const Boole *boolean) |
Writes a JSON boolean to writer. | |
| static void | writeElement (JSONWriter *writer, const ident obj) |
Writes any JSON element to writer. | |
| static void | writeLabel (JSONWriter *writer, const String *label) |
Writes a JSON object key label to writer. | |
| static void | writeNull (JSONWriter *writer, const Null *null) |
Writes null to writer. | |
| static void | writeNumber (JSONWriter *writer, const Number *number) |
Writes a JSON number to writer. | |
| static void | writeObject (JSONWriter *writer, const Dictionary *object) |
Writes a JSON object (Dictionary) to writer. | |
| static void | writePretty (JSONWriter *writer) |
Writes pretty-print indentation to writer, if enabled. | |
| static void | writeString (JSONWriter *writer, const String *string) |
Writes a JSON-escaped string to writer. | |
| #define _Class _JSONContext |
Definition at line 40 of file JSONContext.c.
| Class * _JSONContext | ( | void | ) |
Definition at line 821 of file JSONContext.c.
|
static |
Records an error on the context.
| self | The JSONContext; may be NULL (no-op). |
| code | A JSON_ERROR_* code. |
| key | The JSON key associated with the error, or NULL. |
| description | A human-readable description. |
Definition at line 65 of file JSONContext.c.
|
static |
Consumes and validates a fixed byte sequence from reader.
true on success, false if the input did not match. Definition at line 330 of file JSONContext.c.
|
static |
Definition at line 584 of file JSONContext.c.
|
static |
Definition at line 606 of file JSONContext.c.
|
static |
Definition at line 618 of file JSONContext.c.
|
static |
Definition at line 47 of file JSONContext.c.
|
static |
Definition at line 794 of file JSONContext.c.
|
static |
Serializes a C struct instance to a Dictionary.
Definition at line 641 of file JSONContext.c.
|
static |
Definition at line 671 of file JSONContext.c.
|
static |
Definition at line 801 of file JSONContext.c.
|
static |
Definition at line 679 of file JSONContext.c.
|
static |
Reads a JSON array from reader.
Definition at line 531 of file JSONContext.c.
|
static |
Reads a JSON boolean from reader.
Definition at line 434 of file JSONContext.c.
|
static |
Advances the reader by one byte.
Definition at line 293 of file JSONContext.c.
|
static |
Advances the reader until one of the bytes in stop is found.
Definition at line 312 of file JSONContext.c.
|
static |
Reads any JSON element from reader.
Definition at line 556 of file JSONContext.c.
|
static |
Reads a JSON object key label from reader.
Definition at line 474 of file JSONContext.c.
|
static |
Reads a JSON null from reader.
Definition at line 462 of file JSONContext.c.
|
static |
Reads a JSON number from reader.
Definition at line 415 of file JSONContext.c.
|
static |
Reads a JSON object (Dictionary) from reader.
Definition at line 490 of file JSONContext.c.
|
static |
Reads a JSON-escaped string from reader.
Definition at line 346 of file JSONContext.c.
|
static |
Definition at line 757 of file JSONContext.c.
|
static |
Deserializes a Dictionary into a C struct.
Definition at line 704 of file JSONContext.c.
|
static |
Deserializes a JSON Array into an array of C structs.
Definition at line 737 of file JSONContext.c.
|
static |
Definition at line 775 of file JSONContext.c.
|
static |
Writes a JSON array to writer.
Definition at line 231 of file JSONContext.c.
|
static |
Writes a JSON boolean to writer.
Definition at line 113 of file JSONContext.c.
|
static |
Writes any JSON element to writer.
Definition at line 255 of file JSONContext.c.
|
static |
Writes a JSON object key label to writer.
Definition at line 171 of file JSONContext.c.
|
static |
Writes null to writer.
Definition at line 105 of file JSONContext.c.
|
static |
Writes a JSON number to writer.
Definition at line 159 of file JSONContext.c.
|
static |
Writes a JSON object (Dictionary) to writer.
Definition at line 193 of file JSONContext.c.
|
static |
Writes pretty-print indentation to writer, if enabled.
Definition at line 180 of file JSONContext.c.
|
static |
Writes a JSON-escaped string to writer.
Definition at line 125 of file JSONContext.c.