23class deserialize_options;
29 public std::runtime_error
35 explicit parse_error(
const char* message, std::optional<std::size_t> character)
noexcept;
46 std::optional<std::size_t> _character;
60 using size_type = value::size_type;
85 static constexpr size_type max_structure_depth = 128;
153 encoding _string_encoding = encoding::utf8;
154 std::optional<size_type> _max_struct_depth = std::nullopt;
155 bool _require_document =
false;
156 bool _comments =
false;
Configuration for various deserialization options. This becomes part of the deserialization_context.
An error encountered when parsing.
parse_error(const char *message) noexcept
Create an error with the given message and optional character location.
parse_error(const char *message, std::optional< std::size_t > character) noexcept
Create an error with the given message and optional character location.
Configuration for various parsing options.
encoding string_encoding() const
The output encoding for multi-byte characters in strings. The default value is encoding::utf8.
bool require_document() const
If set to true, the result of a parse is required to have kind of kind::object or kind::array.
static parse_options create_strict()
Create a strict parser.
bool comments() const
Are JSON comments allowed? While there is no official syntax for JSON comments, this uses the de-fact...
parse_options & max_structure_depth(std::optional< size_type > depth)
The maximum allowed nesting depth of any structure in the JSON document.
parse_options & comments(bool)
Are JSON comments allowed? While there is no official syntax for JSON comments, this uses the de-fact...
std::optional< size_type > max_structure_depth() const
The maximum allowed nesting depth of any structure in the JSON document.
parse_options()
Create an instance with the default options.
static parse_options create_default()
Create a parser with the default options – this is the same result as the default constructor,...
parse_options & string_encoding(encoding)
The output encoding for multi-byte characters in strings. The default value is encoding::utf8.
encoding
The encoding format for strings.
parse_options & require_document(bool)
If set to true, the result of a parse is required to have kind of kind::object or kind::array.
Represents a single JSON value, which can be any one of a potential kind, each behaving slightly diff...
Copyright (c) 2014-2020 by Travis Gockel.
#define JSONV_NODISCARD
Warn if the caller discards the result of this function.
#define JSONV_PUBLIC
This function or class is part of the public API for JSON Voorhees.
JSONV_PUBLIC std::string to_string(const ast_node_type &type)
Get what operator<< writes for type as a std::string.
typename detail::optional_type< T >::type optional
Represents a value that may or may not be present.
JSONV_PUBLIC value parse(std::string_view input, const parse_options &parse_options, const deserialize_options &deserialize_options)
Construct a JSON value from the given input.
Copyright (c) 2012-2020 by Travis Gockel.