From 3cdc4d784b04db0579523ec717cb57c1601c1014 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 27 May 2018 18:07:53 +0200 Subject: [PATCH] :memo: added documentation --- include/nlohmann/detail/input/json_sax.hpp | 18 ++++++++++++++++++ single_include/nlohmann/json.hpp | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 6f3aa99c..5970afd5 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -122,6 +122,19 @@ struct json_sax namespace detail { +/*! +@brief SAX implementation to create a JSON value from SAX events + +This class implements the @ref json_sax interface and processes the SAX events +to create a JSON value which makes it basically a DOM parser. The structure or +hierarchy of the JSON value is managed by the stack `ref_stack` which contains +a pointer to the respective array or object for each recursion depth. + +After successful parsing, the value that is passed by reference to the +constructor contains the parsed value. + +@tparam BasicJsonType the JSON type +*/ template class json_sax_dom_parser : public json_sax { @@ -131,6 +144,11 @@ class json_sax_dom_parser : public json_sax using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; + /*! + @param[in, out] r reference to a JSON value that is manipulated while + parsing + @param[in] allow_exceptions_ whether parse errors yield exceptions + */ json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true) : root(r), allow_exceptions(allow_exceptions_) {} diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ca3539e3..6559d23d 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3426,6 +3426,19 @@ struct json_sax namespace detail { +/*! +@brief SAX implementation to create a JSON value from SAX events + +This class implements the @ref json_sax interface and processes the SAX events +to create a JSON value which makes it basically a DOM parser. The structure or +hierarchy of the JSON value is managed by the stack `ref_stack` which contains +a pointer to the respective array or object for each recursion depth. + +After successful parsing, the value that is passed by reference to the +constructor contains the parsed value. + +@tparam BasicJsonType the JSON type +*/ template class json_sax_dom_parser : public json_sax { @@ -3435,6 +3448,11 @@ class json_sax_dom_parser : public json_sax using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; + /*! + @param[in, out] r reference to a JSON value that is manipulated while + parsing + @param[in] allow_exceptions_ whether parse errors yield exceptions + */ json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true) : root(r), allow_exceptions(allow_exceptions_) {}