|
42 | 42 | #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
|
43 | 43 | #endif
|
44 | 44 |
|
45 |
| -#define NLOHMANN_JSON_ABI_PREFIX_EX(major, minor, patch) \ |
46 |
| - json_v ## major ## _ ## minor ## _ ## patch |
47 |
| -#define NLOHMANN_JSON_ABI_PREFIX(major, minor, patch) \ |
48 |
| - NLOHMANN_JSON_ABI_PREFIX_EX(major, minor, patch) |
49 |
| - |
50 |
| -#define NLOHMANN_JSON_ABI_CONCAT_EX(a, b, c) a ## b ## c |
51 |
| -#define NLOHMANN_JSON_ABI_CONCAT(a, b, c) \ |
52 |
| - NLOHMANN_JSON_ABI_CONCAT_EX(a, b, c) |
53 |
| - |
54 |
| -#define NLOHMANN_JSON_ABI_STRING \ |
55 |
| - NLOHMANN_JSON_ABI_CONCAT( \ |
56 |
| - NLOHMANN_JSON_ABI_PREFIX( \ |
57 |
| - NLOHMANN_JSON_VERSION_MAJOR, \ |
58 |
| - NLOHMANN_JSON_VERSION_MINOR, \ |
59 |
| - NLOHMANN_JSON_VERSION_PATCH), \ |
60 |
| - NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ |
| 45 | +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION |
| 46 | + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 |
| 47 | +#endif |
| 48 | + |
| 49 | +// Construct the namespace ABI tags component |
| 50 | +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b |
| 51 | +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ |
| 52 | + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) |
| 53 | + |
| 54 | +#define NLOHMANN_JSON_ABI_TAGS \ |
| 55 | + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ |
| 56 | + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ |
61 | 57 | NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
|
62 | 58 |
|
| 59 | +// Construct the namespace version component |
| 60 | +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ |
| 61 | + _v ## major ## _ ## minor ## _ ## patch |
| 62 | +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ |
| 63 | + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) |
| 64 | + |
| 65 | +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION |
| 66 | +#define NLOHMANN_JSON_NAMESPACE_VERSION |
| 67 | +#else |
| 68 | +#define NLOHMANN_JSON_NAMESPACE_VERSION \ |
| 69 | + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ |
| 70 | + NLOHMANN_JSON_VERSION_MINOR, \ |
| 71 | + NLOHMANN_JSON_VERSION_PATCH) |
| 72 | +#endif |
| 73 | + |
| 74 | +// Combine namespace components |
| 75 | +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b |
| 76 | +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ |
| 77 | + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) |
| 78 | + |
63 | 79 | #ifndef NLOHMANN_JSON_NAMESPACE
|
64 |
| - #define NLOHMANN_JSON_NAMESPACE nlohmann::NLOHMANN_JSON_ABI_STRING |
| 80 | +#define NLOHMANN_JSON_NAMESPACE \ |
| 81 | + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ |
| 82 | + NLOHMANN_JSON_ABI_TAGS, \ |
| 83 | + NLOHMANN_JSON_NAMESPACE_VERSION) |
65 | 84 | #endif
|
66 | 85 |
|
67 | 86 | #ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
|
68 |
| -#define NLOHMANN_JSON_NAMESPACE_BEGIN \ |
69 |
| - namespace nlohmann \ |
70 |
| - { \ |
71 |
| - inline namespace NLOHMANN_JSON_ABI_STRING \ |
| 87 | +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ |
| 88 | + namespace nlohmann \ |
| 89 | + { \ |
| 90 | + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ |
| 91 | + NLOHMANN_JSON_ABI_TAGS, \ |
| 92 | + NLOHMANN_JSON_NAMESPACE_VERSION) \ |
72 | 93 | {
|
73 | 94 | #endif
|
74 | 95 |
|
75 | 96 | #ifndef NLOHMANN_JSON_NAMESPACE_END
|
76 |
| -#define NLOHMANN_JSON_NAMESPACE_END \ |
77 |
| - } /* namespace (abi_string) */ \ |
78 |
| - } /* namespace nlohmann */ |
| 97 | +#define NLOHMANN_JSON_NAMESPACE_END \ |
| 98 | + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ |
| 99 | + } // namespace nlohmann |
79 | 100 | #endif
|
0 commit comments