diff options
author | Chip Salzenberg <chip@pobox.com> | 2013-09-27 19:10:32 -0700 |
---|---|---|
committer | Chip Salzenberg <chip@pobox.com> | 2013-09-27 19:10:32 -0700 |
commit | 0be5c959daad58cf64d51b8dc56465ed3ad188b1 (patch) | |
tree | f9db219d9c1211962c5baf59cd0d463a6c7ab0a6 | |
parent | face43929d2f1f5f544894611a6bd66fd7139dbf (diff) | |
download | jansson-0be5c959daad58cf64d51b8dc56465ed3ad188b1.zip jansson-0be5c959daad58cf64d51b8dc56465ed3ad188b1.tar.gz jansson-0be5c959daad58cf64d51b8dc56465ed3ad188b1.tar.bz2 |
document new null-friendly functions
-rw-r--r-- | doc/apiref.rst | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/apiref.rst b/doc/apiref.rst index 463966b..ad13481 100644 --- a/doc/apiref.rst +++ b/doc/apiref.rst @@ -304,6 +304,13 @@ U+10FFFF are allowed. Returns a new JSON string, or *NULL* on error. *value* must be a valid UTF-8 encoded Unicode string. +.. function:: json_t *json_stringn(const char *value, size_t len) + + .. refcounting:: new + + Like :func:`json_string`, but with explicit length, so *value* may + contain null characters or not be null terminated. + .. function:: json_t *json_string_nocheck(const char *value) .. refcounting:: new @@ -312,6 +319,13 @@ U+10FFFF are allowed. UTF-8. Use this function only if you are certain that this really is the case (e.g. you have already checked it by other means). +.. function:: json_t *json_stringn_nocheck(const char *value, size_t len) + + .. refcounting:: new + + Like :func:`json_string_nocheck`, but with explicit length, so + *value* may contain null characters or not be null terminated. + .. function:: const char *json_string_value(const json_t *string) Returns the associated value of *string* as a null terminated UTF-8 @@ -321,12 +335,22 @@ U+10FFFF are allowed. the user. It is valid as long as *string* exists, i.e. as long as its reference count has not dropped to zero. +.. function:: size_t json_string_length(const json_t *string) + + Returns the length of *string* as a UTF-8 encoded string, or zero + if *string* is not a JSON string. + .. function:: int json_string_set(const json_t *string, const char *value) Sets the associated value of *string* to *value*. *value* must be a valid UTF-8 encoded Unicode string. Returns 0 on success and -1 on error. +.. function:: int json_string_setn(json_t *string, const char *value, size_t len) + + Like :func:`json_string_set`, but with explicit length, so *value* + may contain null characters or not be null terminated. + .. function:: int json_string_set_nocheck(const json_t *string, const char *value) Like :func:`json_string_set`, but doesn't check that *value* is @@ -334,6 +358,11 @@ U+10FFFF are allowed. really is the case (e.g. you have already checked it by other means). +.. function:: int json_string_setn_nocheck(json_t *string, const char *value, size_t len) + + Like :func:`json_string_set_nocheck`, but with explicit length, + so *value* may contain null characters or not be null terminated. + Number ====== |