diff --git a/json-c-0.11/README-WIN32.html b/json-c-0.11/README-WIN32.html new file mode 100644 index 0000000..28fc7d8 --- /dev/null +++ b/json-c-0.11/README-WIN32.html @@ -0,0 +1,50 @@ + + +
+Please send Win32 bug reports to christopher.watford@gmail.com
+Win32 Specific Changes:
+Porting Changelog:
+This program is free software; you can redistribute it and/or modify it under + the terms of the MIT License. See COPYING for details.
+
+ json-c
+ 0.11
+
+ |
+
![]() ![]() | |
![]() ![]() | |
![]() ![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() |
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
struct | array_list |
+Macros | |
#define | ARRAY_LIST_DEFAULT_SIZE 32 |
+Typedefs | |
typedef void( | array_list_free_fn )(void *data) |
+Functions | |
struct array_list * | array_list_new (array_list_free_fn *free_fn) |
void | array_list_free (struct array_list *al) |
void * | array_list_get_idx (struct array_list *al, int i) |
int | array_list_put_idx (struct array_list *al, int i, void *data) |
int | array_list_add (struct array_list *al, void *data) |
int | array_list_length (struct array_list *al) |
void | array_list_sort (struct array_list *arr, int(*compar)(const void *, const void *)) |
#define ARRAY_LIST_DEFAULT_SIZE 32 | +
typedef void( array_list_free_fn)(void *data) | +
int array_list_add | +( | +struct array_list * | +al, | +
+ | + | void * | +data | +
+ | ) | ++ |
void array_list_free | +( | +struct array_list * | +al | ) | ++ |
void* array_list_get_idx | +( | +struct array_list * | +al, | +
+ | + | int | +i | +
+ | ) | ++ |
int array_list_length | +( | +struct array_list * | +al | ) | ++ |
+
|
+ +read | +
int array_list_put_idx | +( | +struct array_list * | +al, | +
+ | + | int | +i, | +
+ | + | void * | +data | +
+ | ) | ++ |
void array_list_sort | +( | +struct array_list * | +arr, | +
+ | + | int(*)(const void *, const void *) | +compar | +
+ | ) | ++ |
+ json-c
+ 0.11
+
+ |
+
+Macros | |
#define | json_min(a, b) ((a) < (b) ? (a) : (b)) |
#define | json_max(a, b) ((a) > (b) ? (a) : (b)) |
#define | hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9) |
#define | error_ptr(error) ((void*)error) |
#define | error_description(error) (json_tokener_errors[error]) |
#define | is_error(ptr) (ptr == NULL) |
#define error_description | +( | ++ | error | ) | +(json_tokener_errors[error]) | +
#define error_ptr | +( | ++ | error | ) | +((void*)error) | +
#define hexdigit | +( | ++ | x | ) | +(((x) <= '9') ? (x) - '0' : ((x) & 7) + 9) | +
#define is_error | +( | ++ | ptr | ) | +(ptr == NULL) | +
#define json_max | +( | ++ | a, | +
+ | + | + | b | +
+ | ) | +((a) > (b) ? (a) : (b)) | +
#define json_min | +( | ++ | a, | +
+ | + | + | b | +
+ | ) | +((a) < (b) ? (a) : (b)) | +
+ json-c
+ 0.11
+
+ |
+
|
| json_object_iterator | lh_table | |||
json_tokener |
| |||||
array_list | json_object | json_tokener_srec | ||||
| json_object_iter |
| printbuf | |||
json_object::data | lh_entry | |||||
+ json-c
+ 0.11
+
+ |
+
+Macros | |
#define | __STRING(x) #x |
#define | JASSERT(cond) do {} while(0) |
#define | MC_ABORT(x,...) mc_abort(x, ##__VA_ARGS__) |
#define | MC_ERROR(x,...) mc_error(x, ##__VA_ARGS__) |
#define | MC_SET_DEBUG(x) if (0) mc_set_debug(x) |
#define | MC_GET_DEBUG() (0) |
#define | MC_SET_SYSLOG(x) if (0) mc_set_syslog(x) |
#define | MC_DEBUG(x,...) if (0) mc_debug(x, ##__VA_ARGS__) |
#define | MC_INFO(x,...) if (0) mc_info(x, ##__VA_ARGS__) |
+Functions | |
void | mc_set_debug (int debug) |
int | mc_get_debug (void) |
void | mc_set_syslog (int syslog) |
void | mc_abort (const char *msg,...) |
void | mc_debug (const char *msg,...) |
void | mc_error (const char *msg,...) |
void | mc_info (const char *msg,...) |
#define __STRING | +( | ++ | x | ) | +#x | +
#define JASSERT | +( | ++ | cond | ) | +do {} while(0) | +
#define MC_ABORT | +( | ++ | x, | +
+ | + | + | ... | +
+ | ) | +mc_abort(x, ##__VA_ARGS__) | +
#define MC_DEBUG | +( | ++ | x, | +
+ | + | + | ... | +
+ | ) | +if (0) mc_debug(x, ##__VA_ARGS__) | +
#define MC_ERROR | +( | ++ | x, | +
+ | + | + | ... | +
+ | ) | +mc_error(x, ##__VA_ARGS__) | +
#define MC_GET_DEBUG | +( | +) | +(0) | +
#define MC_INFO | +( | ++ | x, | +
+ | + | + | ... | +
+ | ) | +if (0) mc_info(x, ##__VA_ARGS__) | +
#define MC_SET_DEBUG | +( | ++ | x | ) | +if (0) mc_set_debug(x) | +
#define MC_SET_SYSLOG | +( | ++ | x | ) | +if (0) mc_set_syslog(x) | +
void mc_abort | +( | +const char * | +msg, | +
+ | + | + | ... | +
+ | ) | ++ |
void mc_debug | +( | +const char * | +msg, | +
+ | + | + | ... | +
+ | ) | ++ |
void mc_error | +( | +const char * | +msg, | +
+ | + | + | ... | +
+ | ) | ++ |
int mc_get_debug | +( | +void | +) | ++ |
void mc_info | +( | +const char * | +msg, | +
+ | + | + | ... | +
+ | ) | ++ |
void mc_set_debug | +( | +int | +debug | ) | ++ |
void mc_set_syslog | +( | +int | +syslog | ) | ++ |
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | Json-c forces clients to use its private data structures for JSON Object iteration. This API corrects that by abstracting the private json-c details |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() | |
![]() ![]() |
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
t |
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+Macros | |
#define | JSON_C_MAJOR_VERSION 0 |
#define | JSON_C_MINOR_VERSION 11 |
#define | JSON_C_MICRO_VERSION 0 |
#define | JSON_C_VERSION_NUM |
#define | JSON_C_VERSION "0.11" |
+Functions | |
const char * | json_c_version (void) |
int | json_c_version_num (void) |
#define JSON_C_MAJOR_VERSION 0 | +
#define JSON_C_MICRO_VERSION 0 | +
#define JSON_C_MINOR_VERSION 11 | +
#define JSON_C_VERSION "0.11" | +
#define JSON_C_VERSION_NUM | +
const char* json_c_version | +( | +void | +) | ++ |
int json_c_version_num | +( | +void | +) | ++ |
+ json-c
+ 0.11
+
+ |
+
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
struct | json_object_iter |
+Macros | |
#define | JSON_OBJECT_DEF_HASH_ENTRIES 16 |
#define | JSON_C_TO_STRING_PLAIN 0 |
#define | JSON_C_TO_STRING_SPACED (1<<0) |
#define | JSON_C_TO_STRING_PRETTY (1<<1) |
#define | JSON_C_TO_STRING_NOZERO (1<<2) |
#define | FALSE ((json_bool)0) |
#define | TRUE ((json_bool)1) |
#define | json_object_object_foreach(obj, key, val) |
#define | json_object_object_foreachC(obj, iter) for(iter.entry = json_object_get_object(obj)->head; (iter.entry ? (iter.key = (char*)iter.entry->k, iter.val = (struct json_object*)iter.entry->v, iter.entry) : 0); iter.entry = iter.entry->next) |
+Typedefs | |
typedef int | json_bool |
typedef struct printbuf | printbuf |
typedef struct lh_table | lh_table |
typedef struct array_list | array_list |
typedef struct json_object | json_object |
typedef struct json_object_iter | json_object_iter |
typedef struct json_tokener | json_tokener |
typedef void( | json_object_delete_fn )(struct json_object *jso, void *userdata) |
typedef int( | json_object_to_json_string_fn )(struct json_object *jso, struct printbuf *pb, int level, int flags) |
typedef enum json_type | json_type |
+Enumerations | |
enum | json_type { + json_type_null, +json_type_boolean, +json_type_double, +json_type_int, + + json_type_object, +json_type_array, +json_type_string + + } |
+Variables | |
const char * | json_number_chars |
const char * | json_hex_chars |
#define FALSE ((json_bool)0) | +
#define JSON_C_TO_STRING_NOZERO (1<<2) | +
A flag to drop trailing zero for float values
+ +#define JSON_C_TO_STRING_PLAIN 0 | +
A flag for the json_object_to_json_string_ext() and json_object_to_file_ext() functions which causes the output to have no extra whitespace or formatting applied.
+ +#define JSON_C_TO_STRING_PRETTY (1<<1) | +
A flag for the json_object_to_json_string_ext() and json_object_to_file_ext() functions which causes the output to be formatted.
+See the "Two Space Tab" option at http://jsonformatter.curiousconcept.com/ for an example of the format.
+ +#define JSON_C_TO_STRING_SPACED (1<<0) | +
A flag for the json_object_to_json_string_ext() and json_object_to_file_ext() functions which causes the output to have minimal whitespace inserted to make things slightly more readable.
+ +#define JSON_OBJECT_DEF_HASH_ENTRIES 16 | +
#define json_object_object_foreach | +( | ++ | obj, | +
+ | + | + | key, | +
+ | + | + | val | +
+ | ) | ++ |
Iterate through all keys and values of an object.
+Adding keys to the object while iterating is NOT allowed.
+Deleting an existing key, or replacing an existing key with a new value IS allowed.
+obj | the json_object instance |
key | the local name for the char* key variable defined in the body |
val | the local name for the json_object* object variable defined in the body |
#define json_object_object_foreachC | +( | ++ | obj, | +
+ | + | + | iter | +
+ | ) | +for(iter.entry = json_object_get_object(obj)->head; (iter.entry ? (iter.key = (char*)iter.entry->k, iter.val = (struct json_object*)iter.entry->v, iter.entry) : 0); iter.entry = iter.entry->next) | +
Iterate through all keys and values of an object (ANSI C Safe)
+obj | the json_object instance |
iter | the object iterator |
#define TRUE ((json_bool)1) | +
typedef struct array_list array_list | +
typedef int json_bool | +
typedef struct json_object json_object | +
typedef void( json_object_delete_fn)(struct json_object *jso, void *userdata) | +
Type of custom user delete functions. See json_object_set_serializer.
+ +typedef struct json_object_iter json_object_iter | +
typedef int( json_object_to_json_string_fn)(struct json_object *jso, struct printbuf *pb, int level, int flags) | +
Type of a custom serialization function. See json_object_set_serializer.
+ +typedef struct json_tokener json_tokener | +
enum json_type | +
int json_object_array_add | +( | +struct json_object * | +obj, | +
+ | + | struct json_object * | +val | +
+ | ) | ++ |
Add an element to the end of a json_object of type json_type_array
+The reference count will not be incremented. This is to make adding fields to objects in code more compact. If you want to retain a reference to an added object you must wrap the passed object with json_object_get
+obj | the json_object instance |
val | the json_object to be added |
+
|
+ +read | +
Get the element at specificed index of the array (a json_object of type json_type_array)
+obj | the json_object instance |
idx | the index to get the element at |
int json_object_array_length | +( | +struct json_object * | +obj | ) | ++ |
Get the length of a json_object of type json_type_array
+obj | the json_object instance |
int json_object_array_put_idx | +( | +struct json_object * | +obj, | +
+ | + | int | +idx, | +
+ | + | struct json_object * | +val | +
+ | ) | ++ |
Insert or replace an element at a specified index in an array (a json_object of type json_type_array)
+The reference count will not be incremented. This is to make adding fields to objects in code more compact. If you want to retain a reference to an added object you must wrap the passed object with json_object_get
+The reference count of a replaced object will be decremented.
+The array size will be automatically be expanded to the size of the index if the index is larger than the current size.
+obj | the json_object instance |
idx | the index to insert the element at |
val | the json_object to be added |
void json_object_array_sort | +( | +struct json_object * | +jso, | +
+ | + | int(*)(const void *, const void *) | +sort_fn | +
+ | ) | ++ |
Sorts the elements of jso of type json_type_array
+Pointers to the json_object pointers will be passed as the two arguments to
+obj | the json_object instance |
sort_fn | a sorting function |
+
|
+ +read | +
Increment the reference count of json_object, thereby grabbing shared ownership of obj.
+obj | the json_object instance |
+
|
+ +read | +
Get the arraylist of a json_object of type json_type_array
+obj | the json_object instance |
json_bool json_object_get_boolean | +( | +struct json_object * | +obj | ) | ++ |
Get the json_bool value of a json_object
+The type is coerced to a json_bool if the passed object is not a json_bool. integer and double objects will return FALSE if there value is zero or TRUE otherwise. If the passed object is a string it will return TRUE if it has a non zero length. If any other object type is passed TRUE will be returned if the object is not NULL.
+obj | the json_object instance |
double json_object_get_double | +( | +struct json_object * | +obj | ) | ++ |
Get the double floating point value of a json_object
+The type is coerced to a double if the passed object is not a double. integer objects will return their double conversion. Strings will be parsed as a double. If no conversion exists then 0.0 is returned and errno is set to EINVAL. null is equivalent to 0 (no error values set)
+If the value is too big to fit in a double, then the value is set to the closest infinity with errno set to ERANGE. If strings cannot be converted to their double value, then EINVAL is set & NaN is returned.
+Arrays of length 0 are interpreted as 0 (with no error flags set). Arrays of length 1 are effectively cast to the equivalent object and converted using the above rules. All other arrays set the error to EINVAL & return NaN.
+NOTE: Set errno to 0 directly before a call to this function to determine whether or not conversion was successful (it does not clear the value for you).
+obj | the json_object instance |
int32_t json_object_get_int | +( | +struct json_object * | +obj | ) | ++ |
Get the int value of a json_object
+The type is coerced to a int if the passed object is not a int. double objects will return their integer conversion. Strings will be parsed as an integer. If no conversion exists then 0 is returned and errno is set to EINVAL. null is equivalent to 0 (no error values set)
+Note that integers are stored internally as 64-bit values. If the value of too big or too small to fit into 32-bit, INT32_MAX or INT32_MIN are returned, respectively.
+obj | the json_object instance |
int64_t json_object_get_int64 | +( | +struct json_object * | +obj | ) | ++ |
Get the int value of a json_object
+The type is coerced to a int64 if the passed object is not a int64. double objects will return their int64 conversion. Strings will be parsed as an int64. If no conversion exists then 0 is returned.
+NOTE: Set errno to 0 directly before a call to this function to determine whether or not conversion was successful (it does not clear the value for you).
+obj | the json_object instance |
+
|
+ +read | +
Get the hashtable of a json_object of type json_type_object
+obj | the json_object instance |
const char* json_object_get_string | +( | +struct json_object * | +obj | ) | ++ |
Get the string value of a json_object
+If the passed object is not of type json_type_string then the JSON representation of the object is returned.
+The returned string memory is managed by the json_object and will be freed when the reference count of the json_object drops to zero.
+obj | the json_object instance |
int json_object_get_string_len | +( | +struct json_object * | +obj | ) | ++ |
Get the string length of a json_object
+If the passed object is not of type json_type_string then zero will be returned.
+obj | the json_object instance |
enum json_type json_object_get_type | +( | +struct json_object * | +obj | ) | ++ |
Get the type of the json_object. See also json_type_to_name() to turn this into a string suitable, for instance, for logging.
+obj | the json_object instance |
int json_object_is_type | +( | +struct json_object * | +obj, | +
+ | + | enum json_type | +type | +
+ | ) | ++ |
Check if the json_object is of a given type
+obj | the json_object instance |
type | one of: json_type_null (i.e. obj == NULL), json_type_boolean, json_type_double, json_type_int, json_type_object, json_type_array, json_type_string, |
+
|
+ +read | +
Create a new empty json_object of type json_type_array
+
+
|
+ +read | +
Create a new empty json_object of type json_type_boolean
+b | a json_bool TRUE or FALSE (0 or 1) |
+
|
+ +read | +
Create a new empty json_object of type json_type_double
+d | the double |
+
|
+ +read | +
Create a new empty json_object of type json_type_int Note that values are stored as 64-bit values internally. To ensure the full range is maintained, use json_object_new_int64 instead.
+i | the integer |
+
|
+ +read | +
Create a new empty json_object of type json_type_int
+i | the integer |
+
|
+ +read | +
Create a new empty object with a reference count of 1. The caller of this object initially has sole ownership. Remember, when using json_object_object_add or json_object_array_put_idx, ownership will transfer to the object/array. Call json_object_get if you want to maintain shared ownership or also add this object as a child of multiple objects or arrays. Any ownerships you acquired but did not transfer must be released through json_object_put.
+
+
|
+ +read | +
Create a new empty json_object of type json_type_string
+A copy of the string is made and the memory is managed by the json_object
+s | the string |
+
|
+ +read | +
void json_object_object_add | +( | +struct json_object * | +obj, | +
+ | + | const char * | +key, | +
+ | + | struct json_object * | +val | +
+ | ) | ++ |
Add an object field to a json_object of type json_type_object
+The reference count will not be incremented. This is to make adding fields to objects in code more compact. If you want to retain a reference to an added object, independent of the lifetime of obj, you must wrap the passed object with json_object_get.
+Upon calling this, the ownership of val transfers to obj. Thus you must make sure that you do in fact have ownership over this object. For instance, json_object_new_object will give you ownership until you transfer it, whereas json_object_object_get does not.
+obj | the json_object instance |
key | the object field name (a private copy will be duplicated) |
val | a json_object or NULL member to associate with the given field |
void json_object_object_del | +( | +struct json_object * | +obj, | +
+ | + | const char * | +key | +
+ | ) | ++ |
Delete the given json_object field
+The reference count will be decremented for the deleted object. If there are no more owners of the value represented by this key, then the value is freed. Otherwise, the reference to the value will remain in memory.
+obj | the json_object instance |
key | the object field name |
+
|
+ +read | +
Get the json_object associate with a given object field
+No reference counts will be changed. There is no need to manually adjust reference counts through the json_object_put/json_object_get methods unless you need to have the child (value) reference maintain a different lifetime than the owning parent (obj). Ownership of the returned value is retained by obj (do not do json_object_put unless you have done a json_object_get). If you delete the value from obj (json_object_object_del) and wish to access the returned reference afterwards, make sure you have first gotten shared ownership through json_object_get (& don't forget to do a json_object_put or transfer ownership to prevent a memory leak).
+obj | the json_object instance |
key | the object field name |
json_bool json_object_object_get_ex | +( | +struct json_object * | +obj, | +
+ | + | const char * | +key, | +
+ | + | struct json_object ** | +value | +
+ | ) | ++ |
Get the json_object associated with a given object field.
+This returns true if the key is found, false in all other cases (including if obj isn't a json_type_object).
+No reference counts will be changed. There is no need to manually adjust reference counts through the json_object_put/json_object_get methods unless you need to have the child (value) reference maintain a different lifetime than the owning parent (obj). Ownership of value is retained by obj.
+obj | the json_object instance |
key | the object field name |
value | a pointer where to store a reference to the json_object associated with the given field name. |
It is safe to pass a NULL value.
+int json_object_object_length | +( | +struct json_object * | +obj | ) | ++ |
Get the size of an object in terms of the number of fields it has.
+obj | the json_object whose length to return |
int json_object_put | +( | +struct json_object * | +obj | ) | ++ |
Decrement the reference count of json_object and free if it reaches zero. You must have ownership of obj prior to doing this or you will cause an imbalance in the reference count.
+obj | the json_object instance |
void json_object_set_serializer | +( | +json_object * | +jso, | +
+ | + | json_object_to_json_string_fn | +to_string_func, | +
+ | + | void * | +userdata, | +
+ | + | json_object_delete_fn * | +user_delete | +
+ | ) | ++ |
Set a custom serialization function to be used when this particular object is converted to a string by json_object_to_json_string.
+If a custom serializer is already set on this object, any existing user_delete function is called before the new one is set.
+If to_string_func is NULL, the other parameters are ignored and the default behaviour is reset.
+The userdata parameter is optional and may be passed as NULL. If provided, it is passed to to_string_func as-is. This parameter may be NULL even if user_delete is non-NULL.
+The user_delete parameter is optional and may be passed as NULL, even if the userdata parameter is non-NULL. It will be called just before the json_object is deleted, after it's reference count goes to zero (see json_object_put()). If this is not provided, it is up to the caller to free the userdata at an appropriate time. (i.e. after the json_object is deleted)
+jso | the object to customize |
to_string_func | the custom serialization function |
userdata | an optional opaque cookie |
user_delete | an optional function from freeing userdata |
const char* json_object_to_json_string | +( | +struct json_object * | +obj | ) | ++ |
Stringify object to json format. Equivalent to json_object_to_json_string_ext(obj, JSON_C_TO_STRING_SPACED)
+obj | the json_object instance |
const char* json_object_to_json_string_ext | +( | +struct json_object * | +obj, | +
+ | + | int | +flags | +
+ | ) | ++ |
Stringify object to json format
+obj | the json_object instance |
flags | formatting options, see JSON_C_TO_STRING_PRETTY and other constants |
const char* json_hex_chars | +
const char* json_number_chars | +
+ json-c
+ 0.11
+
+ |
+
json-c forces clients to use its private data structures for JSON Object iteration. This API corrects that by abstracting the private json-c details. +More...
++Data Structures | |
struct | json_object_iterator |
+Functions | |
struct json_object_iterator | json_object_iter_init_default (void) |
struct json_object_iterator | json_object_iter_begin (struct json_object *obj) |
struct json_object_iterator | json_object_iter_end (const struct json_object *obj) |
void | json_object_iter_next (struct json_object_iterator *iter) |
const char * | json_object_iter_peek_name (const struct json_object_iterator *iter) |
struct json_object * | json_object_iter_peek_value (const struct json_object_iterator *iter) |
json_bool | json_object_iter_equal (const struct json_object_iterator *iter1, const struct json_object_iterator *iter2) |
json-c forces clients to use its private data structures for JSON Object iteration. This API corrects that by abstracting the private json-c details.
+Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
+This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See COPYING for details.
+API attributes:
+
+
|
+ +read | +
Retrieves an iterator to the first pair of the JSON Object.
+obj | JSON Object instance (MUST be of type json_object) |
+
|
+ +read | +
Retrieves the iterator that represents the position beyond the last pair of the given JSON Object instance.
+obj | JSON Object instance (MUST be of type json_object) |
json_bool json_object_iter_equal | +( | +const struct json_object_iterator * | +iter1, | +
+ | + | const struct json_object_iterator * | +iter2 | +
+ | ) | ++ |
Tests two iterators for equality. Typically used to test for end of iteration by comparing an iterator to the corresponding "end" iterator (that was derived from the same JSON Object instance).
+iter1 | Pointer to first valid, non-NULL iterator |
iter2 | POinter to second valid, non-NULL iterator |
+
|
+ +read | +
Initializes an iterator structure to a "default" value that is convenient for initializing an iterator variable to a default state (e.g., initialization list in a class' constructor).
+void json_object_iter_next | +( | +struct json_object_iterator * | +iter | ) | ++ |
Returns an iterator to the next pair, if any
+iter | [IN/OUT] Pointer to iterator that references a name/value pair; MUST be a valid, non-end iterator. WARNING: bad things will happen if invalid or "end" iterator is passed. Upon return will contain the reference to the next pair if there is one; if there are no more pairs, will contain the "end" iterator value, which may be compared against the return value of json_object_iter_end() for the same JSON Object instance. |
const char* json_object_iter_peek_name | +( | +const struct json_object_iterator * | +iter | ) | ++ |
Returns a const pointer to the name of the pair referenced by the given iterator.
+iter | pointer to iterator that references a name/value pair; MUST be a valid, non-end iterator. |
+
|
+ +read | +
Returns a pointer to the json-c instance representing the value of the referenced name/value pair, without altering the instance's reference count.
+iter | pointer to iterator that references a name/value pair; MUST be a valid, non-end iterator. |
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
struct | json_object |
union | json_object::data |
+Typedefs | |
typedef void( | json_object_private_delete_fn )(struct json_object *o) |
typedef void( json_object_private_delete_fn)(struct json_object *o) | +
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
struct | json_tokener_srec |
struct | json_tokener |
+Macros | |
#define | JSON_TOKENER_DEFAULT_DEPTH 32 |
#define | JSON_TOKENER_STRICT 0x01 |
+Functions | |
const char * | json_tokener_error_desc (enum json_tokener_error jerr) |
enum json_tokener_error | json_tokener_get_error (struct json_tokener *tok) |
struct json_tokener * | json_tokener_new (void) |
struct json_tokener * | json_tokener_new_ex (int depth) |
void | json_tokener_free (struct json_tokener *tok) |
void | json_tokener_reset (struct json_tokener *tok) |
struct json_object * | json_tokener_parse (const char *str) |
struct json_object * | json_tokener_parse_verbose (const char *str, enum json_tokener_error *error) |
void | json_tokener_set_flags (struct json_tokener *tok, int flags) |
struct json_object * | json_tokener_parse_ex (struct json_tokener *tok, const char *str, int len) |
+Variables | |
const char * | json_tokener_errors [] |
#define JSON_TOKENER_DEFAULT_DEPTH 32 | +
#define JSON_TOKENER_STRICT 0x01 | +
Be strict when parsing JSON input. Use caution with this flag as what is considered valid may become more restrictive from one release to the next, causing your code to fail on previously working input.
+This flag is not set by default.
+enum json_tokener_error | +
enum json_tokener_state | +
const char* json_tokener_error_desc | +( | +enum json_tokener_error | +jerr | ) | ++ |
Given an error previously returned by json_tokener_get_error(), return a human readable description of the error.
+void json_tokener_free | +( | +struct json_tokener * | +tok | ) | ++ |
enum json_tokener_error json_tokener_get_error | +( | +struct json_tokener * | +tok | ) | ++ |
Retrieve the error caused by the last call to json_tokener_parse_ex(), or json_tokener_success if there is no error.
+When parsing a JSON string in pieces, if the tokener is in the middle of parsing this will return json_tokener_continue.
+See also json_tokener_error_desc().
+ +
+
|
+ +read | +
+
|
+ +read | +
+
|
+ +read | +
+
|
+ +read | +
Parse a string and return a non-NULL json_object if a valid JSON value is found. The string does not need to be a JSON object or array; it can also be a string, number or boolean value.
+A partial JSON string can be parsed. If the parsing is incomplete, NULL will be returned and json_tokener_get_error() will be return json_tokener_continue. json_tokener_parse_ex() can then be called with additional bytes in str to continue the parsing.
+If json_tokener_parse_ex() returns NULL and the error anything other than json_tokener_continue, a fatal error has occurred and parsing must be halted. Then tok object must not be re-used until json_tokener_reset() is called.
+When a valid JSON value is parsed, a non-NULL json_object will be returned. Also, json_tokener_get_error() will return json_tokener_success. Be sure to check the type with json_object_is_type() or json_object_get_type() before using the object.
+XXX this shouldn't use internal fields: Trailing characters after the parsed value do not automatically cause an error. It is up to the caller to decide whether to treat this as an error or to handle the additional characters, perhaps by parsing another json value starting from that point.
+Extra characters can be detected by comparing the tok->char_offset against the length of the last len parameter passed in.
+The tokener does not maintain an internal buffer so the caller is responsible for calling json_tokener_parse_ex with an appropriate str parameter starting with the extra characters.
+Example:
+tok | a json_tokener previously allocated with json_tokener_new() |
str | an string with any valid JSON expression, or portion of. This does not need to be null terminated. |
len | the length of str |
+
|
+ +read | +
void json_tokener_reset | +( | +struct json_tokener * | +tok | ) | ++ |
void json_tokener_set_flags | +( | +struct json_tokener * | +tok, | +
+ | + | int | +flags | +
+ | ) | ++ |
Set flags that control how parsing will be done.
+ +const char* json_tokener_errors[] | +
XXX do not use json_tokener_errors directly. After v0.10 this will be removed.
+See json_tokener_error_desc() instead.
+ +
+ json-c
+ 0.11
+
+ |
+
+Macros | |
#define | JSON_FILE_BUF_SIZE 4096 |
+Functions | |
struct json_object * | json_object_from_file (const char *filename) |
int | json_object_to_file (char *filename, struct json_object *obj) |
int | json_object_to_file_ext (char *filename, struct json_object *obj, int flags) |
int | json_parse_int64 (const char *buf, int64_t *retval) |
int | json_parse_double (const char *buf, double *retval) |
const char * | json_type_to_name (enum json_type o_type) |
#define JSON_FILE_BUF_SIZE 4096 | +
+
|
+ +read | +
int json_object_to_file | +( | +char * | +filename, | +
+ | + | struct json_object * | +obj | +
+ | ) | ++ |
int json_object_to_file_ext | +( | +char * | +filename, | +
+ | + | struct json_object * | +obj, | +
+ | + | int | +flags | +
+ | ) | ++ |
int json_parse_double | +( | +const char * | +buf, | +
+ | + | double * | +retval | +
+ | ) | ++ |
int json_parse_int64 | +( | +const char * | +buf, | +
+ | + | int64_t * | +retval | +
+ | ) | ++ |
const char* json_type_to_name | +( | +enum json_type | +o_type | ) | ++ |
Return a string describing the type of the object. e.g. "int", or "object", etc...
+ +
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
struct | lh_entry |
struct | lh_table |
+Macros | |
#define | LH_PRIME 0x9e370001UL |
#define | LH_LOAD_FACTOR 0.66 |
#define | LH_EMPTY (void*)-1 |
#define | LH_FREED (void*)-2 |
#define | lh_foreach(table, entry) for(entry = table->head; entry; entry = entry->next) |
#define | lh_foreach_safe(table, entry, tmp) for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp) |
+Typedefs | |
typedef void( | lh_entry_free_fn )(struct lh_entry *e) |
typedef unsigned long( | lh_hash_fn )(const void *k) |
typedef int( | lh_equal_fn )(const void *k1, const void *k2) |
+Functions | |
unsigned long | lh_ptr_hash (const void *k) |
int | lh_ptr_equal (const void *k1, const void *k2) |
unsigned long | lh_char_hash (const void *k) |
int | lh_char_equal (const void *k1, const void *k2) |
struct lh_table * | lh_table_new (int size, const char *name, lh_entry_free_fn *free_fn, lh_hash_fn *hash_fn, lh_equal_fn *equal_fn) |
struct lh_table * | lh_kchar_table_new (int size, const char *name, lh_entry_free_fn *free_fn) |
struct lh_table * | lh_kptr_table_new (int size, const char *name, lh_entry_free_fn *free_fn) |
void | lh_table_free (struct lh_table *t) |
int | lh_table_insert (struct lh_table *t, void *k, const void *v) |
struct lh_entry * | lh_table_lookup_entry (struct lh_table *t, const void *k) |
const void * | lh_table_lookup (struct lh_table *t, const void *k) |
json_bool | lh_table_lookup_ex (struct lh_table *t, const void *k, void **v) |
int | lh_table_delete_entry (struct lh_table *t, struct lh_entry *e) |
int | lh_table_delete (struct lh_table *t, const void *k) |
int | lh_table_length (struct lh_table *t) |
void | lh_abort (const char *msg,...) |
void | lh_table_resize (struct lh_table *t, int new_size) |
#define LH_EMPTY (void*)-1 | +
sentinel pointer value for empty slots
+ +#define lh_foreach | +( | ++ | table, | +
+ | + | + | entry | +
+ | ) | +for(entry = table->head; entry; entry = entry->next) | +
Convenience list iterator.
+ +#define lh_foreach_safe | +( | ++ | table, | +
+ | + | + | entry, | +
+ | + | + | tmp | +
+ | ) | +for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp) | +
lh_foreach_safe allows calling of deletion routine while iterating.
+ +#define LH_FREED (void*)-2 | +
sentinel pointer value for freed slots
+ +#define LH_LOAD_FACTOR 0.66 | +
The fraction of filled hash buckets until an insert will cause the table to be resized. This can range from just above 0 up to 1.0.
+ +#define LH_PRIME 0x9e370001UL | +
golden prime used in hash functions
+ +typedef void( lh_entry_free_fn)(struct lh_entry *e) | +
callback function prototypes
+ +typedef int( lh_equal_fn)(const void *k1, const void *k2) | +
callback function prototypes
+ +typedef unsigned long( lh_hash_fn)(const void *k) | +
callback function prototypes
+ +void lh_abort | +( | +const char * | +msg, | +
+ | + | + | ... | +
+ | ) | ++ |
int lh_char_equal | +( | +const void * | +k1, | +
+ | + | const void * | +k2 | +
+ | ) | ++ |
unsigned long lh_char_hash | +( | +const void * | +k | ) | ++ |
+
|
+ +read | +
Convenience function to create a new linkhash table with char keys.
+size | initial table size. |
name | table name. |
free_fn | callback function used to free memory for entries. |
+
|
+ +read | +
Convenience function to create a new linkhash table with ptr keys.
+size | initial table size. |
name | table name. |
free_fn | callback function used to free memory for entries. |
int lh_ptr_equal | +( | +const void * | +k1, | +
+ | + | const void * | +k2 | +
+ | ) | ++ |
unsigned long lh_ptr_hash | +( | +const void * | +k | ) | ++ |
Pre-defined hash and equality functions
+ +int lh_table_delete | +( | +struct lh_table * | +t, | +
+ | + | const void * | +k | +
+ | ) | ++ |
Delete a record from the table. If a callback free function is provided then it is called for the for the item being deleted.
+t | the table to delete from. |
k | a pointer to the key to delete. |
int lh_table_delete_entry | +( | +struct lh_table * | +t, | +
+ | + | struct lh_entry * | +e | +
+ | ) | ++ |
Delete a record from the table. If a callback free function is provided then it is called for the for the item being deleted.
+t | the table to delete from. |
e | a pointer to the entry to delete. |
void lh_table_free | +( | +struct lh_table * | +t | ) | ++ |
Free a linkhash table. If a callback free function is provided then it is called for all entries in the table.
+t | table to free. |
int lh_table_insert | +( | +struct lh_table * | +t, | +
+ | + | void * | +k, | +
+ | + | const void * | +v | +
+ | ) | ++ |
Insert a record into the table.
+t | the table to insert into. |
k | a pointer to the key to insert. |
v | a pointer to the value to insert. |
int lh_table_length | +( | +struct lh_table * | +t | ) | ++ |
const void* lh_table_lookup | +( | +struct lh_table * | +t, | +
+ | + | const void * | +k | +
+ | ) | ++ |
Lookup a record into the table
+t | the table to lookup |
k | a pointer to the key to lookup |
+
|
+ +read | +
Lookup a record into the table.
+t | the table to lookup |
k | a pointer to the key to lookup |
json_bool lh_table_lookup_ex | +( | +struct lh_table * | +t, | +
+ | + | const void * | +k, | +
+ | + | void ** | +v | +
+ | ) | ++ |
Lookup a record in the table
+t | the table to lookup |
k | a pointer to the key to lookup |
v | a pointer to a where to store the found value (set to NULL if it doesn't exist). |
+
|
+ +read | +
Create a new linkhash table.
+size | initial table size. The table is automatically resized although this incurs a performance penalty. |
name | the table name. |
free_fn | callback function used to free memory for entries when lh_table_free or lh_table_delete is called. If NULL is provided, then memory for keys and values must be freed by the caller. |
hash_fn | function used to hash keys. 2 standard ones are defined: lh_ptr_hash and lh_char_hash for hashing pointer values and C strings respectively. |
equal_fn | comparison function to compare keys. 2 standard ones defined: lh_ptr_hash and lh_char_hash for comparing pointer values and C strings respectively. |
void lh_table_resize | +( | +struct lh_table * | +t, | +
+ | + | int | +new_size | +
+ | ) | ++ |
+ json-c
+ 0.11
+
+ |
+
![]() |
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
struct | printbuf |
+Macros | |
#define | printbuf_memappend_fast(p, bufptr, bufsize) |
#define | printbuf_length(p) ((p)->bpos) |
+Functions | |
struct printbuf * | printbuf_new (void) |
int | printbuf_memappend (struct printbuf *p, const char *buf, int size) |
int | printbuf_memset (struct printbuf *pb, int offset, int charvalue, int len) |
int | sprintbuf (struct printbuf *p, const char *msg,...) |
void | printbuf_reset (struct printbuf *p) |
void | printbuf_free (struct printbuf *p) |
#define printbuf_length | +( | ++ | p | ) | +((p)->bpos) | +
#define printbuf_memappend_fast | +( | ++ | p, | +
+ | + | + | bufptr, | +
+ | + | + | bufsize | +
+ | ) | ++ |
void printbuf_free | +( | +struct printbuf * | +p | ) | ++ |
int printbuf_memappend | +( | +struct printbuf * | +p, | +
+ | + | const char * | +buf, | +
+ | + | int | +size | +
+ | ) | ++ |
int printbuf_memset | +( | +struct printbuf * | +pb, | +
+ | + | int | +offset, | +
+ | + | int | +charvalue, | +
+ | + | int | +len | +
+ | ) | ++ |
Set len bytes of the buffer to charvalue, starting at offset offset. Similar to calling memset(x, charvalue, len);
+The memory allocated for the buffer is extended as necessary.
+If offset is -1, this starts at the end of the current data in the buffer.
+ +
+
|
+ +read | +
void printbuf_reset | +( | +struct printbuf * | +p | ) | ++ |
int sprintbuf | +( | +struct printbuf * | +p, | +
+ | + | const char * | +msg, | +
+ | + | + | ... | +
+ | ) | ++ |
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
void ** | array |
int | length |
int | size |
array_list_free_fn * | free_fn |
void** array_list::array | +
array_list_free_fn* array_list::free_fn | +
int array_list::length | +
int array_list::size | +
+ json-c
+ 0.11
+
+ |
+
+Data Structures | |
union | data |
+Data Fields | |
enum json_type | o_type |
json_object_private_delete_fn * | _delete |
json_object_to_json_string_fn * | _to_json_string |
int | _ref_count |
struct printbuf * | _pb |
union json_object::data | o |
json_object_delete_fn * | _user_delete |
void * | _userdata |
json_object_private_delete_fn* json_object::_delete | +
struct printbuf* json_object::_pb | +
int json_object::_ref_count | +
json_object_to_json_string_fn* json_object::_to_json_string | +
json_object_delete_fn* json_object::_user_delete | +
void* json_object::_userdata | +
union json_object::data json_object::o | +
enum json_type json_object::o_type | +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
char * | key |
struct json_object * | val |
struct lh_entry * | entry |
struct lh_entry* json_object_iter::entry | +
char* json_object_iter::key | +
struct json_object* json_object_iter::val | +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
const void * | opaque_ |
The opaque iterator that references a name/value pair within a JSON Object instance or the "end" iterator value.
+const void* json_object_iterator::opaque_ | +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
char * | str |
struct printbuf * | pb |
int | max_depth |
int | depth |
int | is_double |
int | st_pos |
int | char_offset |
enum json_tokener_error | err |
unsigned int | ucs_char |
char | quote_char |
struct json_tokener_srec * | stack |
int | flags |
int json_tokener::char_offset | +
int json_tokener::depth | +
enum json_tokener_error json_tokener::err | +
int json_tokener::flags | +
int json_tokener::is_double | +
int json_tokener::max_depth | +
struct printbuf* json_tokener::pb | +
char json_tokener::quote_char | +
int json_tokener::st_pos | +
struct json_tokener_srec* json_tokener::stack | +
char* json_tokener::str | +
unsigned int json_tokener::ucs_char | +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
enum json_tokener_state state | saved_state |
struct json_object * | obj |
struct json_object * | current |
char * | obj_field_name |
struct json_object* json_tokener_srec::current | +
struct json_object* json_tokener_srec::obj | +
char* json_tokener_srec::obj_field_name | +
enum json_tokener_state state json_tokener_srec::saved_state | +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
void * | k |
const void * | v |
struct lh_entry * | next |
struct lh_entry * | prev |
An entry in the hash table
+void* lh_entry::k | +
The key.
+ +struct lh_entry* lh_entry::next | +
The next entry
+ +struct lh_entry* lh_entry::prev | +
The previous entry.
+ +const void* lh_entry::v | +
The value.
+ +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
int | size |
int | count |
int | collisions |
int | resizes |
int | lookups |
int | inserts |
int | deletes |
const char * | name |
struct lh_entry * | head |
struct lh_entry * | tail |
struct lh_entry * | table |
lh_entry_free_fn * | free_fn |
lh_hash_fn * | hash_fn |
lh_equal_fn * | equal_fn |
The hash table structure.
+int lh_table::collisions | +
Number of collisions.
+ +int lh_table::count | +
Numbers of entries.
+ +int lh_table::deletes | +
Number of deletes.
+ +lh_equal_fn* lh_table::equal_fn | +
lh_entry_free_fn* lh_table::free_fn | +
A pointer onto the function responsible for freeing an entry.
+ +lh_hash_fn* lh_table::hash_fn | +
struct lh_entry* lh_table::head | +
The first entry.
+ +int lh_table::inserts | +
Number of inserts.
+ +int lh_table::lookups | +
Number of lookups.
+ +const char* lh_table::name | +
Name of the hash table.
+ +int lh_table::resizes | +
Number of resizes.
+ +int lh_table::size | +
Size of our hash.
+ +struct lh_entry* lh_table::table | +
struct lh_entry* lh_table::tail | +
The last entry.
+ +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
char * | buf |
int | bpos |
int | size |
int printbuf::bpos | +
char* printbuf::buf | +
int printbuf::size | +
+ json-c
+ 0.11
+
+ |
+
+Data Fields | |
json_bool | c_boolean |
double | c_double |
int64_t | c_int64 |
struct lh_table * | c_object |
struct array_list * | c_array |
struct { | |
char * str | |
int len | |
} | c_string |
struct array_list* json_object::data::c_array | +
json_bool json_object::data::c_boolean | +
double json_object::data::c_double | +
int64_t json_object::data::c_int64 | +
struct lh_table* json_object::data::c_object | +
struct { ... } json_object::data::c_string | +
int json_object::data::len | +
char* json_object::data::str | +