X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=doc%2Fapiref.rst;h=df20a3a51441835842e1a0eeef8a1ba744cf34ee;hb=7e9c293986de8bcb88dbb4b8dfa155e4d2834ed6;hp=4051b38cf32cfeb991e5d83a53337fa2ae7a17b1;hpb=7fab57dcef5611b2275d9e11f39d887d92a1a7ff;p=jansson.git diff --git a/doc/apiref.rst b/doc/apiref.rst index 4051b38..df20a3a 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -765,6 +765,26 @@ is in UTF-8. *path* already exists, it is overwritten. *flags* is described above. Returns 0 on success and -1 on error. +.. type:: json_dump_callback_t + + A typedef for a function that's called by + :func:`json_dump_callback()`:: + + typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data); + + *buffer* points to a buffer containing a chunk of output, *size* is + the length of the buffer, and *data* is the corresponding + :func:`json_dump_callback()` argument passed through. + + On error, the function should return -1 to stop the encoding + process. On success, it should return 0. + +.. function:: int json_dump_callback(const json_t *json, json_dump_callback_t callback, void *data, size_t flags) + + Call *callback* repeatedly, passing a chunk of the JSON + representation of *root* each time. *flags* is described above. + Returns 0 on success and -1 on error. + .. _apiref-decoding: