🚚 rename Hedley macros

This commit is contained in:
Niels Lohmann 2019-07-01 22:37:30 +02:00
parent 025f4cea42
commit 90798caa62
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
18 changed files with 2541 additions and 2537 deletions

View file

@ -617,9 +617,13 @@ clean:
$(MAKE) clean -Cdoc $(MAKE) clean -Cdoc
$(MAKE) clean -Ctest $(MAKE) clean -Ctest
##########################################################################
# Thirdparty code
##########################################################################
update_hedley: update_hedley:
rm -f include/nlohmann/thirdparty/hedley/hedley.hpp include/nlohmann/thirdparty/hedley/hedley_undef.hpp rm -f include/nlohmann/thirdparty/hedley/hedley.hpp include/nlohmann/thirdparty/hedley/hedley_undef.hpp
curl https://raw.githubusercontent.com/nemequ/hedley/master/hedley.h -o include/nlohmann/thirdparty/hedley/hedley.hpp curl https://raw.githubusercontent.com/nemequ/hedley/master/hedley.h -o include/nlohmann/thirdparty/hedley/hedley.hpp
gsed -i 's/HEDLEY_/NLOHMANN_JSON_HEDLEY_/g' include/nlohmann/thirdparty/hedley/hedley.hpp gsed -i 's/HEDLEY_/JSON_HEDLEY_/g' include/nlohmann/thirdparty/hedley/hedley.hpp
grep "[[:blank:]]*#[[:blank:]]*undef" include/nlohmann/thirdparty/hedley/hedley.hpp | grep -v "__" | sort | uniq | gsed 's/ //g' | gsed 's/undef/undef /g' > include/nlohmann/thirdparty/hedley/hedley_undef.hpp grep "[[:blank:]]*#[[:blank:]]*undef" include/nlohmann/thirdparty/hedley/hedley.hpp | grep -v "__" | sort | uniq | gsed 's/ //g' | gsed 's/undef/undef /g' > include/nlohmann/thirdparty/hedley/hedley_undef.hpp
$(MAKE) amalgamate $(MAKE) amalgamate

View file

@ -26,7 +26,7 @@ namespace detail
template<typename BasicJsonType> template<typename BasicJsonType>
void from_json(const BasicJsonType& j, typename std::nullptr_t& n) void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_null())) if (JSON_HEDLEY_UNLIKELY(not j.is_null()))
{ {
JSON_THROW(type_error::create(302, "type must be null, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be null, but is " + std::string(j.type_name())));
} }
@ -66,7 +66,7 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
template<typename BasicJsonType> template<typename BasicJsonType>
void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_boolean())) if (JSON_HEDLEY_UNLIKELY(not j.is_boolean()))
{ {
JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name())));
} }
@ -76,7 +76,7 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)
template<typename BasicJsonType> template<typename BasicJsonType>
void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_string())) if (JSON_HEDLEY_UNLIKELY(not j.is_string()))
{ {
JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
} }
@ -92,7 +92,7 @@ template <
int > = 0 > int > = 0 >
void from_json(const BasicJsonType& j, ConstructibleStringType& s) void from_json(const BasicJsonType& j, ConstructibleStringType& s)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_string())) if (JSON_HEDLEY_UNLIKELY(not j.is_string()))
{ {
JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
} }
@ -132,7 +132,7 @@ template<typename BasicJsonType, typename T, typename Allocator,
enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0> enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l) void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_array())) if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
} }
@ -149,7 +149,7 @@ template<typename BasicJsonType, typename T,
enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0> enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
void from_json(const BasicJsonType& j, std::valarray<T>& l) void from_json(const BasicJsonType& j, std::valarray<T>& l)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_array())) if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
} }
@ -236,7 +236,7 @@ auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
j.template get<typename ConstructibleArrayType::value_type>(), j.template get<typename ConstructibleArrayType::value_type>(),
void()) void())
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_array())) if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + JSON_THROW(type_error::create(302, "type must be array, but is " +
std::string(j.type_name()))); std::string(j.type_name())));
@ -249,7 +249,7 @@ template<typename BasicJsonType, typename ConstructibleObjectType,
enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0> enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0>
void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_object())) if (JSON_HEDLEY_UNLIKELY(not j.is_object()))
{ {
JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name())));
} }
@ -332,14 +332,14 @@ template <typename BasicJsonType, typename Key, typename Value, typename Compare
typename BasicJsonType::string_t, Key>::value>> typename BasicJsonType::string_t, Key>::value>>
void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m) void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_array())) if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
} }
m.clear(); m.clear();
for (const auto& p : j) for (const auto& p : j)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not p.is_array())) if (JSON_HEDLEY_UNLIKELY(not p.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name()))); JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
} }
@ -352,14 +352,14 @@ template <typename BasicJsonType, typename Key, typename Value, typename Hash, t
typename BasicJsonType::string_t, Key>::value>> typename BasicJsonType::string_t, Key>::value>>
void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m) void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_array())) if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()))); JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
} }
m.clear(); m.clear();
for (const auto& p : j) for (const auto& p : j)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not p.is_array())) if (JSON_HEDLEY_UNLIKELY(not p.is_array()))
{ {
JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name()))); JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
} }

View file

@ -819,7 +819,7 @@ v = buf * 10^decimal_exponent
len is the length of the buffer (number of decimal digits) len is the length of the buffer (number of decimal digits)
The buffer must be large enough, i.e. >= max_digits10. The buffer must be large enough, i.e. >= max_digits10.
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline void grisu2(char* buf, int& len, int& decimal_exponent, inline void grisu2(char* buf, int& len, int& decimal_exponent,
diyfp m_minus, diyfp v, diyfp m_plus) diyfp m_minus, diyfp v, diyfp m_plus)
{ {
@ -879,7 +879,7 @@ len is the length of the buffer (number of decimal digits)
The buffer must be large enough, i.e. >= max_digits10. The buffer must be large enough, i.e. >= max_digits10.
*/ */
template <typename FloatType> template <typename FloatType>
NLOHMANN_JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value) void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
{ {
static_assert(diyfp::kPrecision >= std::numeric_limits<FloatType>::digits + 3, static_assert(diyfp::kPrecision >= std::numeric_limits<FloatType>::digits + 3,
@ -918,8 +918,8 @@ void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
@return a pointer to the element following the exponent. @return a pointer to the element following the exponent.
@pre -1000 < e < 1000 @pre -1000 < e < 1000
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
inline char* append_exponent(char* buf, int e) inline char* append_exponent(char* buf, int e)
{ {
assert(e > -1000); assert(e > -1000);
@ -970,8 +970,8 @@ notation. Otherwise it will be printed in exponential notation.
@pre min_exp < 0 @pre min_exp < 0
@pre max_exp > 0 @pre max_exp > 0
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
inline char* format_buffer(char* buf, int len, int decimal_exponent, inline char* format_buffer(char* buf, int len, int decimal_exponent,
int min_exp, int max_exp) int min_exp, int max_exp)
{ {
@ -1055,8 +1055,8 @@ format. Returns an iterator pointing past-the-end of the decimal representation.
@note The result is NOT null-terminated. @note The result is NOT null-terminated.
*/ */
template <typename FloatType> template <typename FloatType>
NLOHMANN_JSON_HEDLEY_NON_NULL(1, 2) JSON_HEDLEY_NON_NULL(1, 2)
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
char* to_chars(char* first, const char* last, FloatType value) char* to_chars(char* first, const char* last, FloatType value)
{ {
static_cast<void>(last); // maybe unused - fix warning static_cast<void>(last); // maybe unused - fix warning

View file

@ -47,7 +47,7 @@ class exception : public std::exception
{ {
public: public:
/// returns the explanatory string /// returns the explanatory string
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
const char* what() const noexcept override const char* what() const noexcept override
{ {
return m.what(); return m.what();
@ -57,7 +57,7 @@ class exception : public std::exception
const int id; const int id;
protected: protected:
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} exception(int id_, const char* what_arg) : id(id_), m(what_arg) {}
static std::string name(const std::string& ename, int id_) static std::string name(const std::string& ename, int id_)
@ -210,7 +210,7 @@ class invalid_iterator : public exception
} }
private: private:
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
invalid_iterator(int id_, const char* what_arg) invalid_iterator(int id_, const char* what_arg)
: exception(id_, what_arg) {} : exception(id_, what_arg) {}
}; };
@ -264,7 +264,7 @@ class type_error : public exception
} }
private: private:
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} type_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
}; };
@ -311,7 +311,7 @@ class out_of_range : public exception
} }
private: private:
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {}
}; };
@ -349,7 +349,7 @@ class other_error : public exception
} }
private: private:
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} other_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
}; };
} // namespace detail } // namespace detail

View file

