MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Functions

struct json_objectjson_object_new_array (void)
 
struct array_listjson_object_get_array (struct json_object *obj)
 
int json_object_array_length (struct json_object *obj)
 
void json_object_array_sort (struct json_object *jso, int(*sort_fn)(const void *, const void *))
 
int json_object_array_add (struct json_object *obj, struct json_object *val)
 
int json_object_array_put_idx (struct json_object *obj, int idx, struct json_object *val)
 
struct json_objectjson_object_array_get_idx (struct json_object *obj, int idx)
 

Detailed Description

Function Documentation

struct json_object * json_object_new_array ( void  )

Create a new empty json_object of type json_type_array

Returns
a json_object of type json_type_array

Definition at line 828 of file json_object.c.

struct array_list * json_object_get_array ( struct json_object obj)

Get the arraylist of a json_object of type json_type_array

Parameters
objthe json_object instance
Returns
an arraylist

Definition at line 838 of file json_object.c.

int json_object_array_length ( struct json_object obj)

Get the length of a json_object of type json_type_array

Parameters
objthe json_object instance
Returns
an int

Definition at line 854 of file json_object.c.

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

Parameters
objthe json_object instance
sort_fna sorting function

Definition at line 849 of file json_object.c.

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

Parameters
objthe json_object instance
valthe json_object to be added

Definition at line 859 of file json_object.c.

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.

Parameters
objthe json_object instance
idxthe index to insert the element at
valthe json_object to be added

Definition at line 864 of file json_object.c.

struct json_object * json_object_array_get_idx ( struct json_object obj,
int  idx 
)

Get the element at specificed index of the array (a json_object of type json_type_array)

Parameters
objthe json_object instance
idxthe index to get the element at
Returns
the json_object at the specified index (or NULL)

Definition at line 870 of file json_object.c.