20 *pdest = calloc( 1,
sizeof(
JST_Pair ));
66 item->
name = strdup( name );
72 if( object->
items == NULL ) {
77 object->items[
object->count-1] = item;
99 if( array->
items == NULL ) {
115 if(( array == NULL )||( src == NULL )) {
118 if( index > array->
count ) {
121 return element_copy( &(array->
items[index]->
element), src );
125 if((
object == NULL )||( name == NULL )) {
128 for(
unsigned i = 0; i <
object->count; ++i ) {
130 if( 0 == strcmp( pair->
name, name )) {
141 if( array == NULL ) {
144 if( index >= array->
count ) {
struct JST_Pair_ ** items
Array of JST_Pair, ordered by JST_Pair.name to ease search with bsearch()
char * name
This property's name.
int JST_pairs_compare(const void *left, const void *right)
JST_Error JST_remove_item(JST_Array *array, unsigned index)
JST_Error JST_add_item(JST_Array *array, const JST_Element *value)
A object attribute item has a parent and is a named-typed-value pair.
JST_Error JST_replace_item(JST_Array *array, unsigned index, const JST_Element *src)
An array item has a parent and a typed value.
A JSON object, a sorted set of named-value pairs.
JST_Error JST_add_property(JST_Object *object, unsigned index, const char *name, const JST_Element *value)
Add a named-value pair to an object.
JST_Error JST_remove_property(JST_Object *object, const char *name)
An element is a typed value.
JST_Object * parent
This property's owner.
struct JST_Element_ * parent
of type JST_ArrayItem or JST_Pair, case selector is parent->type
struct JST_ArrayItem_ ** items
Array of JST_ArrayItem.
unsigned count
Cardinality of the previous array.
struct JST_Element_ * parent
of type JST_ArrayItem or JST_Pair, case selector is parent->type
JST_Element element
The value associated with the name.
unsigned count
Cardinality of the previous array.