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_int (int32_t i)
 
struct json_objectjson_object_new_int64 (int64_t i)
 
int32_t json_object_get_int (struct json_object *obj)
 
int64_t json_object_get_int64 (struct json_object *obj)
 

Detailed Description

Function Documentation

struct json_object * json_object_new_int ( int32_t  i)

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.

Parameters
ithe integer
Returns
a json_object of type json_type_int

Definition at line 495 of file json_object.c.

struct json_object * json_object_new_int64 ( int64_t  i)

Create a new empty json_object of type json_type_int

Parameters
ithe integer
Returns
a json_object of type json_type_int

Definition at line 550 of file json_object.c.

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.

Parameters
objthe json_object instance
Returns
an int

Definition at line 504 of file json_object.c.

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).

Parameters
objthe json_object instance
Returns
an int64

Definition at line 559 of file json_object.c.