Lines Matching refs:item
74 pub unsafe extern "C" fn ylong_json_print_unformatted(item: *const YlongJson) -> *mut c_char {
75 if item.is_null() {
79 let value = &mut *(item as *mut JsonValue);
95 pub unsafe extern "C" fn ylong_json_delete(item: *mut YlongJson) {
96 if item.is_null() {
100 let _ = Box::from_raw(item as *mut JsonValue);
107 item: *const YlongJson,
110 if item.is_null() {
115 let value = &*(item as *mut JsonValue);
124 let value = &*(item as *mut JsonValue);
137 pub unsafe extern "C" fn ylong_json_is_null(item: *mut YlongJson) -> c_int {
138 if item.is_null() {
142 let item = &*(item as *mut JsonValue);
144 item.is_null() as c_int
156 pub unsafe extern "C" fn ylong_json_is_bool(item: *const YlongJson) -> c_int {
157 if item.is_null() {
161 let item = &*(item as *mut JsonValue);
163 item.is_boolean() as c_int
223 /// Returns a `c_int` where TRUE indicates that the item is a number, and FALSE indicates otherwise.
225 pub unsafe extern "C" fn ylong_json_is_number(item: *const YlongJson) -> c_int {
226 if item.is_null() {
230 let item = &*(item as *mut JsonValue);
231 item.is_number() as c_int
237 pub unsafe extern "C" fn ylong_json_is_double_number(item: *const YlongJson) -> c_int {
238 if item.is_null() {
242 let item = &*(item as *mut JsonValue);
243 match item.try_as_number() {
252 pub unsafe extern "C" fn ylong_json_is_int_number(item: *const YlongJson) -> c_int {
253 if item.is_null() {
257 let item = &*(item as *mut JsonValue);
258 match item.try_as_number() {
368 /// Checks if the `YlongJson` item is a string.
369 /// Returns `FALSE` if the item is null or not a string, and `TRUE` otherwise.
371 pub unsafe extern "C" fn ylong_json_is_string(item: *const YlongJson) -> c_int {
372 if item.is_null() {
376 let item = &*(item as *mut JsonValue);
377 item.is_string() as c_int
430 /// Checks if the `YlongJson` item is an array.
431 /// Returns `FALSE` if the item is null or not an array, and `TRUE` otherwise.
433 pub unsafe extern "C" fn ylong_json_is_array(item: *const YlongJson) -> c_int {
434 if item.is_null() {
438 let item = &*(item as *mut JsonValue);
439 item.is_array() as c_int
463 /// Gets a `YlongJson` item from an array by index.
464 /// Returns null `YlongJson` if the array is null, the item doesn't exist, or any error occurs.
487 /// Adds a `YlongJson` item to an array.
488 /// Returns `FAILURE` if the array or the item is null, and `SUCCESS` otherwise.
492 item: *mut YlongJson,
494 if array.is_null() || item.is_null() {
504 let value = Box::from_raw(item as *mut JsonValue);
510 /// Replaces a `YlongJson` item in an array by index with a new item.
511 /// Returns `FAILURE` if the array or the new item is null, the index is out of bounds, or any error occurs, and `SUCCESS` otherwise.
538 /// Removes a `YlongJson` item from an array by index.
539 /// Returns null `YlongJson` if the array is null, the item doesn't exist, or any error occurs.
562 /// Deletes a `YlongJson` item from an array by index.
605 /// Retrieves a `YlongJson` item from an array node.
618 /// Adds a `YlongJson` item to an array, then returns the node.
619 /// Returns null `YlongJson` if the array or the item is null.
624 item: *mut YlongJson,
626 if array.is_null() || item.is_null() {
636 let value = Box::from_raw(item as *mut JsonValue);
642 /// Replaces an item of an array node with a new item.
643 /// Returns `FAILURE` if the array node or the new item is null, and `SUCCESS` otherwise.
694 /// Checks if the `YlongJson` item is an object.
695 /// Returns `FALSE` if the item is null or not an object, and `TRUE` otherwise.
697 pub unsafe extern "C" fn ylong_json_is_object(item: *const YlongJson) -> c_int {
698 if item.is_null() {
702 let item = &*(item as *mut JsonValue);
703 item.is_object() as c_int
727 /// Checks if a JSON object has a specific item.
728 /// Returns a `c_int` indicating whether the item exists (TRUE) or not (FALSE).
754 /// Retrieves an item from a JSON object by key.
755 /// Returns a mutable pointer to the retrieved JSON item.
788 /// Adds an item to a JSON object.
794 item: *mut YlongJson,
796 // If object or string or item is empty, returns FAILED.
797 if object.is_null() || string.is_null() || item.is_null() {
814 let value = Box::from_raw(item as *mut JsonValue);
821 /// Replaces an item in a JSON object by key.
857 /// Removes an item in a JSON object by index.
858 /// Returns a new JSON object without the item if successful, NULL_MUT_YLONG_JSON otherwise.
883 /// Deletes an item in a JSON object by index.
936 /// Applies a function to each item in a JSON object.
996 /// Gets an item from an object node.
997 /// Returns a pointer to the item if successful, NULL_MUT_YLONG_JSON otherwise.
1011 /// Adds an item to a JSON object, then returns a pointer to the object node.
1018 item: *mut YlongJson,
1020 // If object or item is empty, returns NULL_MUT_YLONG_JSON.
1021 if object.is_null() || string.is_null() || item.is_null() {
1038 let value = Box::from_raw(item as *mut JsonValue);
1045 /// Replaces an item in an object node.
1066 /// Returns a pointer to the removed item if successful, NULL_MUT_YLONG_JSON otherwise.
2016 /// 1. Calls `ylong_json_get_array_item` to get an item of the array.
2079 /// 1. Calls `ylong_json_add_item_to_array` to add an item to the array.
2086 let item = ylong_json_create_null();
2087 assert_eq!(ylong_json_add_item_to_array(array, item), 0);
2088 ylong_json_delete(item);
2091 let item = null_mut();
2092 assert_eq!(ylong_json_add_item_to_array(array, item), 0);
2117 /// 1. Calls `ylong_json_replace_item_in_array` to replace an item in the array.
2124 let item = ylong_json_create_null();
2125 assert_eq!(ylong_json_replace_array_item_by_index(array, 0, item), 0);
2126 ylong_json_delete(item);
2130 let item = null_mut();
2131 assert_eq!(ylong_json_replace_array_item_by_index(array, 0, item), 0);
2161 /// 1. Calls `ylong_json_remove_array_item_by_index` to remove an item in the array by index.
2206 let item = ylong_json_remove_array_item_by_index(null, 0);
2207 assert!(item.is_null());
2218 /// 1. Calls `ylong_json_delete_array_item_by_index` to delete an item in the array by index.
2313 /// 1. Calls `ylong_json_get_item_from_array_node` to get the item of an array node.
2376 /// 1. Calls `ylong_json_add_item_to_array_then_get_node` to add an item to array and get the corresponding node.
2384 let item = ylong_json_create_null();
2385 assert!(ylong_json_add_item_to_array_then_get_node(array, item).is_null());
2386 ylong_json_delete(item);
2390 let item = null_mut();
2391 assert!(ylong_json_add_item_to_array_then_get_node(array, item).is_null());
2418 /// 1. Calls `ylong_json_replace_item_of_array_node` to replace the item of an array node.
2426 let item = ylong_json_create_null();
2427 assert_eq!(ylong_json_replace_item_of_array_node(node, item), 0);
2428 ylong_json_delete(item);
2434 let item = null_mut();
2435 assert_eq!(ylong_json_replace_item_of_array_node(node, item), 0);
2678 /// 1. Calls `ylong_json_has_object_item` to determine whether the item exists in the object.
2725 /// 1. Calls `ylong_json_get_object_item` to get an item in the object.
2749 let item = ylong_json_get_object_item(object, str);
2750 assert_eq!(ylong_json_is_null(item), 1);
2754 let item = ylong_json_get_object_item(object, str);
2755 assert!(item.is_null());
2774 /// 1. Calls `ylong_json_add_item_to_object` to add an item to the object.
2782 let item = ylong_json_create_null();
2783 assert_eq!(ylong_json_add_item_to_object(object, str, item), 0);
2785 ylong_json_delete(item);
2790 let item = ylong_json_create_null();
2791 assert_eq!(ylong_json_add_item_to_object(object, str, item), 0);
2793 ylong_json_delete(item);
2798 let item = null_mut();
2799 assert_eq!(ylong_json_add_item_to_object(object, str, item), 0);
2811 let item = ylong_json_create_null();
2812 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2823 let item = ylong_json_create_null();
2824 assert_eq!(ylong_json_add_item_to_object(null, str, item), 0);
2827 ylong_json_delete(item);
2837 /// 1. Calls `ylong_json_replace_object_item_by_index` to replace an item in the object by index.
2845 let item = ylong_json_create_null();
2847 ylong_json_replace_object_item_by_index(object, str, item),
2851 ylong_json_delete(item);
2856 let item = ylong_json_create_null();
2858 ylong_json_replace_object_item_by_index(object, str, item),
2862 ylong_json_delete(item);
2867 let item = null_mut();
2869 ylong_json_replace_object_item_by_index(object, str, item),
2877 let item = ylong_json_create_null();
2878 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2882 let item = ylong_json_create_bool(1);
2884 ylong_json_replace_object_item_by_index(object, str, item),
2895 let item = ylong_json_create_null();
2896 assert_eq!(ylong_json_replace_object_item_by_index(null, str, item), 0);
2899 ylong_json_delete(item);
2909 /// 1. Calls `ylong_json_remove_object_item_by_index` to remove an item in the object by index.
2928 let item = ylong_json_create_null();
2929 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2933 let item = ylong_json_remove_object_item_by_index(object, str);
2934 assert!(!item.is_null());
2935 assert_eq!(ylong_json_is_null(item), 1);
2941 ylong_json_delete(item);
2957 /// 1. Calls `ylong_json_delete_object_by_index` to delete an item in the object by index.
2976 let item = ylong_json_create_null();
2977 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
3087 let item = *(values.offset(cnt as isize));
3088 let value = ylong_json_print_unformatted(item);
3119 /// 1. Calls `ylong_json_for_each_object_item` to do `func` for each item in the object.
3190 let item = ylong_json_get_item_from_object_node(node);
3191 assert_eq!(ylong_json_is_null(item), 1);
3210 /// 1. Calls `ylong_json_get_item_from_object_node` to get the item of an object node.
3218 let item = ylong_json_get_item_from_object_node(node);
3219 assert!(item.is_null());
3228 let item = ylong_json_get_item_from_object_node(node);
3229 assert_eq!(ylong_json_is_null(item), 1);
3242 /// 1. Calls `ylong_json_add_item_to_object_then_get_node` to add an item to the object and get the corresponding node.
3251 let item = ylong_json_create_null();
3252 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3255 ylong_json_delete(item);
3260 let item = ylong_json_create_null();
3261 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3264 ylong_json_delete(item);
3269 let item = null_mut();
3270 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3277 let item = ylong_json_create_null();
3278 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3280 let item = ylong_json_get_item_from_object_node(node);
3281 assert_eq!(ylong_json_is_null(item), 1);
3287 let item = ylong_json_create_null();
3288 let node = ylong_json_add_item_to_object_then_get_node(null, str, item);
3292 ylong_json_delete(item);
3302 /// 1. Calls `ylong_json_replace_item_of_object_node` to replace the item of an object node.
3310 let item = ylong_json_create_null();
3311 assert_eq!(ylong_json_replace_item_of_object_node(node, item), 0);
3312 ylong_json_delete(item);
3317 let item = ylong_json_create_null();
3318 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3319 let item = null_mut();
3320 assert_eq!(ylong_json_replace_item_of_object_node(node, item), 0);
3326 let item = ylong_json_create_null();
3327 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3331 let item = ylong_json_create_bool(1);
3332 assert_eq!(ylong_json_replace_item_of_object_node(node, item), 1);
3355 let item = ylong_json_remove_object_node(node);
3356 assert!(item.is_null());
3360 let item = ylong_json_create_null();
3361 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3366 let item = ylong_json_remove_object_node(node);
3367 assert_eq!(ylong_json_is_null(item), 1);
3371 ylong_json_delete(item);
3394 let item = ylong_json_create_null();
3395 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);