From f8158997b5430d002b8bd3ae493a630a1b822145 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 7 Oct 2018 21:30:58 +0200 Subject: [PATCH] :memo: fixed documentation --- doc/examples/json_pointer.output | 2 +- doc/examples/parse_error.output | 2 +- include/nlohmann/detail/input/json_sax.hpp | 2 +- include/nlohmann/json.hpp | 33 ++++++++++---------- single_include/nlohmann/json.hpp | 35 +++++++++++----------- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/doc/examples/json_pointer.output b/doc/examples/json_pointer.output index 33e2cc683..9e027d6dc 100644 --- a/doc/examples/json_pointer.output +++ b/doc/examples/json_pointer.output @@ -1,3 +1,3 @@ -[json.exception.parse_error.107] parse error at 1: JSON pointer must be empty or begin with '/' - was: 'foo' +[json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'foo' [json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1' [json.exception.parse_error.108] parse error: escape character '~' must be followed with '0' or '1' diff --git a/doc/examples/parse_error.output b/doc/examples/parse_error.output index 96ab5bb51..7ceb2e803 100644 --- a/doc/examples/parse_error.output +++ b/doc/examples/parse_error.output @@ -1,3 +1,3 @@ -message: [json.exception.parse_error.101] parse error at 8: syntax error - unexpected ']'; expected '[', '{', or a literal +message: [json.exception.parse_error.101] parse error at line 1, column 8: syntax error - unexpected ']'; expected '[', '{', or a literal exception id: 101 byte position of error: 8 diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 1705a8611..198ba70bf 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -113,7 +113,7 @@ struct json_sax @brief a parse error occurred @param[in] position the position in the input where the error occurs @param[in] last_token the last read token - @param[in] error_msg a detailed error message + @param[in] ex an exception object describing the error @return whether parsing should proceed (must return false) */ virtual bool parse_error(std::size_t position, diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 52c301cf7..0711bebab 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -5999,6 +5999,8 @@ class basic_json @param[in] cb a parser callback function of type @ref parser_callback_t which is used to control the deserialization by filtering unwanted values (optional) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) @return result of the deserialization @@ -6394,7 +6396,7 @@ class basic_json vector in CBOR format.,to_cbor} @sa http://cbor.io - @sa @ref from_cbor(detail::input_adapter, const bool strict) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the analogous deserialization @sa @ref to_msgpack(const basic_json&) for the related MessagePack format @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the @@ -6491,8 +6493,7 @@ class basic_json vector in MessagePack format.,to_msgpack} @sa http://msgpack.org - @sa @ref from_msgpack(const std::vector&, const size_t) for the - analogous deserialization + @sa @ref from_msgpack for the analogous deserialization @sa @ref to_cbor(const basic_json& for the related CBOR format @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format @@ -6589,7 +6590,7 @@ class basic_json vector in UBJSON format.,to_ubjson} @sa http://ubjson.org - @sa @ref from_ubjson(detail::input_adapter, const bool strict) for the + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the analogous deserialization @sa @ref to_cbor(const basic_json& for the related CBOR format @sa @ref to_msgpack(const basic_json&) for the related MessagePack format @@ -6704,14 +6705,14 @@ class basic_json @sa http://cbor.io @sa @ref to_cbor(const basic_json&) for the analogous serialization - @sa @ref from_msgpack(detail::input_adapter, const bool, const bool) for the + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @sa @ref from_ubjson(detail::input_adapter, const bool, const bool) for the + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added - @a strict parameter since 3.0.0; added @allow_exceptions parameter + @a strict parameter since 3.0.0; added @a allow_exceptions parameter since 3.2.0 */ static basic_json from_cbor(detail::input_adapter&& i, @@ -6725,7 +6726,7 @@ class basic_json } /*! - @copydoc from_cbor(detail::input_adapter, const bool, const bool) + @copydoc from_cbor(detail::input_adapter&&, const bool, const bool) */ template::value, int> = 0> @@ -6807,14 +6808,14 @@ class basic_json @sa http://msgpack.org @sa @ref to_msgpack(const basic_json&) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter, const bool, const bool) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the related CBOR format - @sa @ref from_ubjson(detail::input_adapter, const bool, const bool) for + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added - @a strict parameter since 3.0.0; added @allow_exceptions parameter + @a strict parameter since 3.0.0; added @a allow_exceptions parameter since 3.2.0 */ static basic_json from_msgpack(detail::input_adapter&& i, @@ -6828,7 +6829,7 @@ class basic_json } /*! - @copydoc from_msgpack(detail::input_adapter, const bool, const bool) + @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool) */ template::value, int> = 0> @@ -6892,12 +6893,12 @@ class basic_json @sa http://ubjson.org @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter, const bool, const bool) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the related CBOR format - @sa @ref from_msgpack(detail::input_adapter, const bool, const bool) for + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @since version 3.1.0; added @allow_exceptions parameter since 3.2.0 + @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0 */ static basic_json from_ubjson(detail::input_adapter&& i, const bool strict = true, @@ -6910,7 +6911,7 @@ class basic_json } /*! - @copydoc from_ubjson(detail::input_adapter, const bool, const bool) + @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool) */ template::value, int> = 0> diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e551784a1..e4b9a0c80 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4103,7 +4103,7 @@ struct json_sax @brief a parse error occurred @param[in] position the position in the input where the error occurs @param[in] last_token the last read token - @param[in] error_msg a detailed error message + @param[in] ex an exception object describing the error @return whether parsing should proceed (must return false) */ virtual bool parse_error(std::size_t position, @@ -17319,6 +17319,8 @@ class basic_json @param[in] cb a parser callback function of type @ref parser_callback_t which is used to control the deserialization by filtering unwanted values (optional) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) @return result of the deserialization @@ -17714,7 +17716,7 @@ class basic_json vector in CBOR format.,to_cbor} @sa http://cbor.io - @sa @ref from_cbor(detail::input_adapter, const bool strict) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the analogous deserialization @sa @ref to_msgpack(const basic_json&) for the related MessagePack format @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the @@ -17811,8 +17813,7 @@ class basic_json vector in MessagePack format.,to_msgpack} @sa http://msgpack.org - @sa @ref from_msgpack(const std::vector&, const size_t) for the - analogous deserialization + @sa @ref from_msgpack for the analogous deserialization @sa @ref to_cbor(const basic_json& for the related CBOR format @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format @@ -17909,7 +17910,7 @@ class basic_json vector in UBJSON format.,to_ubjson} @sa http://ubjson.org - @sa @ref from_ubjson(detail::input_adapter, const bool strict) for the + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the analogous deserialization @sa @ref to_cbor(const basic_json& for the related CBOR format @sa @ref to_msgpack(const basic_json&) for the related MessagePack format @@ -18024,14 +18025,14 @@ class basic_json @sa http://cbor.io @sa @ref to_cbor(const basic_json&) for the analogous serialization - @sa @ref from_msgpack(detail::input_adapter, const bool, const bool) for the + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @sa @ref from_ubjson(detail::input_adapter, const bool, const bool) for the + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added - @a strict parameter since 3.0.0; added @allow_exceptions parameter + @a strict parameter since 3.0.0; added @a allow_exceptions parameter since 3.2.0 */ static basic_json from_cbor(detail::input_adapter&& i, @@ -18045,7 +18046,7 @@ class basic_json } /*! - @copydoc from_cbor(detail::input_adapter, const bool, const bool) + @copydoc from_cbor(detail::input_adapter&&, const bool, const bool) */ template::value, int> = 0> @@ -18127,14 +18128,14 @@ class basic_json @sa http://msgpack.org @sa @ref to_msgpack(const basic_json&) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter, const bool, const bool) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the related CBOR format - @sa @ref from_ubjson(detail::input_adapter, const bool, const bool) for + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added - @a strict parameter since 3.0.0; added @allow_exceptions parameter + @a strict parameter since 3.0.0; added @a allow_exceptions parameter since 3.2.0 */ static basic_json from_msgpack(detail::input_adapter&& i, @@ -18148,7 +18149,7 @@ class basic_json } /*! - @copydoc from_msgpack(detail::input_adapter, const bool, const bool) + @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool) */ template::value, int> = 0> @@ -18212,12 +18213,12 @@ class basic_json @sa http://ubjson.org @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter, const bool, const bool) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the related CBOR format - @sa @ref from_msgpack(detail::input_adapter, const bool, const bool) for + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @since version 3.1.0; added @allow_exceptions parameter since 3.2.0 + @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0 */ static basic_json from_ubjson(detail::input_adapter&& i, const bool strict = true, @@ -18230,7 +18231,7 @@ class basic_json } /*! - @copydoc from_ubjson(detail::input_adapter, const bool, const bool) + @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool) */ template::value, int> = 0>