From c7079a25eb96ba660f6d9613b0135f5c5933894c Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Thu, 30 Jun 2011 21:45:25 +0300 Subject: [PATCH] doc: Add documentation for json_dump_callback() --- doc/apiref.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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: -- 2.1.4