🔀 merge develop

This commit is contained in:
Niels Lohmann 2024-11-08 22:40:55 +01:00
parent fd968125e8
commit 88318f9a77
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
21 changed files with 521 additions and 204 deletions

View File

@ -20,7 +20,7 @@ Clearly describe the issue:
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
Please stick to the provided issue template ([bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/bug.yml) if possible. For questions, feature or support requests, please [open a discussion](https://github.com/nlohmann/json/discussions/new).
Please stick to the provided issue template ([bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/bug.yaml) if possible. For questions, feature or support requests, please [open a discussion](https://github.com/nlohmann/json/discussions/new).
## Files to change

View File

@ -57,7 +57,11 @@ endif ()
##
include(GNUInstallDirs)
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
if (NOT DEFINED NLOHMANN_JSON_TARGET_NAME)
# Allow overriding the target name when using FetchContent / add_subdirectory.
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
endif()
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" CACHE INTERNAL "")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")

View File

@ -385,7 +385,7 @@ struct MyIterator {
using iterator_category = std::input_iterator_tag;
MyIterator& operator++() {
MyContainer.advance();
target->advance();
return *this;
}
@ -394,7 +394,7 @@ struct MyIterator {
}
reference operator*() const {
return target.get_current();
return target->get_current();
}
MyContainer* target = nullptr;

View File

@ -36,7 +36,7 @@ int main()
// try to read from a nonexisting key using string_view
std::cout << object.at("the fast"sv) << '\n';
}
catch (const json::out_of_range)
catch (const json::out_of_range& e)
{
std::cout << "out of range" << '\n';
}

View File

@ -21,7 +21,7 @@ Constant.
## Possible implementation
```cpp
constexpr bool is_primitive() const noexcept
constexpr bool is_structured() const noexcept
{
return is_array() || is_object();
}

View File

@ -17,7 +17,7 @@ bool operator>(ScalarType lhs, const const_reference rhs) noexcept; // (2)
operand is `NaN` and the other operand is either `NaN` or any other number.
- Otherwise, returns the result of `#!cpp !(lhs <= rhs)` (see [**operator<=**](operator_le.md)).
2. Compares wether a JSON value is greater than a scalar or a scalar is greater than a JSON value by
2. Compares whether a JSON value is greater than a scalar or a scalar is greater than a JSON value by
converting the scalar to a JSON value and comparing both JSON values according to 1.
## Template parameters

View File

@ -17,7 +17,7 @@ bool operator<=(ScalarType lhs, const const_reference rhs) noexcept; // (2)
operand is `NaN` and the other operand is either `NaN` or any other number.
- Otherwise, returns the result of `#!cpp !(rhs < lhs)` (see [**operator<**](operator_lt.md)).
1. Compares wether a JSON value is less than or equal to a scalar or a scalar is less than or equal
1. Compares whether a JSON value is less than or equal to a scalar or a scalar is less than or equal
to a JSON value by converting the scalar to a JSON value and comparing both JSON values according
to 1.

View File

@ -27,7 +27,7 @@ bool operator<(ScalarType lhs, const const_reference rhs) noexcept; // (2)
7. binary
For instance, any boolean value is considered less than any string.
2. Compares wether a JSON value is less than a scalar or a scalar is less than a JSON value by converting
2. Compares whether a JSON value is less than a scalar or a scalar is less than a JSON value by converting
the scalar to a JSON value and comparing both JSON values according to 1.
## Template parameters

View File

@ -139,4 +139,4 @@ function.
## Version history
- Added in version 3.0.0.
- Added `merge_objects` parameter in 3.10.4.
- Added `merge_objects` parameter in 3.10.5.

View File

@ -0,0 +1,118 @@
# NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT
# NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE, NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT
```cpp
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(type, base_type, member...) // (1)
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(type, base_type, member...) // (2)
#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(type, base_type, member...) // (3)
#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(type, base_type, member...) // (4)
```
These macros can be used to simplify the serialization/deserialization of derived types if you want to use a JSON
object as serialization and want to use the member variable names as object keys in that object.
- Macros 1 and 2 are to be defined **inside** the class/struct to create code for.
Like [`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](nlohmann_define_type_intrusive.md), they can access private members.
- Macros 3 and 4 are to be defined **outside** the class/struct to create code for, but **inside** its namespace.
Like [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](nlohmann_define_type_non_intrusive.md),
they **cannot** access private members.
The first parameter is the name of the derived class/struct,
the second parameter is the name of the base class/struct and all remaining parameters name the members.
The base type **must** be already serializable/deserializable.
- Macros 1 and 3 will use [`at`](../basic_json/at.md) during deserialization and will throw
[`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if a key is missing in the JSON object.
- Macros 2 and 4 will use [`value`](../basic_json/value.md) during deserialization and fall back to the default value for the
respective type of the member variable if a key in the JSON object is missing. The generated `from_json()` function
default constructs an object and uses its values as the defaults when calling the `value` function.
## Parameters
`type` (in)
: name of the type (class, struct) to serialize/deserialize
`base_type` (in)
: name of the base type (class, struct) `type` is derived from
`member` (in)
: name of the member variable to serialize/deserialize; up to 64 members can be given as comma-separated list
## Default definition
Macros 1 and 2 add two friend functions to the class which take care of the serialization and deserialization:
```cpp
friend void to_json(nlohmann::json&, const type&);
friend void from_json(const nlohmann::json&, type&);
```
Macros 3 and 4 add two functions to the namespace which take care of the serialization and deserialization:
```cpp
void to_json(nlohmann::json&, const type&);
void from_json(const nlohmann::json&, type&);
```
In both cases they call the `to_json`/`from_json` functions of the base type
before serializing/deserializing the members of the derived type:
```cpp
class A { /* ... */ };
class B : public A { /* ... */ };
void to_json(nlohmann::json& j, const B& b) {
nlohmann::to_json(j, static_cast<const A&>(b));
// ...
}
void from_json(const nlohmann::json& j, B& b) {
nlohmann::from_json(j, static_cast<A&>(b));
// ...
}
```
## Notes
!!! info "Prerequisites"
- Macros 1 and 2 have the same prerequisites of NLOHMANN_DEFINE_TYPE_INTRUSIVE.
- Macros 3 and 3 have the same prerequisites of NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE.
- Serialization/deserialization of base types must be defined.
!!! warning "Implementation limits"
- See Implementation limits for NLOHMANN_DEFINE_TYPE_INTRUSIVE and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE.
## Examples
Example of `NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE` usage:
```cpp
class A {
double Aa;
double Ab;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(A, Aa, Ab)
};
class B : public A {
int Ba;
int Bb;
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(B, A, Ba, Bb)
};
```
## See also
- [NLOHMANN_DEFINE_TYPE_INTRUSIVE / NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT](nlohmann_define_type_intrusive.md)
for similar macros that can be defined _inside_ a non-derived type.
- [NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE / NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT](nlohmann_define_type_non_intrusive.md)
for a similar macros that can be defined _outside_ a non-derived type.
- [Arbitrary Type Conversions](../../features/arbitrary_types.md) for an overview.
## Version history
1. Added in version 3.11.x.

View File

@ -265,7 +265,7 @@ struct bad_serializer
}
template <typename BasicJsonType>
static void to_json(const BasicJsonType& j, T& value) {
static void from_json(const BasicJsonType& j, T& value) {
// this calls BasicJsonType::json_serializer<T>::from_json(j, value);
// if BasicJsonType::json_serializer == bad_serializer ... oops!
value = j.template template get<T>(); // oops!

View File

@ -71,10 +71,10 @@ auto j = json::parse(R"({
})");
// access values
auto val = j["/"_json_pointer]; // {"array":["A","B","C"],...}
auto val = j[""_json_pointer]; // {"array":["A","B","C"],...}
auto val1 = j["/nested/one"_json_pointer]; // 1
auto val2 = j.at[json::json_pointer("/nested/three/1")]; // false
auto val3 = j.value[json::json_pointer("/nested/four", 0)]; // 0
auto val2 = j.at(json::json_pointer("/nested/three/1")); // false
auto val3 = j.value(json::json_pointer("/nested/four"), 0); // 0
```
## Flatten / unflatten

View File

@ -425,6 +425,32 @@
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
/*!
@brief macro
@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE
@since version 3.11.x
*/
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
/*!
@brief macro
@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE
@since version 3.11.x
*/
#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
// inspired from https://stackoverflow.com/a/26745591
// allows to call any std function as if (e.g. with begin):
// using std::begin; begin(x);

View File

@ -7,21 +7,21 @@
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Namespace nlohmann -->
<Type Name="nlohmann::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::detail::value_t::discarded">discarded</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
@ -37,21 +37,21 @@
<!-- Namespace nlohmann::json_abi -->
<Type Name="nlohmann::json_abi::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi::detail::value_t::discarded">discarded</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
@ -65,30 +65,30 @@
</Expand>
</Type>
<!-- Namespace nlohmann::json_abi_v3_11_2 -->
<Type Name="nlohmann::json_abi_v3_11_2::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::discarded">discarded</DisplayString>
<!-- Namespace nlohmann::json_abi_v3_11_3 -->
<Type Name="nlohmann::json_abi_v3_11_3::basic_json&lt;*&gt;">
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_v3_11_2::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_v3_11_3::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
<!-- Skip the pair first/second members in the treeview while traversing a map.
Only works in VS 2015 Update 2 and beyond using the new visualization -->
<Type Name="std::pair&lt;*, nlohmann::json_abi_v3_11_2::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<Type Name="std::pair&lt;*, nlohmann::json_abi_v3_11_3::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<DisplayString>{second}</DisplayString>
<Expand>
<ExpandedItem>second</ExpandedItem>
@ -97,21 +97,21 @@
<!-- Namespace nlohmann::json_abi_diag -->
<Type Name="nlohmann::json_abi_diag::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag::detail::value_t::discarded">discarded</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
@ -125,30 +125,30 @@
</Expand>
</Type>
<!-- Namespace nlohmann::json_abi_diag_v3_11_2 -->
<Type Name="nlohmann::json_abi_diag_v3_11_2::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::discarded">discarded</DisplayString>
<!-- Namespace nlohmann::json_abi_diag_v3_11_3 -->
<Type Name="nlohmann::json_abi_diag_v3_11_3::basic_json&lt;*&gt;">
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag_v3_11_2::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag_v3_11_3::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
<!-- Skip the pair first/second members in the treeview while traversing a map.
Only works in VS 2015 Update 2 and beyond using the new visualization -->
<Type Name="std::pair&lt;*, nlohmann::json_abi_diag_v3_11_2::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<Type Name="std::pair&lt;*, nlohmann::json_abi_diag_v3_11_3::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<DisplayString>{second}</DisplayString>
<Expand>
<ExpandedItem>second</ExpandedItem>
@ -157,21 +157,21 @@
<!-- Namespace nlohmann::json_abi_ldvcmp -->
<Type Name="nlohmann::json_abi_ldvcmp::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::discarded">discarded</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_ldvcmp::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_ldvcmp::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
@ -185,30 +185,30 @@
</Expand>
</Type>
<!-- Namespace nlohmann::json_abi_ldvcmp_v3_11_2 -->
<Type Name="nlohmann::json_abi_ldvcmp_v3_11_2::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::discarded">discarded</DisplayString>
<!-- Namespace nlohmann::json_abi_ldvcmp_v3_11_3 -->
<Type Name="nlohmann::json_abi_ldvcmp_v3_11_3::basic_json&lt;*&gt;">
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_ldvcmp_v3_11_2::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_ldvcmp_v3_11_3::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
<!-- Skip the pair first/second members in the treeview while traversing a map.
Only works in VS 2015 Update 2 and beyond using the new visualization -->
<Type Name="std::pair&lt;*, nlohmann::json_abi_ldvcmp_v3_11_2::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<Type Name="std::pair&lt;*, nlohmann::json_abi_ldvcmp_v3_11_3::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<DisplayString>{second}</DisplayString>
<Expand>
<ExpandedItem>second</ExpandedItem>
@ -217,21 +217,21 @@
<!-- Namespace nlohmann::json_abi_diag_ldvcmp -->
<Type Name="nlohmann::json_abi_diag_ldvcmp::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::discarded">discarded</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
@ -245,30 +245,30 @@
</Expand>
</Type>
<!-- Namespace nlohmann::json_abi_diag_ldvcmp_v3_11_2 -->
<Type Name="nlohmann::json_abi_diag_ldvcmp_v3_11_2::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::discarded">discarded</DisplayString>
<!-- Namespace nlohmann::json_abi_diag_ldvcmp_v3_11_3 -->
<Type Name="nlohmann::json_abi_diag_ldvcmp_v3_11_3::basic_json&lt;*&gt;">
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_2::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == nlohmann::json_abi_diag_ldvcmp_v3_11_3::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>
<!-- Skip the pair first/second members in the treeview while traversing a map.
Only works in VS 2015 Update 2 and beyond using the new visualization -->
<Type Name="std::pair&lt;*, nlohmann::json_abi_diag_ldvcmp_v3_11_2::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<Type Name="std::pair&lt;*, nlohmann::json_abi_diag_ldvcmp_v3_11_3::basic_json&lt;*&gt;&gt;" IncludeView="MapHelper">
<DisplayString>{second}</DisplayString>
<Expand>
<ExpandedItem>second</ExpandedItem>

View File

@ -41,7 +41,6 @@
// SPDX-License-Identifier: MIT
#include <utility>
// #include <nlohmann/detail/abi_macros.hpp>
@ -54,7 +53,6 @@
// SPDX-License-Identifier: MIT
// This file contains all macro definitions affecting or depending on the ABI
#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
@ -156,7 +154,6 @@
// SPDX-License-Identifier: MIT
#include <algorithm> // transform
#include <array> // array
#include <forward_list> // forward_list
@ -179,7 +176,6 @@
// SPDX-License-Identifier: MIT
#include <cstddef> // nullptr_t
#include <exception> // exception
#if JSON_DIAGNOSTICS
@ -199,7 +195,6 @@
// SPDX-License-Identifier: MIT
#include <array> // array
#include <cstddef> // size_t
#include <cstdint> // uint8_t
@ -215,7 +210,6 @@
// SPDX-License-Identifier: MIT
#include <utility> // declval, pair
// #include <nlohmann/detail/meta/detected.hpp>
// __ _____ _____ _____
@ -227,7 +221,6 @@
// SPDX-License-Identifier: MIT
#include <type_traits>
// #include <nlohmann/detail/meta/void_t.hpp>
@ -240,7 +233,6 @@
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/abi_macros.hpp>
@ -2777,6 +2769,33 @@ JSON_HEDLEY_DIAGNOSTIC_POP
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
/*!
@brief macro
@def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE
@since version 3.11.x
*/
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
#define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \
friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
/*!
@brief macro
@def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE
@since version 3.11.x
*/
#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
#define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \
inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast<const BaseType &>(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast<BaseType&>(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) }
// inspired from https://stackoverflow.com/a/26745591
// allows to call any std function as if (e.g. with begin):
// using std::begin; begin(x);
@ -2946,7 +2965,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/abi_macros.hpp>
@ -3021,7 +3039,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstddef> // size_t
// #include <nlohmann/detail/abi_macros.hpp>
@ -3064,7 +3081,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <array> // array
#include <cstddef> // size_t
#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
@ -3237,7 +3253,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <limits> // numeric_limits
#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
#include <utility> // declval
@ -3254,7 +3269,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <iterator> // random_access_iterator_tag
// #include <nlohmann/detail/abi_macros.hpp>
@ -3322,7 +3336,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/macro_scope.hpp>
@ -3342,7 +3355,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/macro_scope.hpp>
@ -4217,7 +4229,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstring> // strlen
#include <string> // string
#include <utility> // forward
@ -4603,7 +4614,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/abi_macros.hpp>
@ -4627,7 +4637,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/macro_scope.hpp>
@ -5152,7 +5161,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <algorithm> // copy
#include <iterator> // begin, end
#include <string> // string
@ -5172,7 +5180,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstddef> // size_t
#include <iterator> // input_iterator_tag
#include <string> // string, to_string
@ -5894,7 +5901,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstdint> // uint8_t, uint64_t
#include <tuple> // tie
#include <utility> // move
@ -6006,7 +6012,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstdint> // uint8_t
#include <cstddef> // size_t
#include <functional> // hash
@ -6139,7 +6144,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <algorithm> // generate_n
#include <array> // array
#include <cmath> // ldexp
@ -6165,7 +6169,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <array> // array
#include <cstddef> // size_t
#include <cstring> // strlen
@ -6662,7 +6665,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstddef>
#include <string> // string
#include <utility> // move
@ -7394,7 +7396,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <array> // array
#include <clocale> // localeconv
#include <cstddef> // size_t
@ -9035,7 +9036,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstdint> // size_t
#include <utility> // declval
#include <string> // string
@ -12187,7 +12187,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cmath> // isfinite
#include <cstdint> // uint8_t
#include <functional> // function
@ -12716,7 +12715,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
// #include <nlohmann/detail/abi_macros.hpp>
// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
@ -12729,7 +12727,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstddef> // ptrdiff_t
#include <limits> // numeric_limits
@ -12888,7 +12885,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <iterator> // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next
#include <type_traits> // conditional, is_const, remove_const
@ -13650,7 +13646,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <cstddef> // ptrdiff_t
#include <iterator> // reverse_iterator
#include <utility> // declval
@ -13827,7 +13822,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <algorithm> // all_of
#include <cctype> // isdigit
#include <cerrno> // errno, ERANGE
@ -14822,7 +14816,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <initializer_list>
#include <utility>
@ -14914,7 +14907,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <algorithm> // reverse
#include <array> // array
#include <map> // map
@ -14940,7 +14932,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <algorithm> // copy
#include <cstddef> // size_t
#include <iterator> // back_inserter
@ -16909,7 +16900,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <algorithm> // reverse, remove, fill, find, none_of
#include <array> // array
#include <clocale> // localeconv, lconv
@ -16934,7 +16924,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <array> // array
#include <cmath> // signbit, isfinite
#include <cstdint> // intN_t, uintN_t
@ -19029,7 +19018,6 @@ NLOHMANN_JSON_NAMESPACE_END
// SPDX-License-Identifier: MIT
#include <functional> // equal_to, less
#include <initializer_list> // initializer_list
#include <iterator> // input_iterator_tag, iterator_traits
@ -24583,7 +24571,6 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
// SPDX-License-Identifier: MIT
// restore clang diagnostic settings
#if defined(__clang__)
#pragma clang diagnostic pop
@ -24628,7 +24615,6 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
// SPDX-License-Identifier: MIT
#undef JSON_HEDLEY_ALWAYS_INLINE
#undef JSON_HEDLEY_ARM_VERSION
#undef JSON_HEDLEY_ARM_VERSION_CHECK
@ -24779,5 +24765,4 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
#undef JSON_HEDLEY_FALL_THROUGH
#endif // INCLUDE_NLOHMANN_JSON_HPP_

View File

@ -25,7 +25,6 @@
// SPDX-License-Identifier: MIT
// This file contains all macro definitions affecting or depending on the ABI
#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK

View File

@ -828,7 +828,7 @@ TEST_CASE("parser class")
// for ranges in range of IEEE 754-2008 binary64 (double precision)
// this does not accommodate 64 bit integers without loss of accuracy.
// As 64 bit integers are now widely used in software, it is desirable
// to expand support to to the full 64 bit (signed and unsigned) range
// to expand support to the full 64 bit (signed and unsigned) range
// i.e. -(2**63) -> (2**64)-1.
// -(2**63) ** Note: compilers see negative literals as negated positive numbers (hence the -1))

View File

@ -866,7 +866,7 @@ TEST_CASE("regression tests 2")
CHECK(j.dump() == "[1,4]");
}
SECTION("issue #3343 - json and ordered_json are not interchangable")
SECTION("issue #3343 - json and ordered_json are not interchangeable")
{
json::object_t jobj({ { "product", "one" } });
ordered_json::object_t ojobj({{"product", "one"}});

View File

@ -38,6 +38,26 @@ class person_with_private_data
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_data, age, name, metadata)
};
class derived_person_with_private_data : public person_with_private_data
{
private:
std::string hair_color{"blue"};
public:
bool operator==(const derived_person_with_private_data& rhs) const
{
return person_with_private_data::operator==(rhs) && hair_color == rhs.hair_color;
}
derived_person_with_private_data() = default;
derived_person_with_private_data(std::string name_, int age_, json metadata_, std::string hair_color_)
: person_with_private_data(std::move(name_), age_, std::move(metadata_))
, hair_color(std::move(hair_color_))
{}
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(derived_person_with_private_data, person_with_private_data, hair_color)
};
class person_with_private_data_2
{
private:
@ -74,6 +94,31 @@ class person_with_private_data_2
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(person_with_private_data_2, age, name, metadata)
};
class derived_person_with_private_data_2 : public person_with_private_data_2
{
private:
std::string hair_color{"blue"};
public:
bool operator==(const derived_person_with_private_data_2& rhs) const
{
return person_with_private_data_2::operator==(rhs) && hair_color == rhs.hair_color;
}
derived_person_with_private_data_2() = default;
derived_person_with_private_data_2(std::string name_, int age_, json metadata_, std::string hair_color_)
: person_with_private_data_2(std::move(name_), age_, std::move(metadata_))
, hair_color(std::move(hair_color_))
{}
std::string getHairColor() const
{
return hair_color;
}
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(derived_person_with_private_data_2, person_with_private_data_2, hair_color)
};
class person_without_private_data_1
{
public:
@ -96,6 +141,26 @@ class person_without_private_data_1
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_without_private_data_1, age, name, metadata)
};
class derived_person_without_private_data_1 : public person_without_private_data_1
{
public:
std::string hair_color{"blue"};
public:
bool operator==(const derived_person_without_private_data_1& rhs) const
{
return person_without_private_data_1::operator==(rhs) && hair_color == rhs.hair_color;
}
derived_person_without_private_data_1() = default;
derived_person_without_private_data_1(std::string name_, int age_, json metadata_, std::string hair_color_)
: person_without_private_data_1(std::move(name_), age_, std::move(metadata_))
, hair_color(std::move(hair_color_))
{}
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(derived_person_without_private_data_1, person_without_private_data_1, hair_color)
};
class person_without_private_data_2
{
public:
@ -118,6 +183,26 @@ class person_without_private_data_2
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_without_private_data_2, age, name, metadata)
class derived_person_without_private_data_2 : public person_without_private_data_2
{
public:
std::string hair_color{"blue"};
public:
bool operator==(const derived_person_without_private_data_2& rhs) const
{
return person_without_private_data_2::operator==(rhs) && hair_color == rhs.hair_color;
}
derived_person_without_private_data_2() = default;
derived_person_without_private_data_2(std::string name_, int age_, json metadata_, std::string hair_color_)
: person_without_private_data_2(std::move(name_), age_, std::move(metadata_))
, hair_color(std::move(hair_color_))
{}
};
NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(derived_person_without_private_data_2, person_without_private_data_2, hair_color)
class person_without_private_data_3
{
public:
@ -153,6 +238,31 @@ class person_without_private_data_3
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(person_without_private_data_3, age, name, metadata)
class derived_person_without_private_data_3 : public person_without_private_data_3
{
public:
std::string hair_color{"blue"};
public:
bool operator==(const derived_person_without_private_data_3& rhs) const
{
return person_without_private_data_3::operator==(rhs) && hair_color == rhs.hair_color;
}
derived_person_without_private_data_3() = default;
derived_person_without_private_data_3(std::string name_, int age_, json metadata_, std::string hair_color_)
: person_without_private_data_3(std::move(name_), age_, std::move(metadata_))
, hair_color(std::move(hair_color_))
{}
std::string getHairColor() const
{
return hair_color;
}
};
NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(derived_person_without_private_data_3, person_without_private_data_3, hair_color)
class person_with_private_alphabet
{
public:
@ -216,6 +326,19 @@ class person_with_private_alphabet
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_alphabet, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
};
class derived_person_with_private_alphabet : public person_with_private_alphabet
{
public:
bool operator==(const derived_person_with_private_alphabet& other) const
{
return person_with_private_alphabet::operator==(other) && schwa == other.schwa;
}
private:
int schwa = 0;
NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(derived_person_with_private_alphabet, person_with_private_alphabet, schwa)
};
class person_with_public_alphabet
{
public:
@ -349,6 +472,32 @@ TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRU
}
}
TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE and NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE", T,
persons::derived_person_with_private_data,
persons::derived_person_without_private_data_1,
persons::derived_person_without_private_data_2)
{
SECTION("person")
{
// serialization
T p1("Erik", 1, {{"haircuts", 2}}, "red");
CHECK(json(p1).dump() == "{\"age\":1,\"hair_color\":\"red\",\"metadata\":{\"haircuts\":2},\"name\":\"Erik\"}");
// deserialization
auto p2 = json(p1).get<T>();
CHECK(p2 == p1);
// roundtrip
CHECK(T(json(p1)) == p1);
CHECK(json(T(json(p1))) == json(p1));
// check exception in case of missing field
json j = json(p1);
j.erase("age");
CHECK_THROWS_WITH_AS(j.get<T>(), "[json.exception.out_of_range.403] key 'age' not found", json::out_of_range);
}
}
TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT", T,
persons::person_with_private_data_2,
persons::person_without_private_data_3)
@ -383,6 +532,42 @@ TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_TYPE_INTRU
}
}
TEST_CASE_TEMPLATE("Serialization/deserialization via NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT and NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT", T,
persons::derived_person_with_private_data_2,
persons::derived_person_without_private_data_3)
{
SECTION("derived person with default values")
{
// serialization of default constructed object
T p0;
CHECK(json(p0).dump() == "{\"age\":0,\"hair_color\":\"blue\",\"metadata\":null,\"name\":\"\"}");
// serialization
T p1("Erik", 1, {{"haircuts", 2}}, "red");
CHECK(json(p1).dump() == "{\"age\":1,\"hair_color\":\"red\",\"metadata\":{\"haircuts\":2},\"name\":\"Erik\"}");
// deserialization
auto p2 = json(p1).get<T>();
CHECK(p2 == p1);
// roundtrip
CHECK(T(json(p1)) == p1);
CHECK(json(T(json(p1))) == json(p1));
// check default value in case of missing field
json j = json(p1);
j.erase("name");
j.erase("age");
j.erase("metadata");
j.erase("hair_color");
T p3 = j.get<T>();
CHECK(p3.getName() == "");
CHECK(p3.getAge() == 0);
CHECK(p3.getMetadata() == nullptr);
CHECK(p3.getHairColor() == "blue");
}
}
TEST_CASE_TEMPLATE("Serialization/deserialization of classes with 26 public/private member variables via NLOHMANN_DEFINE_TYPE_INTRUSIVE and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE", T,
persons::person_with_private_alphabet,
persons::person_with_public_alphabet)

View File

@ -17,16 +17,16 @@ def json_lookup_function(val):
if m := ns_pattern.fullmatch(str(val.type.strip_typedefs().name)):
name = m.group('name')
if name and name.startswith('basic_json<') and name.endswith('>'):
m = ns_pattern.fullmatch(str(val['m_type']))
m = ns_pattern.fullmatch(str(val["m_data"]['m_type']))
t = m.group('name')
if t and t.startswith('detail::value_t::'):
try:
union_val = val['m_value'][t.removeprefix('detail::value_t::')]
union_val = val["m_data"]['m_value'][t.removeprefix('detail::value_t::')]
if union_val.type.code == gdb.TYPE_CODE_PTR:
return gdb.default_visualizer(union_val.dereference())
else:
return JsonValuePrinter(union_val)
except Exception:
return JsonValuePrinter(val['m_type'])
return JsonValuePrinter(val["m_data"]['m_type'])
gdb.pretty_printers.append(json_lookup_function)

View File

@ -8,21 +8,21 @@
{% for ns in namespaces %}
<!-- Namespace {{ ns }} -->
<Type Name="{{ ns }}::basic_json&lt;*&gt;">
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::object">{*(m_value.object)}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::array">{*(m_value.array)}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::string">{*(m_value.string)}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::boolean">{m_value.boolean}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::number_float">{m_value.number_float}</DisplayString>
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::discarded">discarded</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::null">null</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::discarded">discarded</DisplayString>
<Expand>
<ExpandedItem Condition="m_type == {{ ns }}::detail::value_t::object">
*(m_value.object),view(simple)
<ExpandedItem Condition="m_data.m_type == {{ ns }}::detail::value_t::object">
*(m_data.m_value.object),view(simple)
</ExpandedItem>
<ExpandedItem Condition="m_type == {{ ns }}::detail::value_t::array">
*(m_value.array),view(simple)
<ExpandedItem Condition="m_data.m_type == {{ ns }}::detail::value_t::array">
*(m_data.m_value.array),view(simple)
</ExpandedItem>
</Expand>
</Type>