X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=doc%2Fapiref.rst;h=efafd12ebaaa5bcbc88e1a737e8e4f4f5e86d2da;hb=c7079a25eb96ba660f6d9613b0135f5c5933894c;hp=2c57d2eba39ae0309d880ee1291039cdf6713a3d;hpb=54f38d250cf24e7b37cd2d815d63704d77c75a93;p=jansson.git diff --git a/doc/apiref.rst b/doc/apiref.rst index 2c57d2e..efafd12 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: