mirror of
https://github.com/json-c/json-c.git
synced 2026-03-25 07:59:07 +08:00
Add json_object_add_int functions
This commit is contained in:
@@ -718,6 +718,22 @@ JSON_EXPORT int32_t json_object_get_int(const struct json_object *obj);
|
||||
*/
|
||||
JSON_EXPORT int json_object_set_int(struct json_object *obj,int new_value);
|
||||
|
||||
/** Add the int value to the value of a json object
|
||||
*
|
||||
* The type of obj is checked to be a json type int and 0 is returned
|
||||
* if it is not without any further actions. If the type of obj is
|
||||
* json_type_int the int value is added to the object value.
|
||||
* If the addition would result in a overflow, the object value
|
||||
* is set to INT32_MAX.
|
||||
* If the addition would result in a underflow, the object value
|
||||
* is set to INT32_MIN.
|
||||
*
|
||||
* @param obj the json_object instance
|
||||
* @param val the value to add
|
||||
* @returns 1 if the addition succeded, 0 otherwise
|
||||
*/
|
||||
JSON_EXPORT int json_object_add_int(struct json_object *obj, int val);
|
||||
|
||||
|
||||
/** Get the int value of a json_object
|
||||
*
|
||||
@@ -747,6 +763,21 @@ JSON_EXPORT int64_t json_object_get_int64(const struct json_object *obj);
|
||||
*/
|
||||
JSON_EXPORT int json_object_set_int64(struct json_object *obj,int64_t new_value);
|
||||
|
||||
/** Add a int64_t value to the int64_t value of a json_object
|
||||
*
|
||||
* The type of obj is checked to be a json_type_int and 0 is returned
|
||||
* if it is not without any further actions. If the type of obj is
|
||||
* json_type_int the int64 value is added to the object value.
|
||||
* If the addition to the object would result in a overflow the
|
||||
* object value is set to INT64_MAX.
|
||||
* If the addition would result in a underflow, the
|
||||
* object value is set to INT64_MIN.
|
||||
*
|
||||
* @param obj the json_object instance
|
||||
* @param val the int64_vaule to add
|
||||
* @returns 1 if the addition succeeded, 0 otherwise
|
||||
*/
|
||||
JSON_EXPORT int json_object_add_int64(struct json_object *obj, int64_t val);
|
||||
|
||||
/* double type methods */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user