Skip to content

Commit

Permalink
Update version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
falbrechtskirchinger committed Apr 8, 2022
1 parent f5f975a commit 2dcfd0c
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 23 deletions.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/back.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Constant.
## Version history

- Added in version 3.6.0.
- Changed return type to `string_t` in version 3.10.6.
- Changed return type to `string_t` in version 3.11.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ For backwards compatibility `RefStringType` may also be a specialization of [`ba
## Version history

- Added in version 2.0.0.
- Changed template parameter from `basic_json` to string type in version 3.10.6.
- Changed template parameter from `basic_json` to string type in version 3.11.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/json_pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Create a JSON pointer according to the syntax described in
## Version history

- Added in version 2.0.0.
- Changed type of `s` to `string_t` in version 3.10.6.
- Changed type of `s` to `string_t` in version 3.11.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/operator_slash.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ json_pointer operator/(const json_pointer& lhs, std::size_t array_idx);
## Version history

1. Added in version 3.6.0.
2. Added in version 3.6.0. Changed type of `token` to `string_t` in version 3.10.6.
2. Added in version 3.6.0. Changed type of `token` to `string_t` in version 3.11.0.
3. Added in version 3.6.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/operator_slasheq.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ json_pointer& operator/=(std::size_t array_idx)
## Version history

1. Added in version 3.6.0.
2. Added in version 3.6.0. Changed type of `token` to `string_t` in version 3.10.6.
2. Added in version 3.6.0. Changed type of `token` to `string_t` in version 3.11.0.
3. Added in version 3.6.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/operator_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ operator string_t() const
## Version history

- Since version 2.0.0.
- Changed type to `string_t`.
- Changed type to `string_t` in version 3.11.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/push_back.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Amortized constant.
## Version history

- Added in version 3.6.0.
- Changed type of `token` to `string_t` in version 3.10.6.
- Changed type of `token` to `string_t` in version 3.11.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/string_t.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ See [`basic_json::string_t`](../basic_json/string_t.md) for more information.

## Version history

- Added in version 3.10.6.
- Added in version 3.11.0.
2 changes: 1 addition & 1 deletion doc/mkdocs/docs/api/json_pointer/to_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ ptr == json_pointer(ptr.to_string());
## Version history

- Since version 2.0.0.
- Changed return type to `string_t` in version 3.10.6.
- Changed return type to `string_t` in version 3.11.0.
104 changes: 97 additions & 7 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2227,7 +2227,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec

template<class ValueType, class BasicJsonType, typename std::enable_if<
detail::is_getable<basic_json_t, ValueType>::value, int>::type = 0>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
ValueType value(const ::nlohmann::json_pointer<BasicJsonType>& ptr, const ValueType& default_value) const
{
return value(ptr.convert(), default_value);
Expand All @@ -2243,7 +2243,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_NON_NULL(3)
string_t value(const typename ::nlohmann::json_pointer<BasicJsonType>& ptr, const char* default_value) const
{
Expand Down Expand Up @@ -2526,7 +2526,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
bool contains(const typename ::nlohmann::json_pointer<BasicJsonType> ptr) const
{
return ptr.contains(this);
Expand Down Expand Up @@ -3352,6 +3352,96 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
/// @name lexicographical comparison operators
/// @{

#if JSON_HAS_THREE_WAY_COMPARISON
/// @brief comparison: three-way
/// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/
std::partial_ordering operator<=>(const_reference rhs) const noexcept // *NOPAD*
{
const auto lhs_type = type();
const auto rhs_type = rhs.type();

if (lhs_type == rhs_type)
{
switch (lhs_type)
{
case value_t::array:
return *m_value.array <=> *rhs.m_value.array; // *NOPAD*

case value_t::object:
return *m_value.object <=> *rhs.m_value.object; // *NOPAD*

case value_t::null:
return std::partial_ordering::equivalent;

case value_t::string:
return *m_value.string <=> *rhs.m_value.string; // *NOPAD*

case value_t::boolean:
return m_value.boolean <=> rhs.m_value.boolean; // *NOPAD*

case value_t::number_integer:
return m_value.number_integer <=> rhs.m_value.number_integer; // *NOPAD*

case value_t::number_unsigned:
return m_value.number_unsigned <=> rhs.m_value.number_unsigned; // *NOPAD*

case value_t::number_float:
return m_value.number_float <=> rhs.m_value.number_float; // *NOPAD*

case value_t::binary:
return *m_value.binary <=> *rhs.m_value.binary; // *NOPAD*

case value_t::discarded:
default:
return std::partial_ordering::unordered;
}
}
else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_float)
{
return static_cast<number_float_t>(m_value.number_integer) <=> rhs.m_value.number_float; // *NOPAD*
}
else if (lhs_type == value_t::number_float && rhs_type == value_t::number_integer)
{
return m_value.number_float <=> static_cast<number_float_t>(rhs.m_value.number_integer); // *NOPAD*
}
else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_float)
{
return static_cast<number_float_t>(m_value.number_unsigned) <=> rhs.m_value.number_float; // *NOPAD*
}
else if (lhs_type == value_t::number_float && rhs_type == value_t::number_unsigned)
{
return m_value.number_float <=> static_cast<number_float_t>(rhs.m_value.number_unsigned); // *NOPAD*
}
else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_integer)
{
return static_cast<number_integer_t>(m_value.number_unsigned) <=> rhs.m_value.number_integer; // *NOPAD*
}
else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_unsigned)
{
return m_value.number_integer <=> static_cast<number_integer_t>(rhs.m_value.number_unsigned); // *NOPAD*
}

// We only reach this line if we cannot compare values. In that case,
// we compare types.
return lhs_type <=> rhs_type; // *NOPAD*
}

/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
bool operator==(const_reference rhs) const noexcept
{
return std::is_eq(*this <= > rhs);
}

/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
bool operator==(ScalarType rhs) const noexcept
{
return std::is_eq(*this <= > basic_json(rhs));
}
#else
/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
Expand Down Expand Up @@ -4221,7 +4311,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
reference operator[](const ::nlohmann::json_pointer<BasicJsonType>& ptr)
{
return ptr.get_unchecked(this);
Expand All @@ -4235,7 +4325,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
const_reference operator[](const ::nlohmann::json_pointer<BasicJsonType>& ptr) const
{
return ptr.get_unchecked(this);
Expand All @@ -4249,7 +4339,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
reference at(const ::nlohmann::json_pointer<BasicJsonType>& ptr)
{
return ptr.get_checked(this);
Expand All @@ -4263,7 +4353,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
const_reference at(const ::nlohmann::json_pointer<BasicJsonType>& ptr) const
{
return ptr.get_checked(this);
Expand Down
104 changes: 97 additions & 7 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19676,7 +19676,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec

template<class ValueType, class BasicJsonType, typename std::enable_if<
detail::is_getable<basic_json_t, ValueType>::value, int>::type = 0>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
ValueType value(const ::nlohmann::json_pointer<BasicJsonType>& ptr, const ValueType& default_value) const
{
return value(ptr.convert(), default_value);
Expand All @@ -19692,7 +19692,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_NON_NULL(3)
string_t value(const typename ::nlohmann::json_pointer<BasicJsonType>& ptr, const char* default_value) const
{
Expand Down Expand Up @@ -19975,7 +19975,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
bool contains(const typename ::nlohmann::json_pointer<BasicJsonType> ptr) const
{
return ptr.contains(this);
Expand Down Expand Up @@ -20801,6 +20801,96 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
/// @name lexicographical comparison operators
/// @{

#if JSON_HAS_THREE_WAY_COMPARISON
/// @brief comparison: three-way
/// @sa https://json.nlohmann.me/api/basic_json/operator_spaceship/
std::partial_ordering operator<=>(const_reference rhs) const noexcept // *NOPAD*
{
const auto lhs_type = type();
const auto rhs_type = rhs.type();

if (lhs_type == rhs_type)
{
switch (lhs_type)
{
case value_t::array:
return *m_value.array <=> *rhs.m_value.array; // *NOPAD*

case value_t::object:
return *m_value.object <=> *rhs.m_value.object; // *NOPAD*

case value_t::null:
return std::partial_ordering::equivalent;

case value_t::string:
return *m_value.string <=> *rhs.m_value.string; // *NOPAD*

case value_t::boolean:
return m_value.boolean <=> rhs.m_value.boolean; // *NOPAD*

case value_t::number_integer:
return m_value.number_integer <=> rhs.m_value.number_integer; // *NOPAD*

case value_t::number_unsigned:
return m_value.number_unsigned <=> rhs.m_value.number_unsigned; // *NOPAD*

case value_t::number_float:
return m_value.number_float <=> rhs.m_value.number_float; // *NOPAD*

case value_t::binary:
return *m_value.binary <=> *rhs.m_value.binary; // *NOPAD*

case value_t::discarded:
default:
return std::partial_ordering::unordered;
}
}
else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_float)
{
return static_cast<number_float_t>(m_value.number_integer) <=> rhs.m_value.number_float; // *NOPAD*
}
else if (lhs_type == value_t::number_float && rhs_type == value_t::number_integer)
{
return m_value.number_float <=> static_cast<number_float_t>(rhs.m_value.number_integer); // *NOPAD*
}
else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_float)
{
return static_cast<number_float_t>(m_value.number_unsigned) <=> rhs.m_value.number_float; // *NOPAD*
}
else if (lhs_type == value_t::number_float && rhs_type == value_t::number_unsigned)
{
return m_value.number_float <=> static_cast<number_float_t>(rhs.m_value.number_unsigned); // *NOPAD*
}
else if (lhs_type == value_t::number_unsigned && rhs_type == value_t::number_integer)
{
return static_cast<number_integer_t>(m_value.number_unsigned) <=> rhs.m_value.number_integer; // *NOPAD*
}
else if (lhs_type == value_t::number_integer && rhs_type == value_t::number_unsigned)
{
return m_value.number_integer <=> static_cast<number_integer_t>(rhs.m_value.number_unsigned); // *NOPAD*
}

// We only reach this line if we cannot compare values. In that case,
// we compare types.
return lhs_type <=> rhs_type; // *NOPAD*
}

/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
bool operator==(const_reference rhs) const noexcept
{
return std::is_eq(*this <= > rhs);
}

/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
template<typename ScalarType>
requires std::is_scalar_v<ScalarType>
bool operator==(ScalarType rhs) const noexcept
{
return std::is_eq(*this <= > basic_json(rhs));
}
#else
/// @brief comparison: equal
/// @sa https://json.nlohmann.me/api/basic_json/operator_eq/
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
Expand Down Expand Up @@ -21670,7 +21760,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
reference operator[](const ::nlohmann::json_pointer<BasicJsonType>& ptr)
{
return ptr.get_unchecked(this);
Expand All @@ -21684,7 +21774,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
const_reference operator[](const ::nlohmann::json_pointer<BasicJsonType>& ptr) const
{
return ptr.get_unchecked(this);
Expand All @@ -21698,7 +21788,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
reference at(const ::nlohmann::json_pointer<BasicJsonType>& ptr)
{
return ptr.get_checked(this);
Expand All @@ -21712,7 +21802,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
}

template<typename BasicJsonType>
JSON_HEDLEY_DEPRECATED_FOR(3.10.6, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer<basic_json::string_t>) // NOLINT(readability/alt_tokens)
const_reference at(const ::nlohmann::json_pointer<BasicJsonType>& ptr) const
{
return ptr.get_checked(this);
Expand Down

0 comments on commit 2dcfd0c

Please sign in to comment.