Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
95b73bcd
Commit
95b73bcd
authored
Aug 13, 2021
by
Ferry Huberts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forgot to amalgate
Signed-off-by:
Ferry Huberts
<
ferry.huberts@pelagic.nl
>
parent
e7a69b8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
154 additions
and
0 deletions
+154
-0
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+154
-0
No files found.
single_include/nlohmann/json.hpp
View file @
95b73bcd
...
@@ -2697,6 +2697,14 @@ class exception : public std::exception
...
@@ -2697,6 +2697,14 @@ class exception : public std::exception
break;
break;
}
}
case value_t::null:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
break; // LCOV_EXCL_LINE
break; // LCOV_EXCL_LINE
}
}
...
@@ -8377,6 +8385,7 @@ class binary_reader
...
@@ -8377,6 +8385,7 @@ class binary_reader
result = parse_ubjson_internal();
result = parse_ubjson_internal();
break;
break;
case input_format_t::json:
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
}
}
...
@@ -10494,6 +10503,20 @@ class binary_reader
...
@@ -10494,6 +10503,20 @@ class binary_reader
return sax->number_unsigned(number_lexer.get_number_unsigned());
return sax->number_unsigned(number_lexer.get_number_unsigned());
case token_type::value_float:
case token_type::value_float:
return sax->number_float(number_lexer.get_number_float(), std::move(number_string));
return sax->number_float(number_lexer.get_number_float(), std::move(number_string));
case token_type::uninitialized:
case token_type::literal_true:
case token_type::literal_false:
case token_type::literal_null:
case token_type::value_string:
case token_type::begin_array:
case token_type::begin_object:
case token_type::end_array:
case token_type::end_object:
case token_type::name_separator:
case token_type::value_separator:
case token_type::parse_error:
case token_type::end_of_input:
case token_type::literal_or_value:
default:
default:
return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format_t::ubjson, "invalid number text: " + number_lexer.get_token_string(), "high-precision number"), BasicJsonType()));
return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format_t::ubjson, "invalid number text: " + number_lexer.get_token_string(), "high-precision number"), BasicJsonType()));
}
}
...
@@ -10696,6 +10719,7 @@ class binary_reader
...
@@ -10696,6 +10719,7 @@ class binary_reader
error_msg += "BSON";
error_msg += "BSON";
break;
break;
case input_format_t::json:
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
}
}
...
@@ -11828,6 +11852,7 @@ class iter_impl
...
@@ -11828,6 +11852,7 @@ class iter_impl
break;
break;
}
}
case value_t::null:
case value_t::string:
case value_t::string:
case value_t::boolean:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_integer:
...
@@ -11913,6 +11938,14 @@ class iter_impl
...
@@ -11913,6 +11938,14 @@ class iter_impl
case value_t::array:
case value_t::array:
return (m_it.array_iterator < other.m_it.array_iterator);
return (m_it.array_iterator < other.m_it.array_iterator);
case value_t::null:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
return (m_it.primitive_iterator < other.m_it.primitive_iterator);
return (m_it.primitive_iterator < other.m_it.primitive_iterator);
}
}
...
@@ -11964,6 +11997,14 @@ class iter_impl
...
@@ -11964,6 +11997,14 @@ class iter_impl
break;
break;
}
}
case value_t::null:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
{
{
m_it.primitive_iterator += i;
m_it.primitive_iterator += i;
...
@@ -12032,6 +12073,14 @@ class iter_impl
...
@@ -12032,6 +12073,14 @@ class iter_impl
case value_t::array:
case value_t::array:
return m_it.array_iterator - other.m_it.array_iterator;
return m_it.array_iterator - other.m_it.array_iterator;
case value_t::null:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
return m_it.primitive_iterator - other.m_it.primitive_iterator;
return m_it.primitive_iterator - other.m_it.primitive_iterator;
}
}
...
@@ -12056,6 +12105,13 @@ class iter_impl
...
@@ -12056,6 +12105,13 @@ class iter_impl
case value_t::null:
case value_t::null:
JSON_THROW(invalid_iterator::create(214, "cannot get value", *m_object));
JSON_THROW(invalid_iterator::create(214, "cannot get value", *m_object));
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
{
{
if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))
if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))
...
@@ -12675,6 +12731,13 @@ class json_pointer
...
@@ -12675,6 +12731,13 @@ class json_pointer
an error situation, because primitive values may only occur as
an error situation, because primitive values may only occur as
single value; that is, with an empty list of reference tokens.
single value; that is, with an empty list of reference tokens.
*/
*/
case detail::value_t::string:
case detail::value_t::boolean:
case detail::value_t::number_integer:
case detail::value_t::number_unsigned:
case detail::value_t::number_float:
case detail::value_t::binary:
case detail::value_t::discarded:
default:
default:
JSON_THROW(detail::type_error::create(313, "invalid value to unflatten", j));
JSON_THROW(detail::type_error::create(313, "invalid value to unflatten", j));
}
}
...
@@ -12747,6 +12810,14 @@ class json_pointer
...
@@ -12747,6 +12810,14 @@ class json_pointer
break;
break;
}
}
case detail::value_t::null:
case detail::value_t::string:
case detail::value_t::boolean:
case detail::value_t::number_integer:
case detail::value_t::number_unsigned:
case detail::value_t::number_float:
case detail::value_t::binary:
case detail::value_t::discarded:
default:
default:
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
}
}
...
@@ -12844,6 +12915,14 @@ class json_pointer
...
@@ -12844,6 +12915,14 @@ class json_pointer
break;
break;
}
}
case detail::value_t::null:
case detail::value_t::string:
case detail::value_t::boolean:
case detail::value_t::number_integer:
case detail::value_t::number_unsigned:
case detail::value_t::number_float:
case detail::value_t::binary:
case detail::value_t::discarded:
default:
default:
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
}
}
...
@@ -12886,6 +12965,14 @@ class json_pointer
...
@@ -12886,6 +12965,14 @@ class json_pointer
break;
break;
}
}
case detail::value_t::null:
case detail::value_t::string:
case detail::value_t::boolean:
case detail::value_t::number_integer:
case detail::value_t::number_unsigned:
case detail::value_t::number_float:
case detail::value_t::binary:
case detail::value_t::discarded:
default:
default:
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'", *ptr));
}
}
...
@@ -13097,6 +13184,14 @@ class json_pointer
...
@@ -13097,6 +13184,14 @@ class json_pointer
break;
break;
}
}
case detail::value_t::null:
case detail::value_t::string:
case detail::value_t::boolean:
case detail::value_t::number_integer:
case detail::value_t::number_unsigned:
case detail::value_t::number_float:
case detail::value_t::binary:
case detail::value_t::discarded:
default:
default:
{
{
// add primitive value with its reference string
// add primitive value with its reference string
...
@@ -13462,6 +13557,15 @@ class binary_writer
...
@@ -13462,6 +13557,15 @@ class binary_writer
break;
break;
}
}
case value_t::null:
case value_t::array:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
{
{
JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));;
JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()), j));;
...
@@ -13769,6 +13873,7 @@ class binary_writer
...
@@ -13769,6 +13873,7 @@ class binary_writer
break;
break;
}
}
case value_t::discarded:
default:
default:
break;
break;
}
}
...
@@ -14090,6 +14195,7 @@ class binary_writer
...
@@ -14090,6 +14195,7 @@ class binary_writer
break;
break;
}
}
case value_t::discarded:
default:
default:
break;
break;
}
}
...
@@ -14294,6 +14400,7 @@ class binary_writer
...
@@ -14294,6 +14400,7 @@ class binary_writer
break;
break;
}
}
case value_t::discarded:
default:
default:
break;
break;
}
}
...
@@ -14546,6 +14653,7 @@ class binary_writer
...
@@ -14546,6 +14653,7 @@ class binary_writer
return header_size + 0ul;
return header_size + 0ul;
// LCOV_EXCL_START
// LCOV_EXCL_START
case value_t::discarded:
default:
default:
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
return 0ul;
return 0ul;
...
@@ -14592,6 +14700,7 @@ class binary_writer
...
@@ -14592,6 +14700,7 @@ class binary_writer
return write_bson_null(name);
return write_bson_null(name);
// LCOV_EXCL_START
// LCOV_EXCL_START
case value_t::discarded:
default:
default:
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
return;
return;
...
@@ -14882,6 +14991,7 @@ class binary_writer
...
@@ -14882,6 +14991,7 @@ class binary_writer
case value_t::object:
case value_t::object:
return '{';
return '{';
case value_t::discarded:
default: // discarded values
default: // discarded values
return 'N';
return 'N';
}
}
...
@@ -18499,6 +18609,14 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -18499,6 +18609,14 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case value_t::null:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
break;
break;
}
}
...
@@ -19263,6 +19381,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -19263,6 +19381,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case value_t::null:
case value_t::object:
case value_t::array:
case value_t::binary:
case value_t::discarded:
default:
default:
break;
break;
}
}
...
@@ -19319,6 +19442,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -19319,6 +19442,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case value_t::null:
case value_t::discarded:
default:
default:
JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " + std::string(first.m_object->type_name()), *first.m_object));
JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " + std::string(first.m_object->type_name()), *first.m_object));
}
}
...
@@ -21562,6 +21687,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -21562,6 +21687,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case value_t::null:
case value_t::discarded:
default:
default:
JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()), *this));
JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name()), *this));
}
}
...
@@ -22317,6 +22444,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -22317,6 +22444,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
return m_value.object->empty();
return m_value.object->empty();
}
}
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
{
{
// all other types are nonempty
// all other types are nonempty
...
@@ -22577,6 +22711,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -22577,6 +22711,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case value_t::null:
case value_t::discarded:
default:
default:
break;
break;
}
}
...
@@ -23547,6 +23683,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -23547,6 +23683,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
case value_t::binary:
case value_t::binary:
return *lhs.m_value.binary == *rhs.m_value.binary;
return *lhs.m_value.binary == *rhs.m_value.binary;
case value_t::discarded:
default:
default:
return false;
return false;
}
}
...
@@ -23713,6 +23850,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -23713,6 +23850,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
case value_t::binary:
case value_t::binary:
return (*lhs.m_value.binary) < (*rhs.m_value.binary);
return (*lhs.m_value.binary) < (*rhs.m_value.binary);
case value_t::discarded:
default:
default:
return false;
return false;
}
}
...
@@ -25673,6 +25811,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -25673,6 +25811,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}
}
// if there exists a parent it cannot be primitive
// if there exists a parent it cannot be primitive
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
}
}
...
@@ -25832,6 +25977,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -25832,6 +25977,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case patch_operations::invalid:
default:
default:
{
{
// op must be "add", "remove", "replace", "move", "copy", or
// op must be "add", "remove", "replace", "move", "copy", or
...
@@ -25988,6 +26134,14 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
...
@@ -25988,6 +26134,14 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
break;
break;
}
}
case value_t::null:
case value_t::string:
case value_t::boolean:
case value_t::number_integer:
case value_t::number_unsigned:
case value_t::number_float:
case value_t::binary:
case value_t::discarded:
default:
default:
{
{
// both primitive type: replace value
// both primitive type: replace value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment