Lines Matching refs:object
38 /// Returns a JSON object on success and null on failure.
71 /// Outputs a JSON object to a string in plain format.
93 /// Deletes a JSON object.
103 /// Duplicates a JSON object.
104 /// Return a new JSON object on success and null on failure.
128 /// Creates a JSON null object and returns a new JSON null object.
134 /// Checks whether a JSON object is null.
135 /// Returns a boolean value indicating whether the object is null.
147 /// Creates a JSON boolean object.
154 /// Checks whether a JSON object is a boolean.
166 /// Gets the boolean value of a JSON boolean object.
187 /// Sets the boolean value of a JSON boolean object.
208 /// Creates a JSON double number object.
215 /// Creates a JSON integer number object.
222 /// Checks whether a JSON object is a number.
234 /// Checks whether a JSON object is a double number.
249 /// Checks whether a JSON object is an integer number.
264 /// Gets the double value of a JSON number object.
289 /// Gets the integer value of a JSON number object.
314 /// Sets the double value of a JSON number object.
334 /// Sets the integer value of a JSON number object.
688 /// Creates a `YlongJson` object.
694 /// Checks if the `YlongJson` item is an object.
695 /// Returns `FALSE` if the item is null or not an object, and `TRUE` otherwise.
706 /// Gets the size of a `YlongJson` object.
707 /// If the `YlongJson` object or the size is null, it returns `FAILURE`.
710 object: *mut YlongJson,
713 if object.is_null() || size.is_null() {
717 let object = &mut *(object as *mut JsonValue);
718 let object = match object.try_as_mut_object() {
723 *size = object.len() as c_int;
727 /// Checks if a JSON object has a specific item.
731 object: *mut YlongJson,
734 if object.is_null() || string.is_null() {
738 let object = &*(object as *mut JsonValue);
739 let object = match object.try_as_object() {
751 object.contains_key(str) as c_int
754 /// Retrieves an item from a JSON object by key.
758 object: *const YlongJson,
761 // If object is empty, the search fails.
762 if object.is_null() || string.is_null() {
766 let object_ref = &mut *(object as *mut JsonValue);
768 // If the type is not object, return err.
788 /// Adds an item to a JSON object.
792 object: *mut YlongJson,
796 // If object or string or item is empty, returns FAILED.
797 if object.is_null() || string.is_null() || item.is_null() {
801 let object_ref = &mut *(object as *mut JsonValue);
821 /// Replaces an item in a JSON object by key.
825 object: *mut YlongJson,
829 if object.is_null() || index.is_null() || new_item.is_null() {
833 let object_ref = &mut *(object as *mut JsonValue);
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.
861 object: *mut YlongJson,
864 if object.is_null() || index.is_null() {
868 let object = &mut *(object as *mut JsonValue);
877 if let Some(v) = object.remove(index) {
883 /// Deletes an item in a JSON object by index.
887 object: *mut YlongJson,
890 if object.is_null() || index.is_null() {
894 let object = &mut *(object as *mut JsonValue);
903 object.remove(index);
906 /// Gets all items from a JSON object.
910 object: *mut YlongJson,
915 if object.is_null() || key.is_null() || value.is_null() || len.is_null() {
919 let object = &mut *(object as *mut JsonValue);
920 let object = match object.try_as_mut_object() {
925 for (n, (k, v)) in object.iter_mut().enumerate() {
932 *len = object.len() as c_int;
936 /// Applies a function to each item in a JSON object.
940 object: *mut YlongJson,
943 if object.is_null() {
947 let object = &mut *(object as *mut JsonValue);
948 let object = match object.try_as_mut_object() {
953 object.iter_mut().for_each(|(_k, v)| {
960 /// Gets an object node from a JSON object by key.
961 /// Returns a pointer to the object node if successful, NULL_MUT_YLONG_JSON otherwise.
965 object: *const YlongJson,
968 // If object is empty, the search fails.
969 if object.is_null() || string.is_null() {
973 let object_ref = &mut *(object as *mut JsonValue);
975 // If the type is not object, returns err.
996 /// Gets an item from an object node.
1011 /// Adds an item to a JSON object, then returns a pointer to the object node.
1012 /// Returns a pointer to the object node if successful, NULL_MUT_YLONG_JSON otherwise.
1016 object: *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() {
1025 let object_ref = &mut *(object as *mut JsonValue);
1045 /// Replaces an item in an object node.
1065 /// Removes an object node.
1080 /// Deletes a node from a JSON object.
1108 "object": {
2592 /// 1. Calls `ylong_json_create_object` to create an object.
2597 let object = ylong_json_create_object();
2598 assert_eq!(ylong_json_is_object(object), 1);
2599 let result = ylong_json_print_unformatted(object);
2602 ylong_json_delete(object);
2612 /// 1. Calls `ylong_json_is_object` to determine whether the value is object.
2618 let object = null_mut();
2619 assert_eq!(ylong_json_is_object(object), 0);
2621 let object = ylong_json_create_object();
2622 assert_eq!(ylong_json_is_object(object), 1);
2623 ylong_json_delete(object);
2637 /// 1. Calls `ylong_json_get_object_size` to get size of an object.
2643 let object = null_mut();
2646 ylong_json_get_object_size(object, &mut len as *mut c_int),
2651 let object = ylong_json_create_object();
2653 assert_eq!(ylong_json_get_object_size(object, len), 0);
2654 ylong_json_delete(object);
2656 let object = ylong_json_create_object();
2659 ylong_json_get_object_size(object, &mut len as *mut c_int),
2663 ylong_json_delete(object);
2678 /// 1. Calls `ylong_json_has_object_item` to determine whether the item exists in the object.
2684 let object = null_mut();
2686 assert_eq!(ylong_json_has_object_item(object, str), 0);
2690 let object = ylong_json_create_object();
2692 assert_eq!(ylong_json_has_object_item(object, str), 0);
2693 ylong_json_delete(object);
2698 let object = ylong_json_parse(str, &mut msg as *mut *mut c_char);
2702 assert_eq!(ylong_json_has_object_item(object, str), 1);
2706 assert_eq!(ylong_json_has_object_item(object, str), 0);
2709 ylong_json_delete(object);
2725 /// 1. Calls `ylong_json_get_object_item` to get an item in the object.
2731 let object = null_mut();
2733 assert!(ylong_json_get_object_item(object, str).is_null());
2737 let object = ylong_json_create_object();
2739 assert!(ylong_json_get_object_item(object, str).is_null());
2740 ylong_json_delete(object);
2745 let object = ylong_json_parse(str, &mut msg as *mut *mut c_char);
2749 let item = ylong_json_get_object_item(object, str);
2754 let item = ylong_json_get_object_item(object, str);
2758 ylong_json_delete(object);
2774 /// 1. Calls `ylong_json_add_item_to_object` to add an item to the object.
2780 let object = null_mut();
2783 assert_eq!(ylong_json_add_item_to_object(object, str, item), 0);
2788 let object = ylong_json_create_object();
2791 assert_eq!(ylong_json_add_item_to_object(object, str, item), 0);
2792 ylong_json_delete(object);
2796 let object = ylong_json_create_object();
2799 assert_eq!(ylong_json_add_item_to_object(object, str, item), 0);
2800 ylong_json_delete(object);
2803 let object = ylong_json_create_object();
2806 ylong_json_get_object_size(object, &mut len as *mut c_int),
2812 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2815 ylong_json_get_object_size(object, &mut len as *mut c_int),
2819 ylong_json_delete(object);
2837 /// 1. Calls `ylong_json_replace_object_item_by_index` to replace an item in the object by index.
2843 let object = null_mut();
2847 ylong_json_replace_object_item_by_index(object, str, item),
2854 let object = ylong_json_create_object();
2858 ylong_json_replace_object_item_by_index(object, str, item),
2861 ylong_json_delete(object);
2865 let object = ylong_json_create_object();
2869 ylong_json_replace_object_item_by_index(object, str, item),
2872 ylong_json_delete(object);
2875 let object = ylong_json_create_object();
2878 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2879 let result = ylong_json_print_unformatted(object);
2884 ylong_json_replace_object_item_by_index(object, str, item),
2888 let result = ylong_json_print_unformatted(object);
2891 ylong_json_delete(object);
2909 /// 1. Calls `ylong_json_remove_object_item_by_index` to remove an item in the object by index.
2915 let object = null_mut();
2917 assert!(ylong_json_remove_object_item_by_index(object, str).is_null());
2921 let object = ylong_json_create_object();
2923 assert!(ylong_json_remove_object_item_by_index(object, str).is_null());
2924 ylong_json_delete(object);
2926 let object = ylong_json_create_object();
2929 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2930 let result = ylong_json_print_unformatted(object);
2933 let item = ylong_json_remove_object_item_by_index(object, str);
2936 let result = ylong_json_print_unformatted(object);
2939 ylong_json_delete(object);
2957 /// 1. Calls `ylong_json_delete_object_by_index` to delete an item in the object by index.
2963 let object = null_mut();
2965 ylong_json_delete_object_item_by_index(object, str);
2969 let object = ylong_json_create_object();
2971 ylong_json_delete_object_item_by_index(object, str);
2972 ylong_json_delete(object);
2974 let object = ylong_json_create_object();
2977 assert_eq!(ylong_json_add_item_to_object(object, str, item), 1);
2978 let result = ylong_json_print_unformatted(object);
2981 ylong_json_delete_object_item_by_index(object, str);
2982 let result = ylong_json_print_unformatted(object);
2985 ylong_json_delete(object);
3002 /// 1. Calls `ylong_json_get_all_object_items` to get all items in the object.
3008 let object = null_mut();
3014 ylong_json_get_all_object_items(object, keys, values, &mut len as *mut c_int),
3021 let object = ylong_json_create_object();
3027 ylong_json_get_all_object_items(object, keys, values, &mut len as *mut c_int),
3030 ylong_json_delete(object);
3034 let object = ylong_json_create_object();
3039 ylong_json_get_all_object_items(object, keys, values, &mut len as *mut c_int),
3042 ylong_json_delete(object);
3046 let object = ylong_json_create_object();
3053 ylong_json_get_all_object_items(object, keys, values, len),
3056 ylong_json_delete(object);
3063 let object = ylong_json_parse(text, &mut err_msg as *mut *mut c_char);
3067 ylong_json_get_object_size(object, &mut len as *mut c_int),
3075 ylong_json_get_all_object_items(object, keys, values, &mut len as *mut c_int),
3095 ylong_json_delete(object);
3097 // 非 object
3119 /// 1. Calls `ylong_json_for_each_object_item` to do `func` for each item in the object.
3129 let object = null_mut();
3130 assert_eq!(ylong_json_for_each_object_item(object, func), 0);
3135 let object = ylong_json_parse(text, err_msg);
3137 let result = ylong_json_print_unformatted(object);
3140 assert_eq!(ylong_json_for_each_object_item(object, func), 1);
3141 let result = ylong_json_print_unformatted(object);
3147 ylong_json_delete(object);
3161 /// 1. Calls `ylong_json_get_object_node` to get an object node.
3168 let object = null_mut();
3170 let node = ylong_json_get_object_node(object, str);
3175 let object = ylong_json_create_object();
3177 let node = ylong_json_get_object_node(object, str);
3179 ylong_json_delete(object);
3184 let object = ylong_json_parse(text, err_msg);
3187 let node = ylong_json_get_object_node(object, str);
3192 ylong_json_delete(object);
3194 // Non-object
3210 /// 1. Calls `ylong_json_get_item_from_object_node` to get the item of an object node.
3224 let object = ylong_json_parse(text, err_msg);
3226 let node = ylong_json_get_object_node(object, str);
3232 ylong_json_delete(object);
3242 /// 1. Calls `ylong_json_add_item_to_object_then_get_node` to add an item to the object and get the corresponding node.
3249 let object = null_mut();
3252 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3258 let object = ylong_json_create_object();
3261 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3263 ylong_json_delete(object);
3267 let object = ylong_json_create_object();
3270 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3272 ylong_json_delete(object);
3275 let object = ylong_json_create_object();
3278 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3282 ylong_json_delete(object);
3302 /// 1. Calls `ylong_json_replace_item_of_object_node` to replace the item of an object node.
3315 let object = ylong_json_create_object();
3318 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3321 ylong_json_delete(object);
3324 let object = ylong_json_create_object();
3327 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3328 let result = ylong_json_print_unformatted(object);
3333 let result = ylong_json_print_unformatted(object);
3336 ylong_json_delete(object);
3347 /// 1. Calls `ylong_json_remove_object_node` to remove an object node.
3358 let object = ylong_json_create_object();
3361 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3363 let result = ylong_json_print_unformatted(object);
3368 let result = ylong_json_print_unformatted(object);
3372 ylong_json_delete(object);
3382 /// 1. Calls `ylong_json_delete_object_node` to delete an object node.
3392 let object = ylong_json_create_object();
3395 let node = ylong_json_add_item_to_object_then_get_node(object, str, item);
3396 let result = ylong_json_print_unformatted(object);
3400 let result = ylong_json_print_unformatted(object);
3404 ylong_json_delete(object);