@ -66,7 +66,7 @@ class binary_reader
@return @return
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
bool sax_parse(const input_format_t format, bool sax_parse(const input_format_t format,
json_sax_t* sax_, json_sax_t* sax_,
const bool strict = true) const bool strict = true)
@ -108,7 +108,7 @@ class binary_reader
get(); get();
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(current != std::char_traits<char>::eof())) if (JSON_HEDLEY_UNLIKELY(current != std::char_traits<char>::eof()))
{ {
return sax->parse_error(chars_read, get_token_string(), return sax->parse_error(chars_read, get_token_string(),
parse_error::create(110, chars_read, exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), "value"))); parse_error::create(110, chars_read, exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), "value")));
@ -144,12 +144,12 @@ class binary_reader
std::int32_t document_size; std::int32_t document_size;
get_number<std::int32_t, true>(input_format_t::bson, document_size); get_number<std::int32_t, true>(input_format_t::bson, document_size);
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1)))) if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1))))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_bson_element_list(/*is_array*/false))) if (JSON_HEDLEY_UNLIKELY(not parse_bson_element_list(/*is_array*/false)))
{ {
return false; return false;
} }
@ -170,7 +170,7 @@ class binary_reader
while (true) while (true)
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::bson, "cstring"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::bson, "cstring")))
{ {
return false; return false;
} }
@ -198,7 +198,7 @@ class binary_reader
template<typename NumberType> template<typename NumberType>
bool get_bson_string(const NumberType len, string_t& result) bool get_bson_string(const NumberType len, string_t& result)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(len < 1)) if (JSON_HEDLEY_UNLIKELY(len < 1))
{ {
auto last_token = get_token_string(); auto last_token = get_token_string();
return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string"))); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string")));
@ -293,13 +293,13 @@ class binary_reader
string_t key; string_t key;
while (int element_type = get()) while (int element_type = get())
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::bson, "element list"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::bson, "element list")))
{ {
return false; return false;
} }
const std::size_t element_type_parse_position = chars_read; const std::size_t element_type_parse_position = chars_read;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_bson_cstr(key))) if (JSON_HEDLEY_UNLIKELY(not get_bson_cstr(key)))
{ {
return false; return false;
} }
@ -309,7 +309,7 @@ class binary_reader
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position))) if (JSON_HEDLEY_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
{ {
return false; return false;
} }
@ -330,12 +330,12 @@ class binary_reader
std::int32_t document_size; std::int32_t document_size;
get_number<std::int32_t, true>(input_format_t::bson, document_size); get_number<std::int32_t, true>(input_format_t::bson, document_size);
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1)))) if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1))))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_bson_element_list(/*is_array*/true))) if (JSON_HEDLEY_UNLIKELY(not parse_bson_element_list(/*is_array*/true)))
{ {
return false; return false;
} }
@ -620,12 +620,12 @@ class binary_reader
case 0xF9: // Half-Precision Float (two-byte IEEE 754) case 0xF9: // Half-Precision Float (two-byte IEEE 754)
{ {
const int byte1_raw = get(); const int byte1_raw = get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number")))
{ {
return false; return false;
} }
const int byte2_raw = get(); const int byte2_raw = get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number")))
{ {
return false; return false;
} }
@ -698,7 +698,7 @@ class binary_reader
*/ */
bool get_cbor_string(string_t& result) bool get_cbor_string(string_t& result)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "string"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "string")))
{ {
return false; return false;
} }
@ -787,7 +787,7 @@ class binary_reader
*/ */
bool get_cbor_array(const std::size_t len) bool get_cbor_array(const std::size_t len)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_array(len))) if (JSON_HEDLEY_UNLIKELY(not sax->start_array(len)))
{ {
return false; return false;
} }
@ -796,7 +796,7 @@ class binary_reader
{ {
for (std::size_t i = 0; i < len; ++i) for (std::size_t i = 0; i < len; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_cbor_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal()))
{ {
return false; return false;
} }
@ -806,7 +806,7 @@ class binary_reader
{ {
while (get() != 0xFF) while (get() != 0xFF)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_cbor_internal(false))) if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal(false)))
{ {
return false; return false;
} }
@ -823,7 +823,7 @@ class binary_reader
*/ */
bool get_cbor_object(const std::size_t len) bool get_cbor_object(const std::size_t len)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_object(len))) if (JSON_HEDLEY_UNLIKELY(not sax->start_object(len)))
{ {
return false; return false;
} }
@ -834,12 +834,12 @@ class binary_reader
for (std::size_t i = 0; i < len; ++i) for (std::size_t i = 0; i < len; ++i)
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key))) if (JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key)))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_cbor_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal()))
{ {
return false; return false;
} }
@ -850,12 +850,12 @@ class binary_reader
{ {
while (get() != 0xFF) while (get() != 0xFF)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key))) if (JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key)))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_cbor_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal()))
{ {
return false; return false;
} }
@ -1244,7 +1244,7 @@ class binary_reader
*/ */
bool get_msgpack_string(string_t& result) bool get_msgpack_string(string_t& result)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::msgpack, "string"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::msgpack, "string")))
{ {
return false; return false;
} }
@ -1320,14 +1320,14 @@ class binary_reader
*/ */
bool get_msgpack_array(const std::size_t len) bool get_msgpack_array(const std::size_t len)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_array(len))) if (JSON_HEDLEY_UNLIKELY(not sax->start_array(len)))
{ {
return false; return false;
} }
for (std::size_t i = 0; i < len; ++i) for (std::size_t i = 0; i < len; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_msgpack_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_msgpack_internal()))
{ {
return false; return false;
} }
@ -1342,7 +1342,7 @@ class binary_reader
*/ */
bool get_msgpack_object(const std::size_t len) bool get_msgpack_object(const std::size_t len)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_object(len))) if (JSON_HEDLEY_UNLIKELY(not sax->start_object(len)))
{ {
return false; return false;
} }
@ -1351,12 +1351,12 @@ class binary_reader
for (std::size_t i = 0; i < len; ++i) for (std::size_t i = 0; i < len; ++i)
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_msgpack_string(key) or not sax->key(key))) if (JSON_HEDLEY_UNLIKELY(not get_msgpack_string(key) or not sax->key(key)))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_msgpack_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_msgpack_internal()))
{ {
return false; return false;
} }
@ -1403,7 +1403,7 @@ class binary_reader
get(); // TODO(niels): may we ignore N here? get(); // TODO(niels): may we ignore N here?
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value")))
{ {
return false; return false;
} }
@ -1457,7 +1457,7 @@ class binary_reader
case 'U': case 'U':
{ {
std::uint8_t number; std::uint8_t number;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number))) if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
{ {
return false; return false;
} }
@ -1468,7 +1468,7 @@ class binary_reader
case 'i': case 'i':
{ {
std::int8_t number; std::int8_t number;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number))) if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
{ {
return false; return false;
} }
@ -1479,7 +1479,7 @@ class binary_reader
case 'I': case 'I':
{ {
std::int16_t number; std::int16_t number;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number))) if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
{ {
return false; return false;
} }
@ -1490,7 +1490,7 @@ class binary_reader
case 'l': case 'l':
{ {
std::int32_t number; std::int32_t number;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number))) if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
{ {
return false; return false;
} }
@ -1501,7 +1501,7 @@ class binary_reader
case 'L': case 'L':
{ {
std::int64_t number; std::int64_t number;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number))) if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
{ {
return false; return false;
} }
@ -1537,15 +1537,15 @@ class binary_reader
if (current == '$') if (current == '$')
{ {
result.second = get(); // must not ignore 'N', because 'N' maybe the type result.second = get(); // must not ignore 'N', because 'N' maybe the type
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "type"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "type")))
{ {
return false; return false;
} }
get_ignore_noop(); get_ignore_noop();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(current != '#')) if (JSON_HEDLEY_UNLIKELY(current != '#'))
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value")))
{ {
return false; return false;
} }
@ -1628,11 +1628,11 @@ class binary_reader
case 'C': // char case 'C': // char
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "char"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "char")))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(current > 127)) if (JSON_HEDLEY_UNLIKELY(current > 127))
{ {
auto last_token = get_token_string(); auto last_token = get_token_string();
return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token, "char"))); return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token, "char")));
@ -1667,14 +1667,14 @@ class binary_reader
bool get_ubjson_array() bool get_ubjson_array()
{ {
std::pair<std::size_t, int> size_and_type; std::pair<std::size_t, int> size_and_type;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_size_type(size_and_type))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_size_type(size_and_type)))
{ {
return false; return false;
} }
if (size_and_type.first != string_t::npos) if (size_and_type.first != string_t::npos)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_array(size_and_type.first))) if (JSON_HEDLEY_UNLIKELY(not sax->start_array(size_and_type.first)))
{ {
return false; return false;
} }
@ -1685,7 +1685,7 @@ class binary_reader
{ {
for (std::size_t i = 0; i < size_and_type.first; ++i) for (std::size_t i = 0; i < size_and_type.first; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_value(size_and_type.second))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_value(size_and_type.second)))
{ {
return false; return false;
} }
@ -1696,7 +1696,7 @@ class binary_reader
{ {
for (std::size_t i = 0; i < size_and_type.first; ++i) for (std::size_t i = 0; i < size_and_type.first; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal()))
{ {
return false; return false;
} }
@ -1705,14 +1705,14 @@ class binary_reader
} }
else else
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1)))) if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1))))
{ {
return false; return false;
} }
while (current != ']') while (current != ']')
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal(false))) if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal(false)))
{ {
return false; return false;
} }
@ -1729,7 +1729,7 @@ class binary_reader
bool get_ubjson_object() bool get_ubjson_object()
{ {
std::pair<std::size_t, int> size_and_type; std::pair<std::size_t, int> size_and_type;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_size_type(size_and_type))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_size_type(size_and_type)))
{ {
return false; return false;
} }
@ -1737,7 +1737,7 @@ class binary_reader
string_t key; string_t key;
if (size_and_type.first != string_t::npos) if (size_and_type.first != string_t::npos)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_object(size_and_type.first))) if (JSON_HEDLEY_UNLIKELY(not sax->start_object(size_and_type.first)))
{ {
return false; return false;
} }
@ -1746,11 +1746,11 @@ class binary_reader
{ {
for (std::size_t i = 0; i < size_and_type.first; ++i) for (std::size_t i = 0; i < size_and_type.first; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key) or not sax->key(key))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key) or not sax->key(key)))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_value(size_and_type.second))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_value(size_and_type.second)))
{ {
return false; return false;
} }
@ -1761,11 +1761,11 @@ class binary_reader
{ {
for (std::size_t i = 0; i < size_and_type.first; ++i) for (std::size_t i = 0; i < size_and_type.first; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key) or not sax->key(key))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key) or not sax->key(key)))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal()))
{ {
return false; return false;
} }
@ -1775,18 +1775,18 @@ class binary_reader
} }
else else
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1)))) if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1))))
{ {
return false; return false;
} }
while (current != '}') while (current != '}')
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key, false) or not sax->key(key))) if (JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key, false) or not sax->key(key)))
{ {
return false; return false;
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal())) if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal()))
{ {
return false; return false;
} }
@ -1852,7 +1852,7 @@ class binary_reader
for (std::size_t i = 0; i < sizeof(NumberType); ++i) for (std::size_t i = 0; i < sizeof(NumberType); ++i)
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "number"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "number")))
{ {
return false; return false;
} }
@ -1896,7 +1896,7 @@ class binary_reader
std::generate_n(std::back_inserter(result), len, [this, &success, &format]() std::generate_n(std::back_inserter(result), len, [this, &success, &format]()
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "string"))) if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "string")))
{ {
success = false; success = false;
} }
@ -1910,10 +1910,10 @@ class binary_reader
@param[in] context further context information (for diagnostics) @param[in] context further context information (for diagnostics)
@return whether the last read character is not EOF @return whether the last read character is not EOF
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
bool unexpect_eof(const input_format_t format, const char* context) const bool unexpect_eof(const input_format_t format, const char* context) const
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(current == std::char_traits<char>::eof())) if (JSON_HEDLEY_UNLIKELY(current == std::char_traits<char>::eof()))
{ {
return sax->parse_error(chars_read, "<end of file>", return sax->parse_error(chars_read, "<end of file>",
parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context))); parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context)));

View file

