src/cx/json.h

changeset 1033
e3009345984b
parent 1013
add8358fc3c3
child 1037
83620ba72cc1
equal deleted inserted replaced
1032:aaad28e23dac 1033:e3009345984b
757 } 757 }
758 758
759 /** 759 /**
760 * Obtains a C string from the given JSON value. 760 * Obtains a C string from the given JSON value.
761 * 761 *
762 * If the value is not a string, the behavior is undefined. 762 * If the \p value is not a string, the behavior is undefined.
763 * 763 *
764 * @param value the JSON value 764 * @param value the JSON value
765 * @return the value represented as C string 765 * @return the value represented as C string
766 * @see cxJsonIsString() 766 * @see cxJsonIsString()
767 */ 767 */
772 } 772 }
773 773
774 /** 774 /**
775 * Obtains a UCX string from the given JSON value. 775 * Obtains a UCX string from the given JSON value.
776 * 776 *
777 * If the value is not a string, the behavior is undefined. 777 * If the \p value is not a string, the behavior is undefined.
778 * 778 *
779 * @param value the JSON value 779 * @param value the JSON value
780 * @return the value represented as UCX string 780 * @return the value represented as UCX string
781 * @see cxJsonIsString() 781 * @see cxJsonIsString()
782 */ 782 */
786 } 786 }
787 787
788 /** 788 /**
789 * Obtains a mutable UCX string from the given JSON value. 789 * Obtains a mutable UCX string from the given JSON value.
790 * 790 *
791 * If the value is not a string, the behavior is undefined. 791 * If the \p value is not a string, the behavior is undefined.
792 * 792 *
793 * @param value the JSON value 793 * @param value the JSON value
794 * @return the value represented as mutable UCX string 794 * @return the value represented as mutable UCX string
795 * @see cxJsonIsString() 795 * @see cxJsonIsString()
796 */ 796 */
800 } 800 }
801 801
802 /** 802 /**
803 * Obtains a double-precision floating point value from the given JSON value. 803 * Obtains a double-precision floating point value from the given JSON value.
804 * 804 *
805 * If the value is not a JSON number, the behavior is undefined. 805 * If the \p value is not a JSON number, the behavior is undefined.
806 * 806 *
807 * @param value the JSON value 807 * @param value the JSON value
808 * @return the value represented as double 808 * @return the value represented as double
809 * @see cxJsonIsNumber() 809 * @see cxJsonIsNumber()
810 */ 810 */
818 } 818 }
819 819
820 /** 820 /**
821 * Obtains a 64-bit signed integer from the given JSON value. 821 * Obtains a 64-bit signed integer from the given JSON value.
822 * 822 *
823 * If the value is not a JSON number, the behavior is undefined. 823 * If the \p value is not a JSON number, the behavior is undefined.
824 * If it is a JSON number, but not an integer, the value will be 824 * If it is a JSON number, but not an integer, the value will be
825 * converted to an integer, possibly losing precision. 825 * converted to an integer, possibly losing precision.
826 * 826 *
827 * @param value the JSON value 827 * @param value the JSON value
828 * @return the value represented as double 828 * @return the value represented as double
839 } 839 }
840 840
841 /** 841 /**
842 * Obtains a Boolean value from the given JSON value. 842 * Obtains a Boolean value from the given JSON value.
843 * 843 *
844 * If the value is not a JSON literal, the behavior is undefined. 844 * If the \p value is not a JSON literal, the behavior is undefined.
845 * The \c null literal is interpreted as \c false. 845 * The \c null literal is interpreted as \c false.
846 * 846 *
847 * @param value the JSON value 847 * @param value the JSON value
848 * @return the value represented as double 848 * @return the value represented as double
849 * @see cxJsonIsLiteral() 849 * @see cxJsonIsLiteral()
854 } 854 }
855 855
856 /** 856 /**
857 * Returns the size of a JSON array. 857 * Returns the size of a JSON array.
858 * 858 *
859 * If the value is not a JSON array, the behavior is undefined. 859 * If the \p value is not a JSON array, the behavior is undefined.
860 * 860 *
861 * @param value the JSON value 861 * @param value the JSON value
862 * @return the size of the array 862 * @return the size of the array
863 * @see cxJsonIsArray() 863 * @see cxJsonIsArray()
864 */ 864 */
868 } 868 }
869 869
870 /** 870 /**
871 * Returns an element from a JSON array. 871 * Returns an element from a JSON array.
872 * 872 *
873 * If the value is not a JSON array, the behavior is undefined. 873 * If the \p value is not a JSON array, the behavior is undefined.
874 * 874 *
875 * This function guarantees to return a value. If the index is 875 * This function guarantees to return a value. If the index is
876 * out of bounds, the returned value will be of type 876 * out of bounds, the returned value will be of type
877 * #CX_JSON_NOTHING, but never \c NULL. 877 * #CX_JSON_NOTHING, but never \c NULL.
878 * 878 *
884 cx_attr_nonnull 884 cx_attr_nonnull
885 cx_attr_returns_nonnull 885 cx_attr_returns_nonnull
886 CxJsonValue *cxJsonArrGet(const CxJsonValue *value, size_t index); 886 CxJsonValue *cxJsonArrGet(const CxJsonValue *value, size_t index);
887 887
888 /** 888 /**
889 * Returns an iterator over the JSON array elements.
890 *
891 * The iterator yields values of type \c CxJsonValue* .
892 *
893 * If the \p value is not a JSON array, the behavior is undefined.
894 *
895 * @param value the JSON value
896 * @return an iterator over the array elements
897 * @see cxJsonIsArray()
898 */
899 cx_attr_nonnull
900 cx_attr_nodiscard
901 CxIterator cxJsonArrIter(const CxJsonValue *value);
902
903 /**
889 * Returns a value corresponding to a key in a JSON object. 904 * Returns a value corresponding to a key in a JSON object.
890 * 905 *
891 * If the value is not a JSON object, the behavior is undefined. 906 * If the \p value is not a JSON object, the behavior is undefined.
892 * 907 *
893 * This function guarantees to return a JSON value. If the 908 * This function guarantees to return a JSON value. If the
894 * object does not contain \p name, the returned JSON value 909 * object does not contain \p name, the returned JSON value
895 * will be of type #CX_JSON_NOTHING, but never \c NULL. 910 * will be of type #CX_JSON_NOTHING, but never \c NULL.
896 * 911 *

mercurial