More work on c api
This commit is contained in:
@@ -9,11 +9,15 @@ struct WeaselJsonCallbacks {
|
||||
void (*on_begin_object)(void *data);
|
||||
void (*on_end_object)(void *data);
|
||||
void (*on_begin_string)(void *data);
|
||||
/** May be called multiple times per string if not all string data is
|
||||
* available yet. The string data provided is unescaped. */
|
||||
void (*on_string_data)(void *data, const char *buf, int len);
|
||||
void (*on_end_string)(void *data);
|
||||
void (*on_begin_array)(void *data);
|
||||
void (*on_end_array)(void *data);
|
||||
void (*on_begin_number)(void *data);
|
||||
/** May be called multiple times per number if not all number data is
|
||||
* available yet */
|
||||
void (*on_number_data)(void *data, const char *buf, int len);
|
||||
void (*on_end_number)(void *data);
|
||||
void (*on_true_literal)(void *data);
|
||||
@@ -35,9 +39,12 @@ enum WeaselJsonStatus {
|
||||
|
||||
typedef struct WeaselJsonParser WeaselJsonParser;
|
||||
|
||||
/** Increasing stack size increases memory usage but also increases the depth of
|
||||
* nested json accepted. */
|
||||
WeaselJsonParser *WeaselJsonParser_create(int stackSize);
|
||||
/** Create a parser. Increasing stack size increases memory usage but also
|
||||
* increases the depth of nested json accepted. `callbacks` and `data` must
|
||||
* outlive the returned parser. */
|
||||
WeaselJsonParser *WeaselJsonParser_create(int stackSize,
|
||||
const WeaselJsonCallbacks *callbacks,
|
||||
void *data);
|
||||
|
||||
/** Restore the parser to its newly-created state */
|
||||
void WeaselJsonParser_reset(WeaselJsonParser *parser);
|
||||
|
||||
Reference in New Issue
Block a user