@ -55,7 +55,7 @@ Input adapter for stdio file access. This adapter read only 1 byte and do not us
class file_input_adapter : public input_adapter_protocol class file_input_adapter : public input_adapter_protocol
{ {
public: public:
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
explicit file_input_adapter(std::FILE* f) noexcept explicit file_input_adapter(std::FILE* f) noexcept
: m_file(f) : m_file(f)
{} {}
@ -131,7 +131,7 @@ class input_stream_adapter : public input_adapter_protocol
class input_buffer_adapter : public input_adapter_protocol class input_buffer_adapter : public input_adapter_protocol
{ {
public: public:
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
input_buffer_adapter(const char* b, const std::size_t l) noexcept input_buffer_adapter(const char* b, const std::size_t l) noexcept
: cursor(b), limit(b + l) : cursor(b), limit(b + l)
{} {}
@ -145,7 +145,7 @@ class input_buffer_adapter : public input_adapter_protocol
std::char_traits<char>::int_type get_character() noexcept override std::char_traits<char>::int_type get_character() noexcept override
{ {
if (NLOHMANN_JSON_HEDLEY_LIKELY(cursor < limit)) if (JSON_HEDLEY_LIKELY(cursor < limit))
{ {
return std::char_traits<char>::to_int_type(*(cursor++)); return std::char_traits<char>::to_int_type(*(cursor++));
} }
@ -335,7 +335,7 @@ class input_adapter
{ {
public: public:
// native support // native support
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
input_adapter(std::FILE* file) input_adapter(std::FILE* file)
: ia(std::make_shared<file_input_adapter>(file)) {} : ia(std::make_shared<file_input_adapter>(file)) {}
/// input adapter for input stream /// input adapter for input stream
@ -404,7 +404,7 @@ class input_adapter
"each element in the iterator range must have the size of 1 byte"); "each element in the iterator range must have the size of 1 byte");
const auto len = static_cast<size_t>(std::distance(first, last)); const auto len = static_cast<size_t>(std::distance(first, last));
if (NLOHMANN_JSON_HEDLEY_LIKELY(len > 0)) if (JSON_HEDLEY_LIKELY(len > 0))
{ {
// there is at least one element: use the address of first // there is at least one element: use the address of first
ia = std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(&(*first)), len); ia = std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(&(*first)), len);

View file

@ -206,7 +206,7 @@ class json_sax_dom_parser
{ {
ref_stack.push_back(handle_value(BasicJsonType::value_t::object)); ref_stack.push_back(handle_value(BasicJsonType::value_t::object));
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size())) if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{ {
JSON_THROW(out_of_range::create(408, JSON_THROW(out_of_range::create(408,
"excessive object size: " + std::to_string(len))); "excessive object size: " + std::to_string(len)));
@ -232,7 +232,7 @@ class json_sax_dom_parser
{ {
ref_stack.push_back(handle_value(BasicJsonType::value_t::array)); ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size())) if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{ {
JSON_THROW(out_of_range::create(408, JSON_THROW(out_of_range::create(408,
"excessive array size: " + std::to_string(len))); "excessive array size: " + std::to_string(len)));
@ -288,7 +288,7 @@ class json_sax_dom_parser
object to which we can add elements object to which we can add elements
*/ */
template<typename Value> template<typename Value>
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
BasicJsonType* handle_value(Value&& v) BasicJsonType* handle_value(Value&& v)
{ {
if (ref_stack.empty()) if (ref_stack.empty())
@ -395,7 +395,7 @@ class json_sax_dom_callback_parser
ref_stack.push_back(val.second); ref_stack.push_back(val.second);
// check object limit // check object limit
if (ref_stack.back() and NLOHMANN_JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size())) if (ref_stack.back() and JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{ {
JSON_THROW(out_of_range::create(408, "excessive object size: " + std::to_string(len))); JSON_THROW(out_of_range::create(408, "excessive object size: " + std::to_string(len)));
} }
@ -458,7 +458,7 @@ class json_sax_dom_callback_parser
ref_stack.push_back(val.second); ref_stack.push_back(val.second);
// check array limit // check array limit
if (ref_stack.back() and NLOHMANN_JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size())) if (ref_stack.back() and JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
{ {
JSON_THROW(out_of_range::create(408, "excessive array size: " + std::to_string(len))); JSON_THROW(out_of_range::create(408, "excessive array size: " + std::to_string(len)));
} }

View file

@ -59,7 +59,7 @@ class lexer
}; };
/// return name of values of type token_type (only used for errors) /// return name of values of type token_type (only used for errors)
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
static const char* token_type_name(const token_type t) noexcept static const char* token_type_name(const token_type t) noexcept
{ {
switch (t) switch (t)
@ -201,7 +201,7 @@ class lexer
for (auto range = ranges.begin(); range != ranges.end(); ++range) for (auto range = ranges.begin(); range != ranges.end(); ++range)
{ {
get(); get();
if (NLOHMANN_JSON_HEDLEY_LIKELY(*range <= current and current <= *(++range))) if (JSON_HEDLEY_LIKELY(*range <= current and current <= *(++range)))
{ {
add(current); add(current);
} }
@ -300,7 +300,7 @@ class lexer
const int codepoint1 = get_codepoint(); const int codepoint1 = get_codepoint();
int codepoint = codepoint1; // start with codepoint1 int codepoint = codepoint1; // start with codepoint1
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(codepoint1 == -1)) if (JSON_HEDLEY_UNLIKELY(codepoint1 == -1))
{ {
error_message = "invalid string: '\\u' must be followed by 4 hex digits"; error_message = "invalid string: '\\u' must be followed by 4 hex digits";
return token_type::parse_error; return token_type::parse_error;
@ -310,18 +310,18 @@ class lexer
if (0xD800 <= codepoint1 and codepoint1 <= 0xDBFF) if (0xD800 <= codepoint1 and codepoint1 <= 0xDBFF)
{ {
// expect next \uxxxx entry // expect next \uxxxx entry
if (NLOHMANN_JSON_HEDLEY_LIKELY(get() == '\\' and get() == 'u')) if (JSON_HEDLEY_LIKELY(get() == '\\' and get() == 'u'))
{ {
const int codepoint2 = get_codepoint(); const int codepoint2 = get_codepoint();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(codepoint2 == -1)) if (JSON_HEDLEY_UNLIKELY(codepoint2 == -1))
{ {
error_message = "invalid string: '\\u' must be followed by 4 hex digits"; error_message = "invalid string: '\\u' must be followed by 4 hex digits";
return token_type::parse_error; return token_type::parse_error;
} }
// check if codepoint2 is a low surrogate // check if codepoint2 is a low surrogate
if (NLOHMANN_JSON_HEDLEY_LIKELY(0xDC00 <= codepoint2 and codepoint2 <= 0xDFFF)) if (JSON_HEDLEY_LIKELY(0xDC00 <= codepoint2 and codepoint2 <= 0xDFFF))
{ {
// overwrite codepoint // overwrite codepoint
codepoint = static_cast<int>( codepoint = static_cast<int>(
@ -348,7 +348,7 @@ class lexer
} }
else else
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(0xDC00 <= codepoint1 and codepoint1 <= 0xDFFF)) if (JSON_HEDLEY_UNLIKELY(0xDC00 <= codepoint1 and codepoint1 <= 0xDFFF))
{ {
error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF"; error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
return token_type::parse_error; return token_type::parse_error;
@ -723,7 +723,7 @@ class lexer
case 0xDE: case 0xDE:
case 0xDF: case 0xDF:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not next_byte_in_range({0x80, 0xBF}))) if (JSON_HEDLEY_UNLIKELY(not next_byte_in_range({0x80, 0xBF})))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -733,7 +733,7 @@ class lexer
// U+0800..U+0FFF: bytes E0 A0..BF 80..BF // U+0800..U+0FFF: bytes E0 A0..BF 80..BF
case 0xE0: case 0xE0:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF})))) if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF}))))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -757,7 +757,7 @@ class lexer
case 0xEE: case 0xEE:
case 0xEF: case 0xEF:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF})))) if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF}))))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -767,7 +767,7 @@ class lexer
// U+D000..U+D7FF: bytes ED 80..9F 80..BF // U+D000..U+D7FF: bytes ED 80..9F 80..BF
case 0xED: case 0xED:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0x9F, 0x80, 0xBF})))) if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0x9F, 0x80, 0xBF}))))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -777,7 +777,7 @@ class lexer
// U+10000..U+3FFFF F0 90..BF 80..BF 80..BF // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
case 0xF0: case 0xF0:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -789,7 +789,7 @@ class lexer
case 0xF2: case 0xF2:
case 0xF3: case 0xF3:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -799,7 +799,7 @@ class lexer
// U+100000..U+10FFFF F4 80..8F 80..BF 80..BF // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
case 0xF4: case 0xF4:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF})))) if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}))))
{ {
return token_type::parse_error; return token_type::parse_error;
} }
@ -816,19 +816,19 @@ class lexer
} }
} }
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
static void strtof(float& f, const char* str, char** endptr) noexcept static void strtof(float& f, const char* str, char** endptr) noexcept
{ {
f = std::strtof(str, endptr); f = std::strtof(str, endptr);
} }
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
static void strtof(double& f, const char* str, char** endptr) noexcept static void strtof(double& f, const char* str, char** endptr) noexcept
{ {
f = std::strtod(str, endptr); f = std::strtod(str, endptr);
} }
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
static void strtof(long double& f, const char* str, char** endptr) noexcept static void strtof(long double& f, const char* str, char** endptr) noexcept
{ {
f = std::strtold(str, endptr); f = std::strtold(str, endptr);
@ -1204,14 +1204,14 @@ scan_number_done:
@param[in] length the length of the passed literal text @param[in] length the length of the passed literal text
@param[in] return_type the token type to return on success @param[in] return_type the token type to return on success
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
token_type scan_literal(const char* literal_text, const std::size_t length, token_type scan_literal(const char* literal_text, const std::size_t length,
token_type return_type) token_type return_type)
{ {
assert(current == literal_text[0]); assert(current == literal_text[0]);
for (std::size_t i = 1; i < length; ++i) for (std::size_t i = 1; i < length; ++i)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(get() != literal_text[i])) if (JSON_HEDLEY_UNLIKELY(get() != literal_text[i]))
{ {
error_message = "invalid literal"; error_message = "invalid literal";
return token_type::parse_error; return token_type::parse_error;
@ -1257,7 +1257,7 @@ scan_number_done:
current = ia->get_character(); current = ia->get_character();
} }
if (NLOHMANN_JSON_HEDLEY_LIKELY(current != std::char_traits<char>::eof())) if (JSON_HEDLEY_LIKELY(current != std::char_traits<char>::eof()))
{ {
token_string.push_back(std::char_traits<char>::to_char_type(current)); token_string.push_back(std::char_traits<char>::to_char_type(current));
} }
@ -1298,7 +1298,7 @@ scan_number_done:
--position.chars_read_current_line; --position.chars_read_current_line;
} }
if (NLOHMANN_JSON_HEDLEY_LIKELY(current != std::char_traits<char>::eof())) if (JSON_HEDLEY_LIKELY(current != std::char_traits<char>::eof()))
{ {
assert(not token_string.empty()); assert(not token_string.empty());
token_string.pop_back(); token_string.pop_back();
@ -1377,7 +1377,7 @@ scan_number_done:
} }
/// return syntax error message /// return syntax error message
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
constexpr const char* get_error_message() const noexcept constexpr const char* get_error_message() const noexcept
{ {
return error_message; return error_message;

View file

@ -147,7 +147,7 @@ class parser
} }
template <typename SAX> template <typename SAX>
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
bool sax_parse(SAX* sax, const bool strict = true) bool sax_parse(SAX* sax, const bool strict = true)
{ {
(void)detail::is_sax_static_asserts<SAX, BasicJsonType> {}; (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
@ -167,7 +167,7 @@ class parser
private: private:
template <typename SAX> template <typename SAX>
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
bool sax_parse_internal(SAX* sax) bool sax_parse_internal(SAX* sax)
{ {
// stack to remember the hierarchy of structured values we are parsing // stack to remember the hierarchy of structured values we are parsing
@ -185,7 +185,7 @@ class parser
{ {
case token_type::begin_object: case token_type::begin_object:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1)))) if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1))))
{ {
return false; return false;
} }
@ -193,7 +193,7 @@ class parser
// closing } -> we are done // closing } -> we are done
if (get_token() == token_type::end_object) if (get_token() == token_type::end_object)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->end_object())) if (JSON_HEDLEY_UNLIKELY(not sax->end_object()))
{ {
return false; return false;
} }
@ -201,20 +201,20 @@ class parser
} }
// parse key // parse key
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string)) if (JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string))
{ {
return sax->parse_error(m_lexer.get_position(), return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(), m_lexer.get_token_string(),
parse_error::create(101, m_lexer.get_position(), parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::value_string, "object key"))); exception_message(token_type::value_string, "object key")));
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string()))) if (JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string())))
{ {
return false; return false;
} }
// parse separator (:) // parse separator (:)
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator))
{ {
return sax->parse_error(m_lexer.get_position(), return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(), m_lexer.get_token_string(),
@ -232,7 +232,7 @@ class parser
case token_type::begin_array: case token_type::begin_array:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1)))) if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1))))
{ {
return false; return false;
} }
@ -240,7 +240,7 @@ class parser
// closing ] -> we are done // closing ] -> we are done
if (get_token() == token_type::end_array) if (get_token() == token_type::end_array)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->end_array())) if (JSON_HEDLEY_UNLIKELY(not sax->end_array()))
{ {
return false; return false;
} }
@ -258,14 +258,14 @@ class parser
{ {
const auto res = m_lexer.get_number_float(); const auto res = m_lexer.get_number_float();
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not std::isfinite(res))) if (JSON_HEDLEY_UNLIKELY(not std::isfinite(res)))
{ {
return sax->parse_error(m_lexer.get_position(), return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(), m_lexer.get_token_string(),
out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'")); out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'"));
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->number_float(res, m_lexer.get_string()))) if (JSON_HEDLEY_UNLIKELY(not sax->number_float(res, m_lexer.get_string())))
{ {
return false; return false;
} }
@ -275,7 +275,7 @@ class parser
case token_type::literal_false: case token_type::literal_false:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->boolean(false))) if (JSON_HEDLEY_UNLIKELY(not sax->boolean(false)))
{ {
return false; return false;
} }
@ -284,7 +284,7 @@ class parser
case token_type::literal_null: case token_type::literal_null:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->null())) if (JSON_HEDLEY_UNLIKELY(not sax->null()))
{ {
return false; return false;
} }
@ -293,7 +293,7 @@ class parser
case token_type::literal_true: case token_type::literal_true:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->boolean(true))) if (JSON_HEDLEY_UNLIKELY(not sax->boolean(true)))
{ {
return false; return false;
} }
@ -302,7 +302,7 @@ class parser
case token_type::value_integer: case token_type::value_integer:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->number_integer(m_lexer.get_number_integer()))) if (JSON_HEDLEY_UNLIKELY(not sax->number_integer(m_lexer.get_number_integer())))
{ {
return false; return false;
} }
@ -311,7 +311,7 @@ class parser
case token_type::value_string: case token_type::value_string:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->string(m_lexer.get_string()))) if (JSON_HEDLEY_UNLIKELY(not sax->string(m_lexer.get_string())))
{ {
return false; return false;
} }
@ -320,7 +320,7 @@ class parser
case token_type::value_unsigned: case token_type::value_unsigned:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->number_unsigned(m_lexer.get_number_unsigned()))) if (JSON_HEDLEY_UNLIKELY(not sax->number_unsigned(m_lexer.get_number_unsigned())))
{ {
return false; return false;
} }
@ -368,9 +368,9 @@ class parser
} }
// closing ] // closing ]
if (NLOHMANN_JSON_HEDLEY_LIKELY(last_token == token_type::end_array)) if (JSON_HEDLEY_LIKELY(last_token == token_type::end_array))
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->end_array())) if (JSON_HEDLEY_UNLIKELY(not sax->end_array()))
{ {
return false; return false;
} }
@ -396,7 +396,7 @@ class parser
if (get_token() == token_type::value_separator) if (get_token() == token_type::value_separator)
{ {
// parse key // parse key
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string)) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string))
{ {
return sax->parse_error(m_lexer.get_position(), return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(), m_lexer.get_token_string(),
@ -404,13 +404,13 @@ class parser
exception_message(token_type::value_string, "object key"))); exception_message(token_type::value_string, "object key")));
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string()))) if (JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string())))
{ {
return false; return false;
} }
// parse separator (:) // parse separator (:)
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator))
{ {
return sax->parse_error(m_lexer.get_position(), return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(), m_lexer.get_token_string(),
@ -424,9 +424,9 @@ class parser
} }
// closing } // closing }
if (NLOHMANN_JSON_HEDLEY_LIKELY(last_token == token_type::end_object)) if (JSON_HEDLEY_LIKELY(last_token == token_type::end_object))
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not sax->end_object())) if (JSON_HEDLEY_UNLIKELY(not sax->end_object()))
{ {
return false; return false;
} }

