diff --git a/src/json.hpp b/src/json.hpp index 3e9c9a3d..cb2a803b 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -314,10 +314,12 @@ class basic_json #### Storage - Objects are stored as pointers in a `basic_json` type. That is, for any + Objects are stored as pointers in a @ref basic_json type. That is, for any access to object values, a pointer of type `object_t*` must be dereferenced. - @sa array_t + @sa @ref array_t -- type for an array value + + @since version 1.0 */ using object_t = ObjectType>; @@ -402,9 +408,11 @@ class basic_json #### Storage - String values are stored as pointers in a `basic_json` type. That is, for - any access to string values, a pointer of type `string_t*` must be + String values are stored as pointers in a @ref basic_json type. That is, + for any access to string values, a pointer of type `string_t*` must be dereferenced. + + @since version 1.0 */ using string_t = StringType; @@ -428,7 +436,9 @@ class basic_json #### Storage - Boolean values are stored directly inside a `basic_json` type. + Boolean values are stored directly inside a @ref basic_json type. + + @since version 1.0 */ using boolean_t = BooleanType; @@ -492,7 +502,11 @@ class basic_json #### Storage - Integer number values are stored directly inside a `basic_json` type. + Integer number values are stored directly inside a @ref basic_json type. + + @sa @ref number_float_t -- type for number values (floating-point) + + @since version 1.0 */ using number_integer_t = NumberIntegerType; @@ -552,7 +566,12 @@ class basic_json #### Storage - Floating-point number values are stored directly inside a `basic_json` type. + Floating-point number values are stored directly inside a @ref basic_json + type. + + @sa @ref number_integer_t -- type for number values (integer) + + @since version 1.0 */ using number_float_t = NumberFloatType; @@ -567,8 +586,11 @@ class basic_json @brief the JSON type enumeration This enumeration collects the different JSON types. It is internally used - to distinguish the stored values, and the functions is_null, is_object, - is_array, is_string, is_boolean, is_number, and is_discarded rely on it. + to distinguish the stored values, and the functions @ref is_null(), @ref + is_object(), @ref is_array(), @ref is_string(), @ref is_boolean(), @ref + is_number(), and @ref is_discarded() rely on it. + + @since version 1.0 */ enum class value_t : uint8_t { @@ -602,7 +624,13 @@ class basic_json // JSON value storage // //////////////////////// - /// a JSON value + /*! + @brief a JSON value + + The actual storage for a JSON value of the @ref basic_json class. + + @since version 1.0 + */ union json_value { /// object (stored with pointer to save storage) @@ -704,6 +732,8 @@ class basic_json This enumeration lists the parser events that can trigger calling a callback function of type @ref parser_callback_t during parsing. + + @since version 1.0 */ enum class parse_event_t : uint8_t { @@ -767,9 +797,10 @@ class basic_json @sa @ref parse(std::istream&, parser_callback_t) or @ref parse(const string_t&, parser_callback_t) for examples + + @since version 1.0 */ - using parser_callback_t = std::function; + using parser_callback_t = std::function; ////////////////// @@ -800,6 +831,14 @@ class basic_json @liveexample{The following code shows the constructor for different @ref value_t values,basic_json__value_t} + + @sa @ref basic_json(std::nullptr_t) -- create a `null` value + @sa @ref basic_json(boolean_t value) -- create a boolean value + @sa @ref basic_json(const string_t&) -- create a string value + @sa @ref basic_json(const object_t&) -- create a object value + @sa @ref basic_json(const array_t&) -- create a array value + + @since version 1.0 */ basic_json(const value_t value) : m_type(value), m_value(value) @@ -820,7 +859,9 @@ class basic_json @liveexample{The following code shows the constructor for a `null` JSON value.,basic_json} - @sa basic_json(std::nullptr_t) + @sa @ref basic_json(std::nullptr_t) -- create a `null` value + + @since version 1.0 */ basic_json() noexcept = default; @@ -838,7 +879,10 @@ class basic_json @liveexample{The following code shows the constructor with null pointer parameter.,basic_json__nullptr_t} - @sa basic_json() + @sa @ref basic_json() -- default constructor (implicitly creating a `null` + value) + + @since version 1.0 */ basic_json(std::nullptr_t) noexcept : basic_json(value_t::null) @@ -858,7 +902,10 @@ class basic_json @liveexample{The following code shows the constructor with an @ref object_t parameter.,basic_json__object_t} - @sa basic_json(const CompatibleObjectType&) + @sa @ref basic_json(const CompatibleObjectType&) -- create an object value + from a compatible STL container + + @since version 1.0 */ basic_json(const object_t& value) : m_type(value_t::object), m_value(value) @@ -883,7 +930,9 @@ class basic_json @liveexample{The following code shows the constructor with several compatible object type parameters.,basic_json__CompatibleObjectType} - @sa basic_json(const object_t&) + @sa @ref basic_json(const object_t&) -- create an object value + + @since version 1.0 */ template ) - create a JSON - array value from an initializer list - @sa basic_json object(std::initializer_list) - create a JSON - object value from an initializer list + @sa @ref array(std::initializer_list) - create a JSON array + value from an initializer list + @sa @ref object(std::initializer_list) - create a JSON object + value from an initializer list + + @since version 1.0 */ basic_json(std::initializer_list init, bool type_deduction = true, @@ -1343,10 +1433,12 @@ class basic_json @liveexample{The following code shows an example for the @ref array function.,array} - @sa basic_json(std::initializer_list, bool, value_t) - create a - JSON value from an initializer list - @sa basic_json object(std::initializer_list) - create a JSON - object value from an initializer list + @sa @ref basic_json(std::initializer_list, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref object(std::initializer_list) -- create a JSON object + value from an initializer list + + @since version 1.0 */ static basic_json array(std::initializer_list init = std::initializer_list()) @@ -1362,29 +1454,31 @@ class basic_json the initializer list is empty, the empty object `{}` is created. @note This function is only added for symmetry reasons. In contrast to the - related function @ref basic_json array(std::initializer_list), - there are no cases which can only be expressed by this function. That is, - any initializer list @a init can also be passed to the initializer list - constructor @ref basic_json(std::initializer_list, bool, - value_t). + related function @ref array(std::initializer_list), there are + no cases which can only be expressed by this function. That is, any + initializer list @a init can also be passed to the initializer list + constructor + @ref basic_json(std::initializer_list, bool, value_t). @param[in] init initializer list to create an object from (optional) @return JSON object value @throw std::domain_error if @a init is not a pair whose first elements are - strings; thrown by @ref basic_json(std::initializer_list, bool, - value_t) + strings; thrown by + @ref basic_json(std::initializer_list, bool, value_t) @complexity Linear in the size of @a init. @liveexample{The following code shows an example for the @ref object function.,object} - @sa basic_json(std::initializer_list, bool, value_t) - create a - JSON value from an initializer list - @sa basic_json array(std::initializer_list) - create a JSON - array value from an initializer list + @sa @ref basic_json(std::initializer_list, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref array(std::initializer_list) -- create a JSON array + value from an initializer list + + @since version 1.0 */ static basic_json object(std::initializer_list init = std::initializer_list()) @@ -1407,6 +1501,8 @@ class basic_json @liveexample{The following code shows examples for the @ref basic_json(size_type\, const basic_json&) constructor.,basic_json__size_type_basic_json} + + @since version 1.0 */ basic_json(size_type count, const basic_json& value) : m_type(value_t::array) @@ -1443,6 +1539,8 @@ class basic_json @liveexample{The example below shows several ways to create JSON values by specifying a subrange with iterators.,basic_json__InputIt_InputIt} + + @since version 1.0 */ template >; @@ -402,9 +408,11 @@ class basic_json #### Storage - String values are stored as pointers in a `basic_json` type. That is, for - any access to string values, a pointer of type `string_t*` must be + String values are stored as pointers in a @ref basic_json type. That is, + for any access to string values, a pointer of type `string_t*` must be dereferenced. + + @since version 1.0 */ using string_t = StringType; @@ -428,7 +436,9 @@ class basic_json #### Storage - Boolean values are stored directly inside a `basic_json` type. + Boolean values are stored directly inside a @ref basic_json type. + + @since version 1.0 */ using boolean_t = BooleanType; @@ -492,7 +502,11 @@ class basic_json #### Storage - Integer number values are stored directly inside a `basic_json` type. + Integer number values are stored directly inside a @ref basic_json type. + + @sa @ref number_float_t -- type for number values (floating-point) + + @since version 1.0 */ using number_integer_t = NumberIntegerType; @@ -552,7 +566,12 @@ class basic_json #### Storage - Floating-point number values are stored directly inside a `basic_json` type. + Floating-point number values are stored directly inside a @ref basic_json + type. + + @sa @ref number_integer_t -- type for number values (integer) + + @since version 1.0 */ using number_float_t = NumberFloatType; @@ -567,8 +586,11 @@ class basic_json @brief the JSON type enumeration This enumeration collects the different JSON types. It is internally used - to distinguish the stored values, and the functions is_null, is_object, - is_array, is_string, is_boolean, is_number, and is_discarded rely on it. + to distinguish the stored values, and the functions @ref is_null(), @ref + is_object(), @ref is_array(), @ref is_string(), @ref is_boolean(), @ref + is_number(), and @ref is_discarded() rely on it. + + @since version 1.0 */ enum class value_t : uint8_t { @@ -602,7 +624,13 @@ class basic_json // JSON value storage // //////////////////////// - /// a JSON value + /*! + @brief a JSON value + + The actual storage for a JSON value of the @ref basic_json class. + + @since version 1.0 + */ union json_value { /// object (stored with pointer to save storage) @@ -704,6 +732,8 @@ class basic_json This enumeration lists the parser events that can trigger calling a callback function of type @ref parser_callback_t during parsing. + + @since version 1.0 */ enum class parse_event_t : uint8_t { @@ -767,9 +797,10 @@ class basic_json @sa @ref parse(std::istream&, parser_callback_t) or @ref parse(const string_t&, parser_callback_t) for examples + + @since version 1.0 */ - using parser_callback_t = std::function; + using parser_callback_t = std::function; ////////////////// @@ -800,6 +831,14 @@ class basic_json @liveexample{The following code shows the constructor for different @ref value_t values,basic_json__value_t} + + @sa @ref basic_json(std::nullptr_t) -- create a `null` value + @sa @ref basic_json(boolean_t value) -- create a boolean value + @sa @ref basic_json(const string_t&) -- create a string value + @sa @ref basic_json(const object_t&) -- create a object value + @sa @ref basic_json(const array_t&) -- create a array value + + @since version 1.0 */ basic_json(const value_t value) : m_type(value), m_value(value) @@ -820,7 +859,9 @@ class basic_json @liveexample{The following code shows the constructor for a `null` JSON value.,basic_json} - @sa basic_json(std::nullptr_t) + @sa @ref basic_json(std::nullptr_t) -- create a `null` value + + @since version 1.0 */ basic_json() noexcept = default; @@ -838,7 +879,10 @@ class basic_json @liveexample{The following code shows the constructor with null pointer parameter.,basic_json__nullptr_t} - @sa basic_json() + @sa @ref basic_json() -- default constructor (implicitly creating a `null` + value) + + @since version 1.0 */ basic_json(std::nullptr_t) noexcept : basic_json(value_t::null) @@ -858,7 +902,10 @@ class basic_json @liveexample{The following code shows the constructor with an @ref object_t parameter.,basic_json__object_t} - @sa basic_json(const CompatibleObjectType&) + @sa @ref basic_json(const CompatibleObjectType&) -- create an object value + from a compatible STL container + + @since version 1.0 */ basic_json(const object_t& value) : m_type(value_t::object), m_value(value) @@ -883,7 +930,9 @@ class basic_json @liveexample{The following code shows the constructor with several compatible object type parameters.,basic_json__CompatibleObjectType} - @sa basic_json(const object_t&) + @sa @ref basic_json(const object_t&) -- create an object value + + @since version 1.0 */ template ) - create a JSON - array value from an initializer list - @sa basic_json object(std::initializer_list) - create a JSON - object value from an initializer list + @sa @ref array(std::initializer_list) - create a JSON array + value from an initializer list + @sa @ref object(std::initializer_list) - create a JSON object + value from an initializer list + + @since version 1.0 */ basic_json(std::initializer_list init, bool type_deduction = true, @@ -1343,10 +1433,12 @@ class basic_json @liveexample{The following code shows an example for the @ref array function.,array} - @sa basic_json(std::initializer_list, bool, value_t) - create a - JSON value from an initializer list - @sa basic_json object(std::initializer_list) - create a JSON - object value from an initializer list + @sa @ref basic_json(std::initializer_list, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref object(std::initializer_list) -- create a JSON object + value from an initializer list + + @since version 1.0 */ static basic_json array(std::initializer_list init = std::initializer_list()) @@ -1362,29 +1454,31 @@ class basic_json the initializer list is empty, the empty object `{}` is created. @note This function is only added for symmetry reasons. In contrast to the - related function @ref basic_json array(std::initializer_list), - there are no cases which can only be expressed by this function. That is, - any initializer list @a init can also be passed to the initializer list - constructor @ref basic_json(std::initializer_list, bool, - value_t). + related function @ref array(std::initializer_list), there are + no cases which can only be expressed by this function. That is, any + initializer list @a init can also be passed to the initializer list + constructor + @ref basic_json(std::initializer_list, bool, value_t). @param[in] init initializer list to create an object from (optional) @return JSON object value @throw std::domain_error if @a init is not a pair whose first elements are - strings; thrown by @ref basic_json(std::initializer_list, bool, - value_t) + strings; thrown by + @ref basic_json(std::initializer_list, bool, value_t) @complexity Linear in the size of @a init. @liveexample{The following code shows an example for the @ref object function.,object} - @sa basic_json(std::initializer_list, bool, value_t) - create a - JSON value from an initializer list - @sa basic_json array(std::initializer_list) - create a JSON - array value from an initializer list + @sa @ref basic_json(std::initializer_list, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref array(std::initializer_list) -- create a JSON array + value from an initializer list + + @since version 1.0 */ static basic_json object(std::initializer_list init = std::initializer_list()) @@ -1407,6 +1501,8 @@ class basic_json @liveexample{The following code shows examples for the @ref basic_json(size_type\, const basic_json&) constructor.,basic_json__size_type_basic_json} + + @since version 1.0 */ basic_json(size_type count, const basic_json& value) : m_type(value_t::array) @@ -1443,6 +1539,8 @@ class basic_json @liveexample{The example below shows several ways to create JSON values by specifying a subrange with iterators.,basic_json__InputIt_InputIt} + + @since version 1.0 */ template