View file

@ -255,7 +255,7 @@ class iter_impl
default: default:
{ {
if (NLOHMANN_JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin())) if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin()))
{ {
return *m_object; return *m_object;
} }
@ -289,7 +289,7 @@ class iter_impl
default: default:
{ {
if (NLOHMANN_JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin())) if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin()))
{ {
return m_object; return m_object;
} }
@ -392,7 +392,7 @@ class iter_impl
bool operator==(const iter_impl& other) const bool operator==(const iter_impl& other) const
{ {
// if objects are not the same, the comparison is undefined // if objects are not the same, the comparison is undefined
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))
{ {
JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
} }
@ -428,7 +428,7 @@ class iter_impl
bool operator<(const iter_impl& other) const bool operator<(const iter_impl& other) const
{ {
// if objects are not the same, the comparison is undefined // if objects are not the same, the comparison is undefined
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))
{ {
JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers")); JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
} }
@ -588,7 +588,7 @@ class iter_impl
default: default:
{ {
if (NLOHMANN_JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n)) if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))
{ {
return *m_object; return *m_object;
} }
@ -606,7 +606,7 @@ class iter_impl
{ {
assert(m_object != nullptr); assert(m_object != nullptr);
if (NLOHMANN_JSON_HEDLEY_LIKELY(m_object->is_object())) if (JSON_HEDLEY_LIKELY(m_object->is_object()))
{ {
return m_it.object_iterator->first; return m_it.object_iterator->first;
} }

View file

@ -244,7 +244,7 @@ class json_pointer
*/ */
void pop_back() void pop_back()
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(empty())) if (JSON_HEDLEY_UNLIKELY(empty()))
{ {
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
} }
@ -268,7 +268,7 @@ class json_pointer
*/ */
const std::string& back() const std::string& back()
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(empty())) if (JSON_HEDLEY_UNLIKELY(empty()))
{ {
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
} }
@ -332,7 +332,7 @@ class json_pointer
const int res = std::stoi(s, &processed_chars); const int res = std::stoi(s, &processed_chars);
// check if the string was completely read // check if the string was completely read
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(processed_chars != s.size())) if (JSON_HEDLEY_UNLIKELY(processed_chars != s.size()))
{ {
JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'")); JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'"));
} }
@ -342,7 +342,7 @@ class json_pointer
json_pointer top() const json_pointer top() const
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(empty())) if (JSON_HEDLEY_UNLIKELY(empty()))
{ {
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent")); JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
} }
@ -474,7 +474,7 @@ class json_pointer
case detail::value_t::array: case detail::value_t::array:
{ {
// error condition (cf. RFC 6901, Sect. 4) // error condition (cf. RFC 6901, Sect. 4)
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
{ {
JSON_THROW(detail::parse_error::create(106, 0, JSON_THROW(detail::parse_error::create(106, 0,
"array index '" + reference_token + "array index '" + reference_token +
@ -532,7 +532,7 @@ class json_pointer
case detail::value_t::array: case detail::value_t::array:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token == "-")) if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
{ {
// "-" always fails the range check // "-" always fails the range check
JSON_THROW(detail::out_of_range::create(402, JSON_THROW(detail::out_of_range::create(402,
@ -541,7 +541,7 @@ class json_pointer
} }
// error condition (cf. RFC 6901, Sect. 4) // error condition (cf. RFC 6901, Sect. 4)
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
{ {
JSON_THROW(detail::parse_error::create(106, 0, JSON_THROW(detail::parse_error::create(106, 0,
"array index '" + reference_token + "array index '" + reference_token +
@ -597,7 +597,7 @@ class json_pointer
case detail::value_t::array: case detail::value_t::array:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token == "-")) if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
{ {
// "-" cannot be used for const access // "-" cannot be used for const access
JSON_THROW(detail::out_of_range::create(402, JSON_THROW(detail::out_of_range::create(402,
@ -606,7 +606,7 @@ class json_pointer
} }
// error condition (cf. RFC 6901, Sect. 4) // error condition (cf. RFC 6901, Sect. 4)
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
{ {
JSON_THROW(detail::parse_error::create(106, 0, JSON_THROW(detail::parse_error::create(106, 0,
"array index '" + reference_token + "array index '" + reference_token +
@ -656,7 +656,7 @@ class json_pointer
case detail::value_t::array: case detail::value_t::array:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token == "-")) if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
{ {
// "-" always fails the range check // "-" always fails the range check
JSON_THROW(detail::out_of_range::create(402, JSON_THROW(detail::out_of_range::create(402,
@ -665,7 +665,7 @@ class json_pointer
} }
// error condition (cf. RFC 6901, Sect. 4) // error condition (cf. RFC 6901, Sect. 4)
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0')) if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1 and reference_token[0] == '0'))
{ {
JSON_THROW(detail::parse_error::create(106, 0, JSON_THROW(detail::parse_error::create(106, 0,
"array index '" + reference_token + "array index '" + reference_token +
@ -712,7 +712,7 @@ class json_pointer
} }
// check if nonempty reference string begins with slash // check if nonempty reference string begins with slash
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(reference_string[0] != '/')) if (JSON_HEDLEY_UNLIKELY(reference_string[0] != '/'))
{ {
JSON_THROW(detail::parse_error::create(107, 1, JSON_THROW(detail::parse_error::create(107, 1,
"JSON pointer must be empty or begin with '/' - was: '" + "JSON pointer must be empty or begin with '/' - was: '" +
@ -747,7 +747,7 @@ class json_pointer
assert(reference_token[pos] == '~'); assert(reference_token[pos] == '~');
// ~ must be followed by 0 or 1 // ~ must be followed by 0 or 1
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 or if (JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 or
(reference_token[pos + 1] != '0' and (reference_token[pos + 1] != '0' and
reference_token[pos + 1] != '1'))) reference_token[pos + 1] != '1')))
{ {
@ -874,7 +874,7 @@ class json_pointer
static BasicJsonType static BasicJsonType
unflatten(const BasicJsonType& value) unflatten(const BasicJsonType& value)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not value.is_object())) if (JSON_HEDLEY_UNLIKELY(not value.is_object()))
{ {
JSON_THROW(detail::type_error::create(314, "only objects can be unflattened")); JSON_THROW(detail::type_error::create(314, "only objects can be unflattened"));
} }
@ -884,7 +884,7 @@ class json_pointer
// iterate the JSON object values // iterate the JSON object values
for (const auto& element : *value.m_value.object) for (const auto& element : *value.m_value.object)
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not element.second.is_primitive())) if (JSON_HEDLEY_UNLIKELY(not element.second.is_primitive()))
{ {
JSON_THROW(detail::type_error::create(315, "values in object must be primitive")); JSON_THROW(detail::type_error::create(315, "values in object must be primitive"));
} }

View file

@ -715,7 +715,7 @@ class binary_writer
static std::size_t calc_bson_entry_header_size(const string_t& name) static std::size_t calc_bson_entry_header_size(const string_t& name)
{ {
const auto it = name.find(static_cast<typename string_t::value_type>(0)); const auto it = name.find(static_cast<typename string_t::value_type>(0));
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos)) if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
{ {
JSON_THROW(out_of_range::create(409, JSON_THROW(out_of_range::create(409,
"BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")")); "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")"));

View file

@ -40,7 +40,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
v.push_back(c); v.push_back(c);
} }
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
void write_characters(const CharType* s, std::size_t length) override void write_characters(const CharType* s, std::size_t length) override
{ {
std::copy(s, s + length, std::back_inserter(v)); std::copy(s, s + length, std::back_inserter(v));
@ -64,7 +64,7 @@ class output_stream_adapter : public output_adapter_protocol<CharType>
stream.put(c); stream.put(c);
} }
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
void write_characters(const CharType* s, std::size_t length) override void write_characters(const CharType* s, std::size_t length) override
{ {
stream.write(s, static_cast<std::streamsize>(length)); stream.write(s, static_cast<std::streamsize>(length));
@ -88,7 +88,7 @@ class output_string_adapter : public output_adapter_protocol<CharType>
str.push_back(c); str.push_back(c);
} }
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
void write_characters(const CharType* s, std::size_t length) override void write_characters(const CharType* s, std::size_t length) override
{ {
str.append(s, length); str.append(s, length);

View file

@ -110,7 +110,7 @@ class serializer
// variable to hold indentation for recursive calls // variable to hold indentation for recursive calls
const auto new_indent = current_indent + indent_step; const auto new_indent = current_indent + indent_step;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent)) if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))
{ {
indent_string.resize(indent_string.size() * 2, ' '); indent_string.resize(indent_string.size() * 2, ' ');
} }
@ -183,7 +183,7 @@ class serializer
// variable to hold indentation for recursive calls // variable to hold indentation for recursive calls
const auto new_indent = current_indent + indent_step; const auto new_indent = current_indent + indent_step;
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent)) if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))
{ {
indent_string.resize(indent_string.size() * 2, ' '); indent_string.resize(indent_string.size() * 2, ' ');
} }
@ -498,7 +498,7 @@ class serializer
} }
// we finished processing the string // we finished processing the string
if (NLOHMANN_JSON_HEDLEY_LIKELY(state == UTF8_ACCEPT)) if (JSON_HEDLEY_LIKELY(state == UTF8_ACCEPT))
{ {
// write buffer // write buffer
if (bytes > 0) if (bytes > 0)

View file

@ -319,7 +319,7 @@ class basic_json
@since 2.1.0 @since 2.1.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json meta() static basic_json meta()
{ {
basic_json result; basic_json result;
@ -824,7 +824,7 @@ class basic_json
/// helper for exception-safe object creation /// helper for exception-safe object creation
template<typename T, typename... Args> template<typename T, typename... Args>
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
static T* create(Args&& ... args) static T* create(Args&& ... args)
{ {
AllocatorType<T> alloc; AllocatorType<T> alloc;
@ -951,7 +951,7 @@ class basic_json
default: default:
{ {
object = nullptr; // silence warning, see #821 object = nullptr; // silence warning, see #821
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(t == value_t::null)) if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
{ {
JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.6.1")); // LCOV_EXCL_LINE JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.6.1")); // LCOV_EXCL_LINE
} }
@ -1428,7 +1428,7 @@ class basic_json
} }
// if object is wanted but impossible, throw an exception // if object is wanted but impossible, throw an exception
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(manual_type == value_t::object and not is_an_object)) if (JSON_HEDLEY_UNLIKELY(manual_type == value_t::object and not is_an_object))
{ {
JSON_THROW(type_error::create(301, "cannot create object from initializer list")); JSON_THROW(type_error::create(301, "cannot create object from initializer list"));
} }
@ -1495,7 +1495,7 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json array(initializer_list_t init = {}) static basic_json array(initializer_list_t init = {})
{ {
return basic_json(init, false, value_t::array); return basic_json(init, false, value_t::array);
@ -1539,7 +1539,7 @@ class basic_json
@since version 1.0.0 @since version 1.0.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json object(initializer_list_t init = {}) static basic_json object(initializer_list_t init = {})
{ {
return basic_json(init, false, value_t::object); return basic_json(init, false, value_t::object);
@ -1638,7 +1638,7 @@ class basic_json
assert(last.m_object != nullptr); assert(last.m_object != nullptr);
// make sure iterator fits the current value // make sure iterator fits the current value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object)) if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
{ {
JSON_THROW(invalid_iterator::create(201, "iterators are not compatible")); JSON_THROW(invalid_iterator::create(201, "iterators are not compatible"));
} }
@ -1655,7 +1655,7 @@ class basic_json
case value_t::number_unsigned: case value_t::number_unsigned:
case value_t::string: case value_t::string:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not first.m_it.primitive_iterator.is_begin() if (JSON_HEDLEY_UNLIKELY(not first.m_it.primitive_iterator.is_begin()
or not last.m_it.primitive_iterator.is_end())) or not last.m_it.primitive_iterator.is_end()))
{ {
JSON_THROW(invalid_iterator::create(204, "iterators out of range")); JSON_THROW(invalid_iterator::create(204, "iterators out of range"));
@ -2369,7 +2369,7 @@ class basic_json
/// get a boolean (explicit) /// get a boolean (explicit)
boolean_t get_impl(boolean_t* /*unused*/) const boolean_t get_impl(boolean_t* /*unused*/) const
{ {
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_boolean())) if (JSON_HEDLEY_LIKELY(is_boolean()))
{ {
return m_value.boolean; return m_value.boolean;
} }
@ -2478,7 +2478,7 @@ class basic_json
// delegate the call to get_ptr<>() // delegate the call to get_ptr<>()
auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>(); auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();
if (NLOHMANN_JSON_HEDLEY_LIKELY(ptr != nullptr)) if (JSON_HEDLEY_LIKELY(ptr != nullptr))
{ {
return *ptr; return *ptr;
} }
@ -2929,7 +2929,7 @@ class basic_json
reference at(size_type idx) reference at(size_type idx)
{ {
// at only works for arrays // at only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
JSON_TRY JSON_TRY
{ {
@ -2976,7 +2976,7 @@ class basic_json
const_reference at(size_type idx) const const_reference at(size_type idx) const
{ {
// at only works for arrays // at only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
JSON_TRY JSON_TRY
{ {
@ -3027,7 +3027,7 @@ class basic_json
reference at(const typename object_t::key_type& key) reference at(const typename object_t::key_type& key)
{ {
// at only works for objects // at only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
JSON_TRY JSON_TRY
{ {
@ -3078,7 +3078,7 @@ class basic_json
const_reference at(const typename object_t::key_type& key) const const_reference at(const typename object_t::key_type& key) const
{ {
// at only works for objects // at only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
JSON_TRY JSON_TRY
{ {
@ -3132,7 +3132,7 @@ class basic_json
} }
// operator[] only works for arrays // operator[] only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
// fill up array with null values if given idx is outside range // fill up array with null values if given idx is outside range
if (idx >= m_value.array->size()) if (idx >= m_value.array->size())
@ -3170,7 +3170,7 @@ class basic_json
const_reference operator[](size_type idx) const const_reference operator[](size_type idx) const
{ {
// const operator[] only works for arrays // const operator[] only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
return m_value.array->operator[](idx); return m_value.array->operator[](idx);
} }
@ -3216,7 +3216,7 @@ class basic_json
} }
// operator[] only works for objects // operator[] only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
return m_value.object->operator[](key); return m_value.object->operator[](key);
} }
@ -3257,7 +3257,7 @@ class basic_json
const_reference operator[](const typename object_t::key_type& key) const const_reference operator[](const typename object_t::key_type& key) const
{ {
// const operator[] only works for objects // const operator[] only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
assert(m_value.object->find(key) != m_value.object->end()); assert(m_value.object->find(key) != m_value.object->end());
return m_value.object->find(key)->second; return m_value.object->find(key)->second;
@ -3294,7 +3294,7 @@ class basic_json
@since version 1.1.0 @since version 1.1.0
*/ */
template<typename T> template<typename T>
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
reference operator[](T* key) reference operator[](T* key)
{ {
// implicitly convert null to object // implicitly convert null to object
@ -3306,7 +3306,7 @@ class basic_json
} }
// at only works for objects // at only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
return m_value.object->operator[](key); return m_value.object->operator[](key);
} }
@ -3345,11 +3345,11 @@ class basic_json
@since version 1.1.0 @since version 1.1.0
*/ */
template<typename T> template<typename T>
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
const_reference operator[](T* key) const const_reference operator[](T* key) const
{ {
// at only works for objects // at only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
assert(m_value.object->find(key) != m_value.object->end()); assert(m_value.object->find(key) != m_value.object->end());
return m_value.object->find(key)->second; return m_value.object->find(key)->second;
@ -3413,7 +3413,7 @@ class basic_json
ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
{ {
// at only works for objects // at only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
// if key is found, return value and given default value otherwise // if key is found, return value and given default value otherwise
const auto it = find(key); const auto it = find(key);
@ -3485,7 +3485,7 @@ class basic_json
ValueType value(const json_pointer& ptr, const ValueType& default_value) const ValueType value(const json_pointer& ptr, const ValueType& default_value) const
{ {
// at only works for objects // at only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
// if pointer resolves a value, return it or use default value // if pointer resolves a value, return it or use default value
JSON_TRY JSON_TRY
@ -3505,7 +3505,7 @@ class basic_json
@brief overload for a default value of type const char* @brief overload for a default value of type const char*
@copydoc basic_json::value(const json_pointer&, ValueType) const @copydoc basic_json::value(const json_pointer&, ValueType) const
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
string_t value(const json_pointer& ptr, const char* default_value) const string_t value(const json_pointer& ptr, const char* default_value) const
{ {
return value(ptr, string_t(default_value)); return value(ptr, string_t(default_value));
@ -3650,7 +3650,7 @@ class basic_json
IteratorType erase(IteratorType pos) IteratorType erase(IteratorType pos)
{ {
// make sure iterator fits the current value // make sure iterator fits the current value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(this != pos.m_object)) if (JSON_HEDLEY_UNLIKELY(this != pos.m_object))
{ {
JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
} }
@ -3665,7 +3665,7 @@ class basic_json
case value_t::number_unsigned: case value_t::number_unsigned:
case value_t::string: case value_t::string:
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not pos.m_it.primitive_iterator.is_begin())) if (JSON_HEDLEY_UNLIKELY(not pos.m_it.primitive_iterator.is_begin()))
{ {
JSON_THROW(invalid_iterator::create(205, "iterator out of range")); JSON_THROW(invalid_iterator::create(205, "iterator out of range"));
} }
@ -3755,7 +3755,7 @@ class basic_json
IteratorType erase(IteratorType first, IteratorType last) IteratorType erase(IteratorType first, IteratorType last)
{ {
// make sure iterator fits the current value // make sure iterator fits the current value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(this != first.m_object or this != last.m_object)) if (JSON_HEDLEY_UNLIKELY(this != first.m_object or this != last.m_object))
{ {
JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value")); JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value"));
} }
@ -3770,7 +3770,7 @@ class basic_json
case value_t::number_unsigned: case value_t::number_unsigned:
case value_t::string: case value_t::string:
{ {
if (NLOHMANN_JSON_HEDLEY_LIKELY(not first.m_it.primitive_iterator.is_begin() if (JSON_HEDLEY_LIKELY(not first.m_it.primitive_iterator.is_begin()
or not last.m_it.primitive_iterator.is_end())) or not last.m_it.primitive_iterator.is_end()))
{ {
JSON_THROW(invalid_iterator::create(204, "iterators out of range")); JSON_THROW(invalid_iterator::create(204, "iterators out of range"));
@ -3842,7 +3842,7 @@ class basic_json
size_type erase(const typename object_t::key_type& key) size_type erase(const typename object_t::key_type& key)
{ {
// this erase only works for objects // this erase only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
return m_value.object->erase(key); return m_value.object->erase(key);
} }
@ -3877,9 +3877,9 @@ class basic_json
void erase(const size_type idx) void erase(const size_type idx)
{ {
// this erase only works for arrays // this erase only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(idx >= size())) if (JSON_HEDLEY_UNLIKELY(idx >= size()))
{ {
JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
} }
@ -4355,7 +4355,7 @@ class basic_json
future 4.0.0 of the library. Please use @ref items() instead; future 4.0.0 of the library. Please use @ref items() instead;
that is, replace `json::iterator_wrapper(j)` with `j.items()`. that is, replace `json::iterator_wrapper(j)` with `j.items()`.
*/ */
NLOHMANN_JSON_HEDLEY_DEPRECATED(3.1.0) JSON_HEDLEY_DEPRECATED(3.1.0)
static iteration_proxy<iterator> iterator_wrapper(reference ref) noexcept static iteration_proxy<iterator> iterator_wrapper(reference ref) noexcept
{ {
return ref.items(); return ref.items();
@ -4364,7 +4364,7 @@ class basic_json
/*! /*!
@copydoc iterator_wrapper(reference) @copydoc iterator_wrapper(reference)
*/ */
NLOHMANN_JSON_HEDLEY_DEPRECATED(3.1.0) JSON_HEDLEY_DEPRECATED(3.1.0)
static iteration_proxy<const_iterator> iterator_wrapper(const_reference ref) noexcept static iteration_proxy<const_iterator> iterator_wrapper(const_reference ref) noexcept
{ {
return ref.items(); return ref.items();
@ -4783,7 +4783,7 @@ class basic_json
void push_back(basic_json&& val) void push_back(basic_json&& val)
{ {
// push_back only works for null objects or arrays // push_back only works for null objects or arrays
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not(is_null() or is_array()))) if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array())))
{ {
JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
} }
@ -4820,7 +4820,7 @@ class basic_json
void push_back(const basic_json& val) void push_back(const basic_json& val)
{ {
// push_back only works for null objects or arrays // push_back only works for null objects or arrays
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not(is_null() or is_array()))) if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array())))
{ {
JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
} }
@ -4870,7 +4870,7 @@ class basic_json
void push_back(const typename object_t::value_type& val) void push_back(const typename object_t::value_type& val)
{ {
// push_back only works for null objects or objects // push_back only works for null objects or objects
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not(is_null() or is_object()))) if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_object())))
{ {
JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name()))); JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
} }
@ -4971,7 +4971,7 @@ class basic_json
void emplace_back(Args&& ... args) void emplace_back(Args&& ... args)
{ {
// emplace_back only works for null objects or arrays // emplace_back only works for null objects or arrays
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not(is_null() or is_array()))) if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array())))
{ {
JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name()))); JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name())));
} }
@ -5019,7 +5019,7 @@ class basic_json
std::pair<iterator, bool> emplace(Args&& ... args) std::pair<iterator, bool> emplace(Args&& ... args)
{ {
// emplace only works for null objects or arrays // emplace only works for null objects or arrays
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not(is_null() or is_object()))) if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_object())))
{ {
JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name()))); JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name())));
} }
@ -5087,10 +5087,10 @@ class basic_json
iterator insert(const_iterator pos, const basic_json& val) iterator insert(const_iterator pos, const basic_json& val)
{ {
// insert only works for arrays // insert only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
// check if iterator pos fits to this JSON value // check if iterator pos fits to this JSON value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(pos.m_object != this)) if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
{ {
JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
} }
@ -5138,10 +5138,10 @@ class basic_json
iterator insert(const_iterator pos, size_type cnt, const basic_json& val) iterator insert(const_iterator pos, size_type cnt, const basic_json& val)
{ {
// insert only works for arrays // insert only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
// check if iterator pos fits to this JSON value // check if iterator pos fits to this JSON value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(pos.m_object != this)) if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
{ {
JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
} }
@ -5186,24 +5186,24 @@ class basic_json
iterator insert(const_iterator pos, const_iterator first, const_iterator last) iterator insert(const_iterator pos, const_iterator first, const_iterator last)
{ {
// insert only works for arrays // insert only works for arrays
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not is_array())) if (JSON_HEDLEY_UNLIKELY(not is_array()))
{ {
JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
} }
// check if iterator pos fits to this JSON value // check if iterator pos fits to this JSON value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(pos.m_object != this)) if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
{ {
JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
} }
// check if range iterators belong to the same JSON object // check if range iterators belong to the same JSON object
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object)) if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
{ {
JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(first.m_object == this)) if (JSON_HEDLEY_UNLIKELY(first.m_object == this))
{ {
JSON_THROW(invalid_iterator::create(211, "passed iterators may not belong to container")); JSON_THROW(invalid_iterator::create(211, "passed iterators may not belong to container"));
} }
@ -5239,13 +5239,13 @@ class basic_json
iterator insert(const_iterator pos, initializer_list_t ilist) iterator insert(const_iterator pos, initializer_list_t ilist)
{ {
// insert only works for arrays // insert only works for arrays
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not is_array())) if (JSON_HEDLEY_UNLIKELY(not is_array()))
{ {
JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
} }
// check if iterator pos fits to this JSON value // check if iterator pos fits to this JSON value
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(pos.m_object != this)) if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
{ {
JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value")); JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
} }
@ -5280,19 +5280,19 @@ class basic_json
void insert(const_iterator first, const_iterator last) void insert(const_iterator first, const_iterator last)
{ {
// insert only works for objects // insert only works for objects
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not is_object())) if (JSON_HEDLEY_UNLIKELY(not is_object()))
{ {
JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name()))); JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
} }
// check if range iterators belong to the same JSON object // check if range iterators belong to the same JSON object
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object)) if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
{ {
JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
} }
// passed iterators must belong to objects // passed iterators must belong to objects
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not first.m_object->is_object())) if (JSON_HEDLEY_UNLIKELY(not first.m_object->is_object()))
{ {
JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects"));
} }
@ -5329,11 +5329,11 @@ class basic_json
assert_invariant(); assert_invariant();
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not is_object())) if (JSON_HEDLEY_UNLIKELY(not is_object()))
{ {
JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not j.is_object())) if (JSON_HEDLEY_UNLIKELY(not j.is_object()))
{ {
JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name()))); JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name())));
} }
@ -5380,19 +5380,19 @@ class basic_json
assert_invariant(); assert_invariant();
} }
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not is_object())) if (JSON_HEDLEY_UNLIKELY(not is_object()))
{ {
JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name()))); JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
} }
// check if range iterators belong to the same JSON object // check if range iterators belong to the same JSON object
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object)) if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
{ {
JSON_THROW(invalid_iterator::create(210, "iterators do not fit")); JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
} }
// passed iterators must belong to objects // passed iterators must belong to objects
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not first.m_object->is_object() if (JSON_HEDLEY_UNLIKELY(not first.m_object->is_object()
or not last.m_object->is_object())) or not last.m_object->is_object()))
{ {
JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects"));
@ -5456,7 +5456,7 @@ class basic_json
void swap(array_t& other) void swap(array_t& other)
{ {
// swap only works for arrays // swap only works for arrays
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_array())) if (JSON_HEDLEY_LIKELY(is_array()))
{ {
std::swap(*(m_value.array), other); std::swap(*(m_value.array), other);
} }
@ -5489,7 +5489,7 @@ class basic_json
void swap(object_t& other) void swap(object_t& other)
{ {
// swap only works for objects // swap only works for objects
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_object())) if (JSON_HEDLEY_LIKELY(is_object()))
{ {
std::swap(*(m_value.object), other); std::swap(*(m_value.object), other);
} }
@ -5522,7 +5522,7 @@ class basic_json
void swap(string_t& other) void swap(string_t& other)
{ {
// swap only works for strings // swap only works for strings
if (NLOHMANN_JSON_HEDLEY_LIKELY(is_string())) if (JSON_HEDLEY_LIKELY(is_string()))
{ {
std::swap(*(m_value.string), other); std::swap(*(m_value.string), other);
} }
@ -6032,7 +6032,7 @@ class basic_json
instead; that is, replace calls like `j >> o;` with `o << j;`. instead; that is, replace calls like `j >> o;` with `o << j;`.
@since version 1.0.0; deprecated since version 3.0.0 @since version 1.0.0; deprecated since version 3.0.0
*/ */
NLOHMANN_JSON_HEDLEY_DEPRECATED(3.0.0) JSON_HEDLEY_DEPRECATED(3.0.0)
friend std::ostream& operator>>(const basic_json& j, std::ostream& o) friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
{ {
return o << j; return o << j;
@ -6111,7 +6111,7 @@ class basic_json
@since version 2.0.3 (contiguous containers) @since version 2.0.3 (contiguous containers)
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json parse(detail::input_adapter&& i, static basic_json parse(detail::input_adapter&& i,
const parser_callback_t cb = nullptr, const parser_callback_t cb = nullptr,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -6180,7 +6180,7 @@ class basic_json
@since version 3.2.0 @since version 3.2.0
*/ */
template <typename SAX> template <typename SAX>
NLOHMANN_JSON_HEDLEY_NON_NULL(2) JSON_HEDLEY_NON_NULL(2)
static bool sax_parse(detail::input_adapter&& i, SAX* sax, static bool sax_parse(detail::input_adapter&& i, SAX* sax,
input_format_t format = input_format_t::json, input_format_t format = input_format_t::json,
const bool strict = true) const bool strict = true)
@ -6266,7 +6266,7 @@ class basic_json
std::is_base_of< std::is_base_of<
std::random_access_iterator_tag, std::random_access_iterator_tag,
typename std::iterator_traits<IteratorType>::iterator_category>::value, int>::type = 0> typename std::iterator_traits<IteratorType>::iterator_category>::value, int>::type = 0>
NLOHMANN_JSON_HEDLEY_NON_NULL(3) JSON_HEDLEY_NON_NULL(3)
static bool sax_parse(IteratorType first, IteratorType last, SAX* sax) static bool sax_parse(IteratorType first, IteratorType last, SAX* sax)
{ {
return parser(detail::input_adapter(first, last)).sax_parse(sax); return parser(detail::input_adapter(first, last)).sax_parse(sax);
@ -6280,7 +6280,7 @@ class basic_json
instead; that is, replace calls like `j << i;` with `i >> j;`. instead; that is, replace calls like `j << i;` with `i >> j;`.
@since version 1.0.0; deprecated since version 3.0.0 @since version 1.0.0; deprecated since version 3.0.0
*/ */
NLOHMANN_JSON_HEDLEY_DEPRECATED(3.0.0) JSON_HEDLEY_DEPRECATED(3.0.0)
friend std::istream& operator<<(basic_json& j, std::istream& i) friend std::istream& operator<<(basic_json& j, std::istream& i)
{ {
return operator>>(i, j); return operator>>(i, j);
@ -6353,7 +6353,7 @@ class basic_json
@since version 1.0.0, public since 2.1.0, `const char*` and `noexcept` @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept`
since 3.0.0 since 3.0.0
*/ */
NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_RETURNS_NON_NULL
const char* type_name() const noexcept const char* type_name() const noexcept
{ {
{ {
@ -6883,7 +6883,7 @@ class basic_json
@a strict parameter since 3.0.0; added @a allow_exceptions parameter @a strict parameter since 3.0.0; added @a allow_exceptions parameter
since 3.2.0 since 3.2.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_cbor(detail::input_adapter&& i, static basic_json from_cbor(detail::input_adapter&& i,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -6899,7 +6899,7 @@ class basic_json
*/ */
template<typename A1, typename A2, template<typename A1, typename A2,
detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0> detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_cbor(A1 && a1, A2 && a2, static basic_json from_cbor(A1 && a1, A2 && a2,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -6992,7 +6992,7 @@ class basic_json
@a strict parameter since 3.0.0; added @a allow_exceptions parameter @a strict parameter since 3.0.0; added @a allow_exceptions parameter
since 3.2.0 since 3.2.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_msgpack(detail::input_adapter&& i, static basic_json from_msgpack(detail::input_adapter&& i,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7008,7 +7008,7 @@ class basic_json
*/ */
template<typename A1, typename A2, template<typename A1, typename A2,
detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0> detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_msgpack(A1 && a1, A2 && a2, static basic_json from_msgpack(A1 && a1, A2 && a2,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7080,7 +7080,7 @@ class basic_json
@since version 3.1.0; added @a allow_exceptions parameter since 3.2.0 @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_ubjson(detail::input_adapter&& i, static basic_json from_ubjson(detail::input_adapter&& i,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7096,7 +7096,7 @@ class basic_json
*/ */
template<typename A1, typename A2, template<typename A1, typename A2,
detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0> detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_ubjson(A1 && a1, A2 && a2, static basic_json from_ubjson(A1 && a1, A2 && a2,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7167,7 +7167,7 @@ class basic_json
@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 related UBJSON format
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_bson(detail::input_adapter&& i, static basic_json from_bson(detail::input_adapter&& i,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7183,7 +7183,7 @@ class basic_json
*/ */
template<typename A1, typename A2, template<typename A1, typename A2,
detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0> detail::enable_if_t<std::is_constructible<detail::input_adapter, A1, A2>::value, int> = 0>
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json from_bson(A1 && a1, A2 && a2, static basic_json from_bson(A1 && a1, A2 && a2,
const bool strict = true, const bool strict = true,
const bool allow_exceptions = true) const bool allow_exceptions = true)
@ -7557,7 +7557,7 @@ class basic_json
else else
{ {
const auto idx = json_pointer::array_index(last_path); const auto idx = json_pointer::array_index(last_path);
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(static_cast<size_type>(idx) > parent.size())) if (JSON_HEDLEY_UNLIKELY(static_cast<size_type>(idx) > parent.size()))
{ {
// avoid undefined behavior // avoid undefined behavior
JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
@ -7588,7 +7588,7 @@ class basic_json
{ {
// perform range check // perform range check
auto it = parent.find(last_path); auto it = parent.find(last_path);
if (NLOHMANN_JSON_HEDLEY_LIKELY(it != parent.end())) if (JSON_HEDLEY_LIKELY(it != parent.end()))
{ {
parent.erase(it); parent.erase(it);
} }
@ -7605,7 +7605,7 @@ class basic_json
}; };
// type check: top level value must be an array // type check: top level value must be an array
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not json_patch.is_array())) if (JSON_HEDLEY_UNLIKELY(not json_patch.is_array()))
{ {
JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects"));
} }
@ -7625,13 +7625,13 @@ class basic_json
const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'"; const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'";
// check if desired value is present // check if desired value is present
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end())) if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end()))
{ {
JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'")); JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'"));
} }
// check if result is of type string // check if result is of type string
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(string_type and not it->second.is_string())) if (JSON_HEDLEY_UNLIKELY(string_type and not it->second.is_string()))
{ {
JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'")); JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'"));
} }
@ -7641,7 +7641,7 @@ class basic_json
}; };
// type check: every element of the array must be an object // type check: every element of the array must be an object
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not val.is_object())) if (JSON_HEDLEY_UNLIKELY(not val.is_object()))
{ {
JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects")); JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects"));
} }
@ -7719,7 +7719,7 @@ class basic_json
} }
// throw an exception if test fails // throw an exception if test fails
if (NLOHMANN_JSON_HEDLEY_UNLIKELY(not success)) if (JSON_HEDLEY_UNLIKELY(not success))
{ {
JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump())); JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump()));
} }
@ -7772,7 +7772,7 @@ class basic_json
@since version 2.0.0 @since version 2.0.0
*/ */
NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_WARN_UNUSED_RESULT
static basic_json diff(const basic_json& source, const basic_json& target, static basic_json diff(const basic_json& source, const basic_json& target,
const std::string& path = "") const std::string& path = "")
{ {
@ -8064,7 +8064,7 @@ if no parse error occurred.
@since version 1.0.0 @since version 1.0.0
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json operator "" _json(const char* s, std::size_t n) inline nlohmann::json operator "" _json(const char* s, std::size_t n)
{ {
return nlohmann::json::parse(s, s + n); return nlohmann::json::parse(s, s + n);
@ -8083,7 +8083,7 @@ object if no parse error occurred.
@since version 2.0.0 @since version 2.0.0
*/ */
NLOHMANN_JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n) inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)
{ {
return nlohmann::json::json_pointer(std::string(s, n)); return nlohmann::json::json_pointer(std::string(s, n));

File diff suppressed because it is too large Load diff

View file

@ -1,121 +1,121 @@
#undef NLOHMANN_JSON_HEDLEY_ALWAYS_INLINE #undef JSON_HEDLEY_ALWAYS_INLINE
#undef NLOHMANN_JSON_HEDLEY_ARM_VERSION #undef JSON_HEDLEY_ARM_VERSION
#undef NLOHMANN_JSON_HEDLEY_ARM_VERSION_CHECK #undef JSON_HEDLEY_ARM_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_ARRAY_PARAM #undef JSON_HEDLEY_ARRAY_PARAM
#undef NLOHMANN_JSON_HEDLEY_ASSUME #undef JSON_HEDLEY_ASSUME
#undef NLOHMANN_JSON_HEDLEY_BEGIN_C_DECLS #undef JSON_HEDLEY_BEGIN_C_DECLS
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_ATTRIBUTE #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_BUILTIN #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_EXTENSION #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_FEATURE #undef JSON_HEDLEY_CLANG_HAS_FEATURE
#undef NLOHMANN_JSON_HEDLEY_CLANG_HAS_WARNING #undef JSON_HEDLEY_CLANG_HAS_WARNING
#undef NLOHMANN_JSON_HEDLEY_COMPCERT_VERSION #undef JSON_HEDLEY_COMPCERT_VERSION
#undef NLOHMANN_JSON_HEDLEY_COMPCERT_VERSION_CHECK #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_CONCAT #undef JSON_HEDLEY_CONCAT
#undef NLOHMANN_JSON_HEDLEY_CONCAT_EX #undef JSON_HEDLEY_CONCAT_EX
#undef NLOHMANN_JSON_HEDLEY_CONST #undef JSON_HEDLEY_CONST
#undef NLOHMANN_JSON_HEDLEY_CONSTEXPR #undef JSON_HEDLEY_CONSTEXPR
#undef NLOHMANN_JSON_HEDLEY_CONST_CAST #undef JSON_HEDLEY_CONST_CAST
#undef NLOHMANN_JSON_HEDLEY_CPP_CAST #undef JSON_HEDLEY_CPP_CAST
#undef NLOHMANN_JSON_HEDLEY_CRAY_VERSION #undef JSON_HEDLEY_CRAY_VERSION
#undef NLOHMANN_JSON_HEDLEY_CRAY_VERSION_CHECK #undef JSON_HEDLEY_CRAY_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_C_DECL #undef JSON_HEDLEY_C_DECL
#undef NLOHMANN_JSON_HEDLEY_DEPRECATED #undef JSON_HEDLEY_DEPRECATED
#undef NLOHMANN_JSON_HEDLEY_DEPRECATED_FOR #undef JSON_HEDLEY_DEPRECATED_FOR
#undef NLOHMANN_JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
#undef NLOHMANN_JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
#undef NLOHMANN_JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
#undef NLOHMANN_JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_DIAGNOSTIC_POP
#undef NLOHMANN_JSON_HEDLEY_DIAGNOSTIC_PUSH #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
#undef NLOHMANN_JSON_HEDLEY_DMC_VERSION #undef JSON_HEDLEY_DMC_VERSION
#undef NLOHMANN_JSON_HEDLEY_DMC_VERSION_CHECK #undef JSON_HEDLEY_DMC_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_EMSCRIPTEN_VERSION #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
#undef NLOHMANN_JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_END_C_DECLS #undef JSON_HEDLEY_END_C_DECLS
#undef NLOHMANN_JSON_HEDLEY_FALL_THROUGH #undef JSON_HEDLEY_FALL_THROUGH
#undef NLOHMANN_JSON_HEDLEY_FLAGS #undef JSON_HEDLEY_FLAGS
#undef NLOHMANN_JSON_HEDLEY_FLAGS_CAST #undef JSON_HEDLEY_FLAGS_CAST
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_ATTRIBUTE #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_BUILTIN #undef JSON_HEDLEY_GCC_HAS_BUILTIN
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_EXTENSION #undef JSON_HEDLEY_GCC_HAS_EXTENSION
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_FEATURE #undef JSON_HEDLEY_GCC_HAS_FEATURE
#undef NLOHMANN_JSON_HEDLEY_GCC_HAS_WARNING #undef JSON_HEDLEY_GCC_HAS_WARNING
#undef NLOHMANN_JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_GCC_VERSION #undef JSON_HEDLEY_GCC_VERSION
#undef NLOHMANN_JSON_HEDLEY_GCC_VERSION_CHECK #undef JSON_HEDLEY_GCC_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_ATTRIBUTE #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_BUILTIN #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_EXTENSION #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_FEATURE #undef JSON_HEDLEY_GNUC_HAS_FEATURE
#undef NLOHMANN_JSON_HEDLEY_GNUC_HAS_WARNING #undef JSON_HEDLEY_GNUC_HAS_WARNING
#undef NLOHMANN_JSON_HEDLEY_GNUC_VERSION #undef JSON_HEDLEY_GNUC_VERSION
#undef NLOHMANN_JSON_HEDLEY_GNUC_VERSION_CHECK #undef JSON_HEDLEY_GNUC_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_HAS_ATTRIBUTE #undef JSON_HEDLEY_HAS_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_HAS_BUILTIN #undef JSON_HEDLEY_HAS_BUILTIN
#undef NLOHMANN_JSON_HEDLEY_HAS_CPP_ATTRIBUTE #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
#undef NLOHMANN_JSON_HEDLEY_HAS_EXTENSION #undef JSON_HEDLEY_HAS_EXTENSION
#undef NLOHMANN_JSON_HEDLEY_HAS_FEATURE #undef JSON_HEDLEY_HAS_FEATURE
#undef NLOHMANN_JSON_HEDLEY_HAS_WARNING #undef JSON_HEDLEY_HAS_WARNING
#undef NLOHMANN_JSON_HEDLEY_IAR_VERSION #undef JSON_HEDLEY_IAR_VERSION
#undef NLOHMANN_JSON_HEDLEY_IAR_VERSION_CHECK #undef JSON_HEDLEY_IAR_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_IBM_VERSION #undef JSON_HEDLEY_IBM_VERSION
#undef NLOHMANN_JSON_HEDLEY_IBM_VERSION_CHECK #undef JSON_HEDLEY_IBM_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_IMPORT #undef JSON_HEDLEY_IMPORT
#undef NLOHMANN_JSON_HEDLEY_INLINE #undef JSON_HEDLEY_INLINE
#undef NLOHMANN_JSON_HEDLEY_INTEL_VERSION #undef JSON_HEDLEY_INTEL_VERSION
#undef NLOHMANN_JSON_HEDLEY_INTEL_VERSION_CHECK #undef JSON_HEDLEY_INTEL_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_IS_CONSTANT #undef JSON_HEDLEY_IS_CONSTANT
#undef NLOHMANN_JSON_HEDLEY_LIKELY #undef JSON_HEDLEY_LIKELY
#undef NLOHMANN_JSON_HEDLEY_MALLOC #undef JSON_HEDLEY_MALLOC
#undef NLOHMANN_JSON_HEDLEY_MESSAGE #undef JSON_HEDLEY_MESSAGE
#undef NLOHMANN_JSON_HEDLEY_MSVC_VERSION #undef JSON_HEDLEY_MSVC_VERSION
#undef NLOHMANN_JSON_HEDLEY_MSVC_VERSION_CHECK #undef JSON_HEDLEY_MSVC_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_NEVER_INLINE #undef JSON_HEDLEY_NEVER_INLINE
#undef NLOHMANN_JSON_HEDLEY_NON_NULL #undef JSON_HEDLEY_NON_NULL
#undef NLOHMANN_JSON_HEDLEY_NO_RETURN #undef JSON_HEDLEY_NO_RETURN
#undef NLOHMANN_JSON_HEDLEY_NO_THROW #undef JSON_HEDLEY_NO_THROW
#undef NLOHMANN_JSON_HEDLEY_PELLES_VERSION #undef JSON_HEDLEY_PELLES_VERSION
#undef NLOHMANN_JSON_HEDLEY_PELLES_VERSION_CHECK #undef JSON_HEDLEY_PELLES_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_PGI_VERSION #undef JSON_HEDLEY_PGI_VERSION
#undef NLOHMANN_JSON_HEDLEY_PGI_VERSION_CHECK #undef JSON_HEDLEY_PGI_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_PREDICT #undef JSON_HEDLEY_PREDICT
#undef NLOHMANN_JSON_HEDLEY_PRINTF_FORMAT #undef JSON_HEDLEY_PRINTF_FORMAT
#undef NLOHMANN_JSON_HEDLEY_PRIVATE #undef JSON_HEDLEY_PRIVATE
#undef NLOHMANN_JSON_HEDLEY_PUBLIC #undef JSON_HEDLEY_PUBLIC
#undef NLOHMANN_JSON_HEDLEY_PURE #undef JSON_HEDLEY_PURE
#undef NLOHMANN_JSON_HEDLEY_REINTERPRET_CAST #undef JSON_HEDLEY_REINTERPRET_CAST
#undef NLOHMANN_JSON_HEDLEY_REQUIRE #undef JSON_HEDLEY_REQUIRE
#undef NLOHMANN_JSON_HEDLEY_REQUIRE_CONSTEXPR #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
#undef NLOHMANN_JSON_HEDLEY_REQUIRE_MSG #undef JSON_HEDLEY_REQUIRE_MSG
#undef NLOHMANN_JSON_HEDLEY_RESTRICT #undef JSON_HEDLEY_RESTRICT
#undef NLOHMANN_JSON_HEDLEY_RETURNS_NON_NULL #undef JSON_HEDLEY_RETURNS_NON_NULL
#undef NLOHMANN_JSON_HEDLEY_SENTINEL #undef JSON_HEDLEY_SENTINEL
#undef NLOHMANN_JSON_HEDLEY_STATIC_ASSERT #undef JSON_HEDLEY_STATIC_ASSERT
#undef NLOHMANN_JSON_HEDLEY_STATIC_CAST #undef JSON_HEDLEY_STATIC_CAST
#undef NLOHMANN_JSON_HEDLEY_STRINGIFY #undef JSON_HEDLEY_STRINGIFY
#undef NLOHMANN_JSON_HEDLEY_STRINGIFY_EX #undef JSON_HEDLEY_STRINGIFY_EX
#undef NLOHMANN_JSON_HEDLEY_SUNPRO_VERSION #undef JSON_HEDLEY_SUNPRO_VERSION
#undef NLOHMANN_JSON_HEDLEY_SUNPRO_VERSION_CHECK #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_TINYC_VERSION #undef JSON_HEDLEY_TINYC_VERSION
#undef NLOHMANN_JSON_HEDLEY_TINYC_VERSION_CHECK #undef JSON_HEDLEY_TINYC_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_TI_VERSION #undef JSON_HEDLEY_TI_VERSION
#undef NLOHMANN_JSON_HEDLEY_TI_VERSION_CHECK #undef JSON_HEDLEY_TI_VERSION_CHECK
#undef NLOHMANN_JSON_HEDLEY_UNAVAILABLE #undef JSON_HEDLEY_UNAVAILABLE
#undef NLOHMANN_JSON_HEDLEY_UNLIKELY #undef JSON_HEDLEY_UNLIKELY
#undef NLOHMANN_JSON_HEDLEY_UNPREDICTABLE #undef JSON_HEDLEY_UNPREDICTABLE
#undef NLOHMANN_JSON_HEDLEY_UNREACHABLE #undef JSON_HEDLEY_UNREACHABLE
#undef NLOHMANN_JSON_HEDLEY_UNREACHABLE_RETURN #undef JSON_HEDLEY_UNREACHABLE_RETURN
#undef NLOHMANN_JSON_HEDLEY_VERSION #undef JSON_HEDLEY_VERSION
#undef NLOHMANN_JSON_HEDLEY_VERSION_DECODE_MAJOR #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
#undef NLOHMANN_JSON_HEDLEY_VERSION_DECODE_MINOR #undef JSON_HEDLEY_VERSION_DECODE_MINOR
#undef NLOHMANN_JSON_HEDLEY_VERSION_DECODE_REVISION #undef JSON_HEDLEY_VERSION_DECODE_REVISION
#undef NLOHMANN_JSON_HEDLEY_VERSION_ENCODE #undef JSON_HEDLEY_VERSION_ENCODE
#undef NLOHMANN_JSON_HEDLEY_WARNING #undef JSON_HEDLEY_WARNING
#undef NLOHMANN_JSON_HEDLEY_WARN_UNUSED_RESULT #undef JSON_HEDLEY_WARN_UNUSED_RESULT

File diff suppressed because it is too large Load diff