Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | __ _____ _____ _____ |
3 | | __| | __| | | | JSON for Modern C++ |
4 | | | | |__ | | | | | | version 3.10.4 |
5 | | |_____|_____|_____|_|___| https://github.com/nlohmann/json |
6 | | |
7 | | Licensed under the MIT License <http://opensource.org/licenses/MIT>. |
8 | | SPDX-License-Identifier: MIT |
9 | | Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>. |
10 | | |
11 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
12 | | of this software and associated documentation files (the "Software"), to deal |
13 | | in the Software without restriction, including without limitation the rights |
14 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
15 | | copies of the Software, and to permit persons to whom the Software is |
16 | | furnished to do so, subject to the following conditions: |
17 | | |
18 | | The above copyright notice and this permission notice shall be included in all |
19 | | copies or substantial portions of the Software. |
20 | | |
21 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
22 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
23 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
24 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
25 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
26 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
27 | | SOFTWARE. |
28 | | */ |
29 | | |
30 | | #ifndef INCLUDE_NLOHMANN_JSON_HPP_ |
31 | | #define INCLUDE_NLOHMANN_JSON_HPP_ |
32 | | |
33 | | #define NLOHMANN_JSON_VERSION_MAJOR 3 |
34 | | #define NLOHMANN_JSON_VERSION_MINOR 10 |
35 | | #define NLOHMANN_JSON_VERSION_PATCH 4 |
36 | | |
37 | | #include <algorithm> // all_of, find, for_each |
38 | | #include <cstddef> // nullptr_t, ptrdiff_t, size_t |
39 | | #include <functional> // hash, less |
40 | | #include <initializer_list> // initializer_list |
41 | | #ifndef JSON_NO_IO |
42 | | #include <iosfwd> // istream, ostream |
43 | | #endif // JSON_NO_IO |
44 | | #include <iterator> // random_access_iterator_tag |
45 | | #include <memory> // unique_ptr |
46 | | #include <numeric> // accumulate |
47 | | #include <string> // string, stoi, to_string |
48 | | #include <utility> // declval, forward, move, pair, swap |
49 | | #include <vector> // vector |
50 | | |
51 | | // #include <nlohmann/adl_serializer.hpp> |
52 | | |
53 | | |
54 | | #include <type_traits> |
55 | | #include <utility> |
56 | | |
57 | | // #include <nlohmann/detail/conversions/from_json.hpp> |
58 | | |
59 | | |
60 | | #include <algorithm> // transform |
61 | | #include <array> // array |
62 | | #include <forward_list> // forward_list |
63 | | #include <iterator> // inserter, front_inserter, end |
64 | | #include <map> // map |
65 | | #include <string> // string |
66 | | #include <tuple> // tuple, make_tuple |
67 | | #include <type_traits> // is_arithmetic, is_same, is_enum, underlying_type, is_convertible |
68 | | #include <unordered_map> // unordered_map |
69 | | #include <utility> // pair, declval |
70 | | #include <valarray> // valarray |
71 | | |
72 | | // #include <nlohmann/detail/exceptions.hpp> |
73 | | |
74 | | |
75 | | #include <exception> // exception |
76 | | #include <stdexcept> // runtime_error |
77 | | #include <string> // to_string |
78 | | #include <vector> // vector |
79 | | |
80 | | // #include <nlohmann/detail/value_t.hpp> |
81 | | |
82 | | |
83 | | #include <array> // array |
84 | | #include <cstddef> // size_t |
85 | | #include <cstdint> // uint8_t |
86 | | #include <string> // string |
87 | | |
88 | | namespace nlohmann |
89 | | { |
90 | | namespace detail |
91 | | { |
92 | | /////////////////////////// |
93 | | // JSON type enumeration // |
94 | | /////////////////////////// |
95 | | |
96 | | /*! |
97 | | @brief the JSON type enumeration |
98 | | |
99 | | This enumeration collects the different JSON types. It is internally used to |
100 | | distinguish the stored values, and the functions @ref basic_json::is_null(), |
101 | | @ref basic_json::is_object(), @ref basic_json::is_array(), |
102 | | @ref basic_json::is_string(), @ref basic_json::is_boolean(), |
103 | | @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), |
104 | | @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), |
105 | | @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and |
106 | | @ref basic_json::is_structured() rely on it. |
107 | | |
108 | | @note There are three enumeration entries (number_integer, number_unsigned, and |
109 | | number_float), because the library distinguishes these three types for numbers: |
110 | | @ref basic_json::number_unsigned_t is used for unsigned integers, |
111 | | @ref basic_json::number_integer_t is used for signed integers, and |
112 | | @ref basic_json::number_float_t is used for floating-point numbers or to |
113 | | approximate integers which do not fit in the limits of their respective type. |
114 | | |
115 | | @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON |
116 | | value with the default value for a given type |
117 | | |
118 | | @since version 1.0.0 |
119 | | */ |
120 | | enum class value_t : std::uint8_t |
121 | | { |
122 | | null, ///< null value |
123 | | object, ///< object (unordered set of name/value pairs) |
124 | | array, ///< array (ordered collection of values) |
125 | | string, ///< string value |
126 | | boolean, ///< boolean value |
127 | | number_integer, ///< number value (signed integer) |
128 | | number_unsigned, ///< number value (unsigned integer) |
129 | | number_float, ///< number value (floating-point) |
130 | | binary, ///< binary array (ordered collection of bytes) |
131 | | discarded ///< discarded by the parser callback function |
132 | | }; |
133 | | |
134 | | /*! |
135 | | @brief comparison operator for JSON types |
136 | | |
137 | | Returns an ordering that is similar to Python: |
138 | | - order: null < boolean < number < object < array < string < binary |
139 | | - furthermore, each type is not smaller than itself |
140 | | - discarded values are not comparable |
141 | | - binary is represented as a b"" string in python and directly comparable to a |
142 | | string; however, making a binary array directly comparable with a string would |
143 | | be surprising behavior in a JSON file. |
144 | | |
145 | | @since version 1.0.0 |
146 | | */ |
147 | | inline bool operator<(const value_t lhs, const value_t rhs) noexcept |
148 | 0 | { |
149 | 0 | static constexpr std::array<std::uint8_t, 9> order = {{ |
150 | 0 | 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, |
151 | 0 | 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, |
152 | 0 | 6 /* binary */ |
153 | 0 | } |
154 | 0 | }; |
155 | 0 |
|
156 | 0 | const auto l_index = static_cast<std::size_t>(lhs); |
157 | 0 | const auto r_index = static_cast<std::size_t>(rhs); |
158 | 0 | return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; |
159 | 0 | } |
160 | | } // namespace detail |
161 | | } // namespace nlohmann |
162 | | |
163 | | // #include <nlohmann/detail/string_escape.hpp> |
164 | | |
165 | | |
166 | | #include <string> |
167 | | // #include <nlohmann/detail/macro_scope.hpp> |
168 | | |
169 | | |
170 | | #include <utility> // declval, pair |
171 | | // #include <nlohmann/thirdparty/hedley/hedley.hpp> |
172 | | |
173 | | |
174 | | /* Hedley - https://nemequ.github.io/hedley |
175 | | * Created by Evan Nemerson <evan@nemerson.com> |
176 | | * |
177 | | * To the extent possible under law, the author(s) have dedicated all |
178 | | * copyright and related and neighboring rights to this software to |
179 | | * the public domain worldwide. This software is distributed without |
180 | | * any warranty. |
181 | | * |
182 | | * For details, see <http://creativecommons.org/publicdomain/zero/1.0/>. |
183 | | * SPDX-License-Identifier: CC0-1.0 |
184 | | */ |
185 | | |
186 | | #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) |
187 | | #if defined(JSON_HEDLEY_VERSION) |
188 | | #undef JSON_HEDLEY_VERSION |
189 | | #endif |
190 | | #define JSON_HEDLEY_VERSION 15 |
191 | | |
192 | | #if defined(JSON_HEDLEY_STRINGIFY_EX) |
193 | | #undef JSON_HEDLEY_STRINGIFY_EX |
194 | | #endif |
195 | | #define JSON_HEDLEY_STRINGIFY_EX(x) #x |
196 | | |
197 | | #if defined(JSON_HEDLEY_STRINGIFY) |
198 | | #undef JSON_HEDLEY_STRINGIFY |
199 | | #endif |
200 | | #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) |
201 | | |
202 | | #if defined(JSON_HEDLEY_CONCAT_EX) |
203 | | #undef JSON_HEDLEY_CONCAT_EX |
204 | | #endif |
205 | | #define JSON_HEDLEY_CONCAT_EX(a,b) a##b |
206 | | |
207 | | #if defined(JSON_HEDLEY_CONCAT) |
208 | | #undef JSON_HEDLEY_CONCAT |
209 | | #endif |
210 | | #define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) |
211 | | |
212 | | #if defined(JSON_HEDLEY_CONCAT3_EX) |
213 | | #undef JSON_HEDLEY_CONCAT3_EX |
214 | | #endif |
215 | | #define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c |
216 | | |
217 | | #if defined(JSON_HEDLEY_CONCAT3) |
218 | | #undef JSON_HEDLEY_CONCAT3 |
219 | | #endif |
220 | | #define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) |
221 | | |
222 | | #if defined(JSON_HEDLEY_VERSION_ENCODE) |
223 | | #undef JSON_HEDLEY_VERSION_ENCODE |
224 | | #endif |
225 | | #define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) |
226 | | |
227 | | #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) |
228 | | #undef JSON_HEDLEY_VERSION_DECODE_MAJOR |
229 | | #endif |
230 | | #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) |
231 | | |
232 | | #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) |
233 | | #undef JSON_HEDLEY_VERSION_DECODE_MINOR |
234 | | #endif |
235 | | #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) |
236 | | |
237 | | #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) |
238 | | #undef JSON_HEDLEY_VERSION_DECODE_REVISION |
239 | | #endif |
240 | | #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) |
241 | | |
242 | | #if defined(JSON_HEDLEY_GNUC_VERSION) |
243 | | #undef JSON_HEDLEY_GNUC_VERSION |
244 | | #endif |
245 | | #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) |
246 | | #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) |
247 | | #elif defined(__GNUC__) |
248 | | #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) |
249 | | #endif |
250 | | |
251 | | #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) |
252 | | #undef JSON_HEDLEY_GNUC_VERSION_CHECK |
253 | | #endif |
254 | | #if defined(JSON_HEDLEY_GNUC_VERSION) |
255 | | #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
256 | | #else |
257 | | #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) |
258 | | #endif |
259 | | |
260 | | #if defined(JSON_HEDLEY_MSVC_VERSION) |
261 | | #undef JSON_HEDLEY_MSVC_VERSION |
262 | | #endif |
263 | | #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) |
264 | | #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) |
265 | | #elif defined(_MSC_FULL_VER) && !defined(__ICL) |
266 | | #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) |
267 | | #elif defined(_MSC_VER) && !defined(__ICL) |
268 | | #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) |
269 | | #endif |
270 | | |
271 | | #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) |
272 | | #undef JSON_HEDLEY_MSVC_VERSION_CHECK |
273 | | #endif |
274 | | #if !defined(JSON_HEDLEY_MSVC_VERSION) |
275 | | #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) |
276 | | #elif defined(_MSC_VER) && (_MSC_VER >= 1400) |
277 | | #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) |
278 | | #elif defined(_MSC_VER) && (_MSC_VER >= 1200) |
279 | | #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) |
280 | | #else |
281 | | #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) |
282 | | #endif |
283 | | |
284 | | #if defined(JSON_HEDLEY_INTEL_VERSION) |
285 | | #undef JSON_HEDLEY_INTEL_VERSION |
286 | | #endif |
287 | | #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) |
288 | | #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) |
289 | | #elif defined(__INTEL_COMPILER) && !defined(__ICL) |
290 | | #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) |
291 | | #endif |
292 | | |
293 | | #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) |
294 | | #undef JSON_HEDLEY_INTEL_VERSION_CHECK |
295 | | #endif |
296 | | #if defined(JSON_HEDLEY_INTEL_VERSION) |
297 | | #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
298 | | #else |
299 | | #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) |
300 | | #endif |
301 | | |
302 | | #if defined(JSON_HEDLEY_INTEL_CL_VERSION) |
303 | | #undef JSON_HEDLEY_INTEL_CL_VERSION |
304 | | #endif |
305 | | #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) |
306 | | #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) |
307 | | #endif |
308 | | |
309 | | #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) |
310 | | #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK |
311 | | #endif |
312 | | #if defined(JSON_HEDLEY_INTEL_CL_VERSION) |
313 | | #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
314 | | #else |
315 | | #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) |
316 | | #endif |
317 | | |
318 | | #if defined(JSON_HEDLEY_PGI_VERSION) |
319 | | #undef JSON_HEDLEY_PGI_VERSION |
320 | | #endif |
321 | | #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) |
322 | | #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) |
323 | | #endif |
324 | | |
325 | | #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) |
326 | | #undef JSON_HEDLEY_PGI_VERSION_CHECK |
327 | | #endif |
328 | | #if defined(JSON_HEDLEY_PGI_VERSION) |
329 | | #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
330 | | #else |
331 | | #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) |
332 | | #endif |
333 | | |
334 | | #if defined(JSON_HEDLEY_SUNPRO_VERSION) |
335 | | #undef JSON_HEDLEY_SUNPRO_VERSION |
336 | | #endif |
337 | | #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) |
338 | | #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) |
339 | | #elif defined(__SUNPRO_C) |
340 | | #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) |
341 | | #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) |
342 | | #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) |
343 | | #elif defined(__SUNPRO_CC) |
344 | | #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) |
345 | | #endif |
346 | | |
347 | | #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) |
348 | | #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK |
349 | | #endif |
350 | | #if defined(JSON_HEDLEY_SUNPRO_VERSION) |
351 | | #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
352 | | #else |
353 | | #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) |
354 | | #endif |
355 | | |
356 | | #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) |
357 | | #undef JSON_HEDLEY_EMSCRIPTEN_VERSION |
358 | | #endif |
359 | | #if defined(__EMSCRIPTEN__) |
360 | | #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) |
361 | | #endif |
362 | | |
363 | | #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) |
364 | | #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK |
365 | | #endif |
366 | | #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) |
367 | | #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
368 | | #else |
369 | | #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) |
370 | | #endif |
371 | | |
372 | | #if defined(JSON_HEDLEY_ARM_VERSION) |
373 | | #undef JSON_HEDLEY_ARM_VERSION |
374 | | #endif |
375 | | #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) |
376 | | #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) |
377 | | #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) |
378 | | #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) |
379 | | #endif |
380 | | |
381 | | #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) |
382 | | #undef JSON_HEDLEY_ARM_VERSION_CHECK |
383 | | #endif |
384 | | #if defined(JSON_HEDLEY_ARM_VERSION) |
385 | | #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
386 | | #else |
387 | | #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) |
388 | | #endif |
389 | | |
390 | | #if defined(JSON_HEDLEY_IBM_VERSION) |
391 | | #undef JSON_HEDLEY_IBM_VERSION |
392 | | #endif |
393 | | #if defined(__ibmxl__) |
394 | | #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) |
395 | | #elif defined(__xlC__) && defined(__xlC_ver__) |
396 | | #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) |
397 | | #elif defined(__xlC__) |
398 | | #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) |
399 | | #endif |
400 | | |
401 | | #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) |
402 | | #undef JSON_HEDLEY_IBM_VERSION_CHECK |
403 | | #endif |
404 | | #if defined(JSON_HEDLEY_IBM_VERSION) |
405 | | #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
406 | | #else |
407 | | #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) |
408 | | #endif |
409 | | |
410 | | #if defined(JSON_HEDLEY_TI_VERSION) |
411 | | #undef JSON_HEDLEY_TI_VERSION |
412 | | #endif |
413 | | #if \ |
414 | | defined(__TI_COMPILER_VERSION__) && \ |
415 | | ( \ |
416 | | defined(__TMS470__) || defined(__TI_ARM__) || \ |
417 | | defined(__MSP430__) || \ |
418 | | defined(__TMS320C2000__) \ |
419 | | ) |
420 | | #if (__TI_COMPILER_VERSION__ >= 16000000) |
421 | | #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
422 | | #endif |
423 | | #endif |
424 | | |
425 | | #if defined(JSON_HEDLEY_TI_VERSION_CHECK) |
426 | | #undef JSON_HEDLEY_TI_VERSION_CHECK |
427 | | #endif |
428 | | #if defined(JSON_HEDLEY_TI_VERSION) |
429 | | #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
430 | | #else |
431 | | #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) |
432 | | #endif |
433 | | |
434 | | #if defined(JSON_HEDLEY_TI_CL2000_VERSION) |
435 | | #undef JSON_HEDLEY_TI_CL2000_VERSION |
436 | | #endif |
437 | | #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) |
438 | | #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
439 | | #endif |
440 | | |
441 | | #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) |
442 | | #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK |
443 | | #endif |
444 | | #if defined(JSON_HEDLEY_TI_CL2000_VERSION) |
445 | | #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
446 | | #else |
447 | | #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) |
448 | | #endif |
449 | | |
450 | | #if defined(JSON_HEDLEY_TI_CL430_VERSION) |
451 | | #undef JSON_HEDLEY_TI_CL430_VERSION |
452 | | #endif |
453 | | #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) |
454 | | #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
455 | | #endif |
456 | | |
457 | | #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) |
458 | | #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK |
459 | | #endif |
460 | | #if defined(JSON_HEDLEY_TI_CL430_VERSION) |
461 | | #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
462 | | #else |
463 | | #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) |
464 | | #endif |
465 | | |
466 | | #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) |
467 | | #undef JSON_HEDLEY_TI_ARMCL_VERSION |
468 | | #endif |
469 | | #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) |
470 | | #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
471 | | #endif |
472 | | |
473 | | #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) |
474 | | #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK |
475 | | #endif |
476 | | #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) |
477 | | #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
478 | | #else |
479 | | #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) |
480 | | #endif |
481 | | |
482 | | #if defined(JSON_HEDLEY_TI_CL6X_VERSION) |
483 | | #undef JSON_HEDLEY_TI_CL6X_VERSION |
484 | | #endif |
485 | | #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) |
486 | | #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
487 | | #endif |
488 | | |
489 | | #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) |
490 | | #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK |
491 | | #endif |
492 | | #if defined(JSON_HEDLEY_TI_CL6X_VERSION) |
493 | | #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
494 | | #else |
495 | | #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) |
496 | | #endif |
497 | | |
498 | | #if defined(JSON_HEDLEY_TI_CL7X_VERSION) |
499 | | #undef JSON_HEDLEY_TI_CL7X_VERSION |
500 | | #endif |
501 | | #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) |
502 | | #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
503 | | #endif |
504 | | |
505 | | #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) |
506 | | #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK |
507 | | #endif |
508 | | #if defined(JSON_HEDLEY_TI_CL7X_VERSION) |
509 | | #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
510 | | #else |
511 | | #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) |
512 | | #endif |
513 | | |
514 | | #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) |
515 | | #undef JSON_HEDLEY_TI_CLPRU_VERSION |
516 | | #endif |
517 | | #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) |
518 | | #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) |
519 | | #endif |
520 | | |
521 | | #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) |
522 | | #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK |
523 | | #endif |
524 | | #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) |
525 | | #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
526 | | #else |
527 | | #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) |
528 | | #endif |
529 | | |
530 | | #if defined(JSON_HEDLEY_CRAY_VERSION) |
531 | | #undef JSON_HEDLEY_CRAY_VERSION |
532 | | #endif |
533 | | #if defined(_CRAYC) |
534 | | #if defined(_RELEASE_PATCHLEVEL) |
535 | | #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) |
536 | | #else |
537 | | #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) |
538 | | #endif |
539 | | #endif |
540 | | |
541 | | #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) |
542 | | #undef JSON_HEDLEY_CRAY_VERSION_CHECK |
543 | | #endif |
544 | | #if defined(JSON_HEDLEY_CRAY_VERSION) |
545 | | #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
546 | | #else |
547 | | #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) |
548 | | #endif |
549 | | |
550 | | #if defined(JSON_HEDLEY_IAR_VERSION) |
551 | | #undef JSON_HEDLEY_IAR_VERSION |
552 | | #endif |
553 | | #if defined(__IAR_SYSTEMS_ICC__) |
554 | | #if __VER__ > 1000 |
555 | | #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) |
556 | | #else |
557 | | #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) |
558 | | #endif |
559 | | #endif |
560 | | |
561 | | #if defined(JSON_HEDLEY_IAR_VERSION_CHECK) |
562 | | #undef JSON_HEDLEY_IAR_VERSION_CHECK |
563 | | #endif |
564 | | #if defined(JSON_HEDLEY_IAR_VERSION) |
565 | | #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
566 | | #else |
567 | | #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) |
568 | | #endif |
569 | | |
570 | | #if defined(JSON_HEDLEY_TINYC_VERSION) |
571 | | #undef JSON_HEDLEY_TINYC_VERSION |
572 | | #endif |
573 | | #if defined(__TINYC__) |
574 | | #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) |
575 | | #endif |
576 | | |
577 | | #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) |
578 | | #undef JSON_HEDLEY_TINYC_VERSION_CHECK |
579 | | #endif |
580 | | #if defined(JSON_HEDLEY_TINYC_VERSION) |
581 | | #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
582 | | #else |
583 | | #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) |
584 | | #endif |
585 | | |
586 | | #if defined(JSON_HEDLEY_DMC_VERSION) |
587 | | #undef JSON_HEDLEY_DMC_VERSION |
588 | | #endif |
589 | | #if defined(__DMC__) |
590 | | #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) |
591 | | #endif |
592 | | |
593 | | #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) |
594 | | #undef JSON_HEDLEY_DMC_VERSION_CHECK |
595 | | #endif |
596 | | #if defined(JSON_HEDLEY_DMC_VERSION) |
597 | | #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
598 | | #else |
599 | | #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) |
600 | | #endif |
601 | | |
602 | | #if defined(JSON_HEDLEY_COMPCERT_VERSION) |
603 | | #undef JSON_HEDLEY_COMPCERT_VERSION |
604 | | #endif |
605 | | #if defined(__COMPCERT_VERSION__) |
606 | | #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) |
607 | | #endif |
608 | | |
609 | | #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) |
610 | | #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK |
611 | | #endif |
612 | | #if defined(JSON_HEDLEY_COMPCERT_VERSION) |
613 | | #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
614 | | #else |
615 | | #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) |
616 | | #endif |
617 | | |
618 | | #if defined(JSON_HEDLEY_PELLES_VERSION) |
619 | | #undef JSON_HEDLEY_PELLES_VERSION |
620 | | #endif |
621 | | #if defined(__POCC__) |
622 | | #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) |
623 | | #endif |
624 | | |
625 | | #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) |
626 | | #undef JSON_HEDLEY_PELLES_VERSION_CHECK |
627 | | #endif |
628 | | #if defined(JSON_HEDLEY_PELLES_VERSION) |
629 | | #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
630 | | #else |
631 | | #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) |
632 | | #endif |
633 | | |
634 | | #if defined(JSON_HEDLEY_MCST_LCC_VERSION) |
635 | | #undef JSON_HEDLEY_MCST_LCC_VERSION |
636 | | #endif |
637 | | #if defined(__LCC__) && defined(__LCC_MINOR__) |
638 | | #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) |
639 | | #endif |
640 | | |
641 | | #if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) |
642 | | #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK |
643 | | #endif |
644 | | #if defined(JSON_HEDLEY_MCST_LCC_VERSION) |
645 | | #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
646 | | #else |
647 | | #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) |
648 | | #endif |
649 | | |
650 | | #if defined(JSON_HEDLEY_GCC_VERSION) |
651 | | #undef JSON_HEDLEY_GCC_VERSION |
652 | | #endif |
653 | | #if \ |
654 | | defined(JSON_HEDLEY_GNUC_VERSION) && \ |
655 | | !defined(__clang__) && \ |
656 | | !defined(JSON_HEDLEY_INTEL_VERSION) && \ |
657 | | !defined(JSON_HEDLEY_PGI_VERSION) && \ |
658 | | !defined(JSON_HEDLEY_ARM_VERSION) && \ |
659 | | !defined(JSON_HEDLEY_CRAY_VERSION) && \ |
660 | | !defined(JSON_HEDLEY_TI_VERSION) && \ |
661 | | !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ |
662 | | !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ |
663 | | !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ |
664 | | !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ |
665 | | !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ |
666 | | !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ |
667 | | !defined(__COMPCERT__) && \ |
668 | | !defined(JSON_HEDLEY_MCST_LCC_VERSION) |
669 | | #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION |
670 | | #endif |
671 | | |
672 | | #if defined(JSON_HEDLEY_GCC_VERSION_CHECK) |
673 | | #undef JSON_HEDLEY_GCC_VERSION_CHECK |
674 | | #endif |
675 | | #if defined(JSON_HEDLEY_GCC_VERSION) |
676 | | #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) |
677 | | #else |
678 | | #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) |
679 | | #endif |
680 | | |
681 | | #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) |
682 | | #undef JSON_HEDLEY_HAS_ATTRIBUTE |
683 | | #endif |
684 | | #if \ |
685 | | defined(__has_attribute) && \ |
686 | | ( \ |
687 | | (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ |
688 | | ) |
689 | | # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) |
690 | | #else |
691 | | # define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) |
692 | | #endif |
693 | | |
694 | | #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) |
695 | | #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE |
696 | | #endif |
697 | | #if defined(__has_attribute) |
698 | | #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) |
699 | | #else |
700 | | #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
701 | | #endif |
702 | | |
703 | | #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) |
704 | | #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE |
705 | | #endif |
706 | | #if defined(__has_attribute) |
707 | | #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) |
708 | | #else |
709 | | #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
710 | | #endif |
711 | | |
712 | | #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) |
713 | | #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE |
714 | | #endif |
715 | | #if \ |
716 | | defined(__has_cpp_attribute) && \ |
717 | | defined(__cplusplus) && \ |
718 | | (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) |
719 | | #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) |
720 | | #else |
721 | | #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) |
722 | | #endif |
723 | | |
724 | | #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) |
725 | | #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS |
726 | | #endif |
727 | | #if !defined(__cplusplus) || !defined(__has_cpp_attribute) |
728 | | #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) |
729 | | #elif \ |
730 | | !defined(JSON_HEDLEY_PGI_VERSION) && \ |
731 | | !defined(JSON_HEDLEY_IAR_VERSION) && \ |
732 | | (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ |
733 | | (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) |
734 | | #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) |
735 | | #else |
736 | | #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) |
737 | | #endif |
738 | | |
739 | | #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) |
740 | | #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE |
741 | | #endif |
742 | | #if defined(__has_cpp_attribute) && defined(__cplusplus) |
743 | | #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) |
744 | | #else |
745 | | #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
746 | | #endif |
747 | | |
748 | | #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) |
749 | | #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE |
750 | | #endif |
751 | | #if defined(__has_cpp_attribute) && defined(__cplusplus) |
752 | | #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) |
753 | | #else |
754 | | #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
755 | | #endif |
756 | | |
757 | | #if defined(JSON_HEDLEY_HAS_BUILTIN) |
758 | | #undef JSON_HEDLEY_HAS_BUILTIN |
759 | | #endif |
760 | | #if defined(__has_builtin) |
761 | | #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) |
762 | | #else |
763 | | #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) |
764 | | #endif |
765 | | |
766 | | #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) |
767 | | #undef JSON_HEDLEY_GNUC_HAS_BUILTIN |
768 | | #endif |
769 | | #if defined(__has_builtin) |
770 | | #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) |
771 | | #else |
772 | | #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
773 | | #endif |
774 | | |
775 | | #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) |
776 | | #undef JSON_HEDLEY_GCC_HAS_BUILTIN |
777 | | #endif |
778 | | #if defined(__has_builtin) |
779 | | #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) |
780 | | #else |
781 | | #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
782 | | #endif |
783 | | |
784 | | #if defined(JSON_HEDLEY_HAS_FEATURE) |
785 | | #undef JSON_HEDLEY_HAS_FEATURE |
786 | | #endif |
787 | | #if defined(__has_feature) |
788 | | #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) |
789 | | #else |
790 | | #define JSON_HEDLEY_HAS_FEATURE(feature) (0) |
791 | | #endif |
792 | | |
793 | | #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) |
794 | | #undef JSON_HEDLEY_GNUC_HAS_FEATURE |
795 | | #endif |
796 | | #if defined(__has_feature) |
797 | | #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) |
798 | | #else |
799 | | #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
800 | | #endif |
801 | | |
802 | | #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) |
803 | | #undef JSON_HEDLEY_GCC_HAS_FEATURE |
804 | | #endif |
805 | | #if defined(__has_feature) |
806 | | #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) |
807 | | #else |
808 | | #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
809 | | #endif |
810 | | |
811 | | #if defined(JSON_HEDLEY_HAS_EXTENSION) |
812 | | #undef JSON_HEDLEY_HAS_EXTENSION |
813 | | #endif |
814 | | #if defined(__has_extension) |
815 | | #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) |
816 | | #else |
817 | | #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) |
818 | | #endif |
819 | | |
820 | | #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) |
821 | | #undef JSON_HEDLEY_GNUC_HAS_EXTENSION |
822 | | #endif |
823 | | #if defined(__has_extension) |
824 | | #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) |
825 | | #else |
826 | | #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
827 | | #endif |
828 | | |
829 | | #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) |
830 | | #undef JSON_HEDLEY_GCC_HAS_EXTENSION |
831 | | #endif |
832 | | #if defined(__has_extension) |
833 | | #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) |
834 | | #else |
835 | | #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
836 | | #endif |
837 | | |
838 | | #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) |
839 | | #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE |
840 | | #endif |
841 | | #if defined(__has_declspec_attribute) |
842 | | #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) |
843 | | #else |
844 | | #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) |
845 | | #endif |
846 | | |
847 | | #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) |
848 | | #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE |
849 | | #endif |
850 | | #if defined(__has_declspec_attribute) |
851 | | #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) |
852 | | #else |
853 | | #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
854 | | #endif |
855 | | |
856 | | #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) |
857 | | #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE |
858 | | #endif |
859 | | #if defined(__has_declspec_attribute) |
860 | | #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) |
861 | | #else |
862 | | #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
863 | | #endif |
864 | | |
865 | | #if defined(JSON_HEDLEY_HAS_WARNING) |
866 | | #undef JSON_HEDLEY_HAS_WARNING |
867 | | #endif |
868 | | #if defined(__has_warning) |
869 | | #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) |
870 | | #else |
871 | | #define JSON_HEDLEY_HAS_WARNING(warning) (0) |
872 | | #endif |
873 | | |
874 | | #if defined(JSON_HEDLEY_GNUC_HAS_WARNING) |
875 | | #undef JSON_HEDLEY_GNUC_HAS_WARNING |
876 | | #endif |
877 | | #if defined(__has_warning) |
878 | | #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) |
879 | | #else |
880 | | #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) |
881 | | #endif |
882 | | |
883 | | #if defined(JSON_HEDLEY_GCC_HAS_WARNING) |
884 | | #undef JSON_HEDLEY_GCC_HAS_WARNING |
885 | | #endif |
886 | | #if defined(__has_warning) |
887 | | #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) |
888 | | #else |
889 | | #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
890 | | #endif |
891 | | |
892 | | #if \ |
893 | | (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ |
894 | | defined(__clang__) || \ |
895 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ |
896 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
897 | | JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ |
898 | | JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ |
899 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
900 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
901 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ |
902 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ |
903 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ |
904 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ |
905 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
906 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
907 | | JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ |
908 | | JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ |
909 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ |
910 | | (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) |
911 | | #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) |
912 | | #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) |
913 | | #define JSON_HEDLEY_PRAGMA(value) __pragma(value) |
914 | | #else |
915 | | #define JSON_HEDLEY_PRAGMA(value) |
916 | | #endif |
917 | | |
918 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) |
919 | | #undef JSON_HEDLEY_DIAGNOSTIC_PUSH |
920 | | #endif |
921 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) |
922 | | #undef JSON_HEDLEY_DIAGNOSTIC_POP |
923 | | #endif |
924 | | #if defined(__clang__) |
925 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") |
926 | | #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") |
927 | | #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
928 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") |
929 | | #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") |
930 | | #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) |
931 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") |
932 | | #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") |
933 | | #elif \ |
934 | | JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ |
935 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
936 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) |
937 | | #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) |
938 | | #elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) |
939 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") |
940 | | #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") |
941 | | #elif \ |
942 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
943 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
944 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ |
945 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ |
946 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
947 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) |
948 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") |
949 | | #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") |
950 | | #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) |
951 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") |
952 | | #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") |
953 | | #else |
954 | | #define JSON_HEDLEY_DIAGNOSTIC_PUSH |
955 | | #define JSON_HEDLEY_DIAGNOSTIC_POP |
956 | | #endif |
957 | | |
958 | | /* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for |
959 | | HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ |
960 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) |
961 | | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ |
962 | | #endif |
963 | | #if defined(__cplusplus) |
964 | | # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") |
965 | | # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") |
966 | | # if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") |
967 | | # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ |
968 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
969 | | _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ |
970 | | _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ |
971 | | _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ |
972 | | xpr \ |
973 | | JSON_HEDLEY_DIAGNOSTIC_POP |
974 | | # else |
975 | | # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ |
976 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
977 | | _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ |
978 | | _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ |
979 | | xpr \ |
980 | | JSON_HEDLEY_DIAGNOSTIC_POP |
981 | | # endif |
982 | | # else |
983 | | # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ |
984 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
985 | | _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ |
986 | | xpr \ |
987 | | JSON_HEDLEY_DIAGNOSTIC_POP |
988 | | # endif |
989 | | # endif |
990 | | #endif |
991 | | #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) |
992 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x |
993 | | #endif |
994 | | |
995 | | #if defined(JSON_HEDLEY_CONST_CAST) |
996 | | #undef JSON_HEDLEY_CONST_CAST |
997 | | #endif |
998 | | #if defined(__cplusplus) |
999 | | # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr)) |
1000 | | #elif \ |
1001 | | JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ |
1002 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ |
1003 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
1004 | | # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ |
1005 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
1006 | | JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ |
1007 | | ((T) (expr)); \ |
1008 | | JSON_HEDLEY_DIAGNOSTIC_POP \ |
1009 | | })) |
1010 | | #else |
1011 | | # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) |
1012 | | #endif |
1013 | | |
1014 | | #if defined(JSON_HEDLEY_REINTERPRET_CAST) |
1015 | | #undef JSON_HEDLEY_REINTERPRET_CAST |
1016 | | #endif |
1017 | | #if defined(__cplusplus) |
1018 | | #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr)) |
1019 | | #else |
1020 | | #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) |
1021 | | #endif |
1022 | | |
1023 | | #if defined(JSON_HEDLEY_STATIC_CAST) |
1024 | | #undef JSON_HEDLEY_STATIC_CAST |
1025 | | #endif |
1026 | | #if defined(__cplusplus) |
1027 | | #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr)) |
1028 | | #else |
1029 | | #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) |
1030 | | #endif |
1031 | | |
1032 | | #if defined(JSON_HEDLEY_CPP_CAST) |
1033 | | #undef JSON_HEDLEY_CPP_CAST |
1034 | | #endif |
1035 | | #if defined(__cplusplus) |
1036 | | # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") |
1037 | | # define JSON_HEDLEY_CPP_CAST(T, expr) \ |
1038 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
1039 | | _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ |
1040 | | ((T) (expr)) \ |
1041 | | JSON_HEDLEY_DIAGNOSTIC_POP |
1042 | | # elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) |
1043 | | # define JSON_HEDLEY_CPP_CAST(T, expr) \ |
1044 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
1045 | | _Pragma("diag_suppress=Pe137") \ |
1046 | | JSON_HEDLEY_DIAGNOSTIC_POP |
1047 | | # else |
1048 | | # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) |
1049 | | # endif |
1050 | | #else |
1051 | | # define JSON_HEDLEY_CPP_CAST(T, expr) (expr) |
1052 | | #endif |
1053 | | |
1054 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) |
1055 | | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED |
1056 | | #endif |
1057 | | #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") |
1058 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") |
1059 | | #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
1060 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") |
1061 | | #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1062 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) |
1063 | | #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) |
1064 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") |
1065 | | #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) |
1066 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") |
1067 | | #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) |
1068 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") |
1069 | | #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) |
1070 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) |
1071 | | #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1072 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") |
1073 | | #elif \ |
1074 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1075 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1076 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1077 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1078 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1079 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1080 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1081 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1082 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1083 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1084 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) |
1085 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") |
1086 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) |
1087 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") |
1088 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) |
1089 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") |
1090 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1091 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") |
1092 | | #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) |
1093 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") |
1094 | | #else |
1095 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED |
1096 | | #endif |
1097 | | |
1098 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) |
1099 | | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS |
1100 | | #endif |
1101 | | #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") |
1102 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") |
1103 | | #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
1104 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") |
1105 | | #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1106 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) |
1107 | | #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) |
1108 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") |
1109 | | #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) |
1110 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") |
1111 | | #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) |
1112 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) |
1113 | | #elif \ |
1114 | | JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ |
1115 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ |
1116 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1117 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) |
1118 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") |
1119 | | #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) |
1120 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") |
1121 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1122 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") |
1123 | | #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1124 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") |
1125 | | #else |
1126 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS |
1127 | | #endif |
1128 | | |
1129 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) |
1130 | | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES |
1131 | | #endif |
1132 | | #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") |
1133 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") |
1134 | | #elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) |
1135 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") |
1136 | | #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) |
1137 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") |
1138 | | #elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1139 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) |
1140 | | #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) |
1141 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) |
1142 | | #elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) |
1143 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") |
1144 | | #elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) |
1145 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") |
1146 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) |
1147 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") |
1148 | | #elif \ |
1149 | | JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ |
1150 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ |
1151 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) |
1152 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") |
1153 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1154 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") |
1155 | | #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1156 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") |
1157 | | #else |
1158 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES |
1159 | | #endif |
1160 | | |
1161 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) |
1162 | | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL |
1163 | | #endif |
1164 | | #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") |
1165 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") |
1166 | | #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
1167 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") |
1168 | | #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) |
1169 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") |
1170 | | #else |
1171 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL |
1172 | | #endif |
1173 | | |
1174 | | #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) |
1175 | | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION |
1176 | | #endif |
1177 | | #if JSON_HEDLEY_HAS_WARNING("-Wunused-function") |
1178 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") |
1179 | | #elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) |
1180 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") |
1181 | | #elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) |
1182 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) |
1183 | | #elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1184 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") |
1185 | | #else |
1186 | | #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION |
1187 | | #endif |
1188 | | |
1189 | | #if defined(JSON_HEDLEY_DEPRECATED) |
1190 | | #undef JSON_HEDLEY_DEPRECATED |
1191 | | #endif |
1192 | | #if defined(JSON_HEDLEY_DEPRECATED_FOR) |
1193 | | #undef JSON_HEDLEY_DEPRECATED_FOR |
1194 | | #endif |
1195 | | #if \ |
1196 | | JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ |
1197 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1198 | | #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) |
1199 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) |
1200 | | #elif \ |
1201 | | (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ |
1202 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ |
1203 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1204 | | JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ |
1205 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ |
1206 | | JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ |
1207 | | JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ |
1208 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ |
1209 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ |
1210 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1211 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ |
1212 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1213 | | #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) |
1214 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) |
1215 | | #elif defined(__cplusplus) && (__cplusplus >= 201402L) |
1216 | | #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) |
1217 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) |
1218 | | #elif \ |
1219 | | JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ |
1220 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ |
1221 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1222 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1223 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1224 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1225 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1226 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1227 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1228 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1229 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1230 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1231 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1232 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1233 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ |
1234 | | JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) |
1235 | | #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) |
1236 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) |
1237 | | #elif \ |
1238 | | JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ |
1239 | | JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ |
1240 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1241 | | #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) |
1242 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) |
1243 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1244 | | #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") |
1245 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") |
1246 | | #else |
1247 | | #define JSON_HEDLEY_DEPRECATED(since) |
1248 | | #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) |
1249 | | #endif |
1250 | | |
1251 | | #if defined(JSON_HEDLEY_UNAVAILABLE) |
1252 | | #undef JSON_HEDLEY_UNAVAILABLE |
1253 | | #endif |
1254 | | #if \ |
1255 | | JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ |
1256 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ |
1257 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1258 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1259 | | #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) |
1260 | | #else |
1261 | | #define JSON_HEDLEY_UNAVAILABLE(available_since) |
1262 | | #endif |
1263 | | |
1264 | | #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) |
1265 | | #undef JSON_HEDLEY_WARN_UNUSED_RESULT |
1266 | | #endif |
1267 | | #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) |
1268 | | #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG |
1269 | | #endif |
1270 | | #if \ |
1271 | | JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ |
1272 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ |
1273 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1274 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1275 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1276 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1277 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1278 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1279 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1280 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1281 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1282 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1283 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1284 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1285 | | (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ |
1286 | | JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ |
1287 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1288 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) |
1289 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) |
1290 | | #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) |
1291 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) |
1292 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) |
1293 | | #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) |
1294 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) |
1295 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) |
1296 | | #elif defined(_Check_return_) /* SAL */ |
1297 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ |
1298 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ |
1299 | | #else |
1300 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT |
1301 | | #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) |
1302 | | #endif |
1303 | | |
1304 | | #if defined(JSON_HEDLEY_SENTINEL) |
1305 | | #undef JSON_HEDLEY_SENTINEL |
1306 | | #endif |
1307 | | #if \ |
1308 | | JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ |
1309 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ |
1310 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1311 | | JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ |
1312 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1313 | | #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) |
1314 | | #else |
1315 | | #define JSON_HEDLEY_SENTINEL(position) |
1316 | | #endif |
1317 | | |
1318 | | #if defined(JSON_HEDLEY_NO_RETURN) |
1319 | | #undef JSON_HEDLEY_NO_RETURN |
1320 | | #endif |
1321 | | #if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1322 | | #define JSON_HEDLEY_NO_RETURN __noreturn |
1323 | | #elif \ |
1324 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1325 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1326 | | #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) |
1327 | | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L |
1328 | | #define JSON_HEDLEY_NO_RETURN _Noreturn |
1329 | | #elif defined(__cplusplus) && (__cplusplus >= 201103L) |
1330 | | #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) |
1331 | | #elif \ |
1332 | | JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ |
1333 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ |
1334 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1335 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1336 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1337 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1338 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1339 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1340 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1341 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1342 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1343 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1344 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1345 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1346 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1347 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1348 | | JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) |
1349 | | #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) |
1350 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) |
1351 | | #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") |
1352 | | #elif \ |
1353 | | JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ |
1354 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1355 | | #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) |
1356 | | #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) |
1357 | | #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") |
1358 | | #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) |
1359 | | #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) |
1360 | | #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) |
1361 | | #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) |
1362 | | #else |
1363 | | #define JSON_HEDLEY_NO_RETURN |
1364 | | #endif |
1365 | | |
1366 | | #if defined(JSON_HEDLEY_NO_ESCAPE) |
1367 | | #undef JSON_HEDLEY_NO_ESCAPE |
1368 | | #endif |
1369 | | #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) |
1370 | | #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) |
1371 | | #else |
1372 | | #define JSON_HEDLEY_NO_ESCAPE |
1373 | | #endif |
1374 | | |
1375 | | #if defined(JSON_HEDLEY_UNREACHABLE) |
1376 | | #undef JSON_HEDLEY_UNREACHABLE |
1377 | | #endif |
1378 | | #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) |
1379 | | #undef JSON_HEDLEY_UNREACHABLE_RETURN |
1380 | | #endif |
1381 | | #if defined(JSON_HEDLEY_ASSUME) |
1382 | | #undef JSON_HEDLEY_ASSUME |
1383 | | #endif |
1384 | | #if \ |
1385 | | JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ |
1386 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1387 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1388 | | #define JSON_HEDLEY_ASSUME(expr) __assume(expr) |
1389 | | #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) |
1390 | | #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) |
1391 | | #elif \ |
1392 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ |
1393 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) |
1394 | | #if defined(__cplusplus) |
1395 | | #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) |
1396 | | #else |
1397 | | #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) |
1398 | | #endif |
1399 | | #endif |
1400 | | #if \ |
1401 | | (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ |
1402 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ |
1403 | | JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ |
1404 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1405 | | JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ |
1406 | | JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ |
1407 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1408 | | #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() |
1409 | | #elif defined(JSON_HEDLEY_ASSUME) |
1410 | | #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) |
1411 | | #endif |
1412 | | #if !defined(JSON_HEDLEY_ASSUME) |
1413 | | #if defined(JSON_HEDLEY_UNREACHABLE) |
1414 | | #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) |
1415 | | #else |
1416 | | #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) |
1417 | | #endif |
1418 | | #endif |
1419 | | #if defined(JSON_HEDLEY_UNREACHABLE) |
1420 | | #if \ |
1421 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ |
1422 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) |
1423 | | #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) |
1424 | | #else |
1425 | | #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() |
1426 | | #endif |
1427 | | #else |
1428 | | #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) |
1429 | | #endif |
1430 | | #if !defined(JSON_HEDLEY_UNREACHABLE) |
1431 | | #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) |
1432 | | #endif |
1433 | | |
1434 | | JSON_HEDLEY_DIAGNOSTIC_PUSH |
1435 | | #if JSON_HEDLEY_HAS_WARNING("-Wpedantic") |
1436 | | #pragma clang diagnostic ignored "-Wpedantic" |
1437 | | #endif |
1438 | | #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) |
1439 | | #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" |
1440 | | #endif |
1441 | | #if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) |
1442 | | #if defined(__clang__) |
1443 | | #pragma clang diagnostic ignored "-Wvariadic-macros" |
1444 | | #elif defined(JSON_HEDLEY_GCC_VERSION) |
1445 | | #pragma GCC diagnostic ignored "-Wvariadic-macros" |
1446 | | #endif |
1447 | | #endif |
1448 | | #if defined(JSON_HEDLEY_NON_NULL) |
1449 | | #undef JSON_HEDLEY_NON_NULL |
1450 | | #endif |
1451 | | #if \ |
1452 | | JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ |
1453 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ |
1454 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1455 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) |
1456 | | #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) |
1457 | | #else |
1458 | | #define JSON_HEDLEY_NON_NULL(...) |
1459 | | #endif |
1460 | | JSON_HEDLEY_DIAGNOSTIC_POP |
1461 | | |
1462 | | #if defined(JSON_HEDLEY_PRINTF_FORMAT) |
1463 | | #undef JSON_HEDLEY_PRINTF_FORMAT |
1464 | | #endif |
1465 | | #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) |
1466 | | #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) |
1467 | | #elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) |
1468 | | #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) |
1469 | | #elif \ |
1470 | | JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ |
1471 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ |
1472 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1473 | | JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ |
1474 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1475 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1476 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1477 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1478 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1479 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1480 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1481 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1482 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1483 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1484 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1485 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1486 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1487 | | #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) |
1488 | | #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) |
1489 | | #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) |
1490 | | #else |
1491 | | #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) |
1492 | | #endif |
1493 | | |
1494 | | #if defined(JSON_HEDLEY_CONSTEXPR) |
1495 | | #undef JSON_HEDLEY_CONSTEXPR |
1496 | | #endif |
1497 | | #if defined(__cplusplus) |
1498 | | #if __cplusplus >= 201103L |
1499 | | #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) |
1500 | | #endif |
1501 | | #endif |
1502 | | #if !defined(JSON_HEDLEY_CONSTEXPR) |
1503 | | #define JSON_HEDLEY_CONSTEXPR |
1504 | | #endif |
1505 | | |
1506 | | #if defined(JSON_HEDLEY_PREDICT) |
1507 | | #undef JSON_HEDLEY_PREDICT |
1508 | | #endif |
1509 | | #if defined(JSON_HEDLEY_LIKELY) |
1510 | | #undef JSON_HEDLEY_LIKELY |
1511 | | #endif |
1512 | | #if defined(JSON_HEDLEY_UNLIKELY) |
1513 | | #undef JSON_HEDLEY_UNLIKELY |
1514 | | #endif |
1515 | | #if defined(JSON_HEDLEY_UNPREDICTABLE) |
1516 | | #undef JSON_HEDLEY_UNPREDICTABLE |
1517 | | #endif |
1518 | | #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) |
1519 | | #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) |
1520 | | #endif |
1521 | | #if \ |
1522 | | (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ |
1523 | | JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ |
1524 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1525 | | # define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) |
1526 | | # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) |
1527 | | # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) |
1528 | 212M | # define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) |
1529 | 30.1M | # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) |
1530 | | #elif \ |
1531 | | (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ |
1532 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ |
1533 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1534 | | (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ |
1535 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1536 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1537 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1538 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ |
1539 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ |
1540 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ |
1541 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ |
1542 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1543 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1544 | | JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ |
1545 | | JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ |
1546 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1547 | | # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ |
1548 | | (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) |
1549 | | # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ |
1550 | | (__extension__ ({ \ |
1551 | | double hedley_probability_ = (probability); \ |
1552 | | ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ |
1553 | | })) |
1554 | | # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ |
1555 | | (__extension__ ({ \ |
1556 | | double hedley_probability_ = (probability); \ |
1557 | | ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ |
1558 | | })) |
1559 | | # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) |
1560 | | # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) |
1561 | | #else |
1562 | | # define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) |
1563 | | # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) |
1564 | | # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) |
1565 | | # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) |
1566 | | # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) |
1567 | | #endif |
1568 | | #if !defined(JSON_HEDLEY_UNPREDICTABLE) |
1569 | | #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) |
1570 | | #endif |
1571 | | |
1572 | | #if defined(JSON_HEDLEY_MALLOC) |
1573 | | #undef JSON_HEDLEY_MALLOC |
1574 | | #endif |
1575 | | #if \ |
1576 | | JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ |
1577 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ |
1578 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1579 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1580 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1581 | | JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ |
1582 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1583 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1584 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1585 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1586 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1587 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1588 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1589 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1590 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1591 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1592 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1593 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1594 | | #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) |
1595 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) |
1596 | | #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") |
1597 | | #elif \ |
1598 | | JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ |
1599 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1600 | | #define JSON_HEDLEY_MALLOC __declspec(restrict) |
1601 | | #else |
1602 | | #define JSON_HEDLEY_MALLOC |
1603 | | #endif |
1604 | | |
1605 | | #if defined(JSON_HEDLEY_PURE) |
1606 | | #undef JSON_HEDLEY_PURE |
1607 | | #endif |
1608 | | #if \ |
1609 | | JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ |
1610 | | JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ |
1611 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1612 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1613 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1614 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1615 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1616 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1617 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1618 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1619 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1620 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1621 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1622 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1623 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1624 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1625 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1626 | | JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ |
1627 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1628 | | # define JSON_HEDLEY_PURE __attribute__((__pure__)) |
1629 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) |
1630 | | # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") |
1631 | | #elif defined(__cplusplus) && \ |
1632 | | ( \ |
1633 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ |
1634 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ |
1635 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ |
1636 | | ) |
1637 | | # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") |
1638 | | #else |
1639 | | # define JSON_HEDLEY_PURE |
1640 | | #endif |
1641 | | |
1642 | | #if defined(JSON_HEDLEY_CONST) |
1643 | | #undef JSON_HEDLEY_CONST |
1644 | | #endif |
1645 | | #if \ |
1646 | | JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ |
1647 | | JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ |
1648 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1649 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1650 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1651 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1652 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1653 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1654 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1655 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1656 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1657 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1658 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1659 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1660 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1661 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1662 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1663 | | JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ |
1664 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1665 | | #define JSON_HEDLEY_CONST __attribute__((__const__)) |
1666 | | #elif \ |
1667 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) |
1668 | | #define JSON_HEDLEY_CONST _Pragma("no_side_effect") |
1669 | | #else |
1670 | | #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE |
1671 | | #endif |
1672 | | |
1673 | | #if defined(JSON_HEDLEY_RESTRICT) |
1674 | | #undef JSON_HEDLEY_RESTRICT |
1675 | | #endif |
1676 | | #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) |
1677 | | #define JSON_HEDLEY_RESTRICT restrict |
1678 | | #elif \ |
1679 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ |
1680 | | JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ |
1681 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1682 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ |
1683 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1684 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1685 | | JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ |
1686 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1687 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ |
1688 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ |
1689 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1690 | | (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ |
1691 | | JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ |
1692 | | defined(__clang__) || \ |
1693 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1694 | | #define JSON_HEDLEY_RESTRICT __restrict |
1695 | | #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) |
1696 | | #define JSON_HEDLEY_RESTRICT _Restrict |
1697 | | #else |
1698 | | #define JSON_HEDLEY_RESTRICT |
1699 | | #endif |
1700 | | |
1701 | | #if defined(JSON_HEDLEY_INLINE) |
1702 | | #undef JSON_HEDLEY_INLINE |
1703 | | #endif |
1704 | | #if \ |
1705 | | (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ |
1706 | | (defined(__cplusplus) && (__cplusplus >= 199711L)) |
1707 | | #define JSON_HEDLEY_INLINE inline |
1708 | | #elif \ |
1709 | | defined(JSON_HEDLEY_GCC_VERSION) || \ |
1710 | | JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) |
1711 | | #define JSON_HEDLEY_INLINE __inline__ |
1712 | | #elif \ |
1713 | | JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ |
1714 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ |
1715 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1716 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ |
1717 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ |
1718 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ |
1719 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ |
1720 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1721 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1722 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1723 | | #define JSON_HEDLEY_INLINE __inline |
1724 | | #else |
1725 | | #define JSON_HEDLEY_INLINE |
1726 | | #endif |
1727 | | |
1728 | | #if defined(JSON_HEDLEY_ALWAYS_INLINE) |
1729 | | #undef JSON_HEDLEY_ALWAYS_INLINE |
1730 | | #endif |
1731 | | #if \ |
1732 | | JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ |
1733 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ |
1734 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1735 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1736 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1737 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1738 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1739 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1740 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1741 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1742 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1743 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1744 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1745 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1746 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1747 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1748 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1749 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ |
1750 | | JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) |
1751 | | # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE |
1752 | | #elif \ |
1753 | | JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ |
1754 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1755 | | # define JSON_HEDLEY_ALWAYS_INLINE __forceinline |
1756 | | #elif defined(__cplusplus) && \ |
1757 | | ( \ |
1758 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1759 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1760 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1761 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ |
1762 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1763 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ |
1764 | | ) |
1765 | | # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") |
1766 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1767 | | # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") |
1768 | | #else |
1769 | | # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE |
1770 | | #endif |
1771 | | |
1772 | | #if defined(JSON_HEDLEY_NEVER_INLINE) |
1773 | | #undef JSON_HEDLEY_NEVER_INLINE |
1774 | | #endif |
1775 | | #if \ |
1776 | | JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ |
1777 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ |
1778 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1779 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1780 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1781 | | JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ |
1782 | | JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ |
1783 | | (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1784 | | JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ |
1785 | | (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1786 | | JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ |
1787 | | (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1788 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ |
1789 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1790 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ |
1791 | | JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ |
1792 | | JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ |
1793 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ |
1794 | | JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) |
1795 | | #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) |
1796 | | #elif \ |
1797 | | JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ |
1798 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
1799 | | #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) |
1800 | | #elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) |
1801 | | #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") |
1802 | | #elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) |
1803 | | #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") |
1804 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
1805 | | #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") |
1806 | | #elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) |
1807 | | #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) |
1808 | | #elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) |
1809 | | #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) |
1810 | | #else |
1811 | | #define JSON_HEDLEY_NEVER_INLINE |
1812 | | #endif |
1813 | | |
1814 | | #if defined(JSON_HEDLEY_PRIVATE) |
1815 | | #undef JSON_HEDLEY_PRIVATE |
1816 | | #endif |
1817 | | #if defined(JSON_HEDLEY_PUBLIC) |
1818 | | #undef JSON_HEDLEY_PUBLIC |
1819 | | #endif |
1820 | | #if defined(JSON_HEDLEY_IMPORT) |
1821 | | #undef JSON_HEDLEY_IMPORT |
1822 | | #endif |
1823 | | #if defined(_WIN32) || defined(__CYGWIN__) |
1824 | | # define JSON_HEDLEY_PRIVATE |
1825 | | # define JSON_HEDLEY_PUBLIC __declspec(dllexport) |
1826 | | # define JSON_HEDLEY_IMPORT __declspec(dllimport) |
1827 | | #else |
1828 | | # if \ |
1829 | | JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ |
1830 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ |
1831 | | JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ |
1832 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1833 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1834 | | JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ |
1835 | | ( \ |
1836 | | defined(__TI_EABI__) && \ |
1837 | | ( \ |
1838 | | (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ |
1839 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ |
1840 | | ) \ |
1841 | | ) || \ |
1842 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1843 | | # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) |
1844 | | # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) |
1845 | | # else |
1846 | | # define JSON_HEDLEY_PRIVATE |
1847 | | # define JSON_HEDLEY_PUBLIC |
1848 | | # endif |
1849 | | # define JSON_HEDLEY_IMPORT extern |
1850 | | #endif |
1851 | | |
1852 | | #if defined(JSON_HEDLEY_NO_THROW) |
1853 | | #undef JSON_HEDLEY_NO_THROW |
1854 | | #endif |
1855 | | #if \ |
1856 | | JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ |
1857 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ |
1858 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1859 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1860 | | #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) |
1861 | | #elif \ |
1862 | | JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ |
1863 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ |
1864 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) |
1865 | | #define JSON_HEDLEY_NO_THROW __declspec(nothrow) |
1866 | | #else |
1867 | | #define JSON_HEDLEY_NO_THROW |
1868 | | #endif |
1869 | | |
1870 | | #if defined(JSON_HEDLEY_FALL_THROUGH) |
1871 | | #undef JSON_HEDLEY_FALL_THROUGH |
1872 | | #endif |
1873 | | #if \ |
1874 | | JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ |
1875 | | JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ |
1876 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1877 | | #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) |
1878 | | #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) |
1879 | | #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) |
1880 | | #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) |
1881 | | #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) |
1882 | | #elif defined(__fallthrough) /* SAL */ |
1883 | | #define JSON_HEDLEY_FALL_THROUGH __fallthrough |
1884 | | #else |
1885 | | #define JSON_HEDLEY_FALL_THROUGH |
1886 | | #endif |
1887 | | |
1888 | | #if defined(JSON_HEDLEY_RETURNS_NON_NULL) |
1889 | | #undef JSON_HEDLEY_RETURNS_NON_NULL |
1890 | | #endif |
1891 | | #if \ |
1892 | | JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ |
1893 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ |
1894 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1895 | | #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) |
1896 | | #elif defined(_Ret_notnull_) /* SAL */ |
1897 | | #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ |
1898 | | #else |
1899 | | #define JSON_HEDLEY_RETURNS_NON_NULL |
1900 | | #endif |
1901 | | |
1902 | | #if defined(JSON_HEDLEY_ARRAY_PARAM) |
1903 | | #undef JSON_HEDLEY_ARRAY_PARAM |
1904 | | #endif |
1905 | | #if \ |
1906 | | defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ |
1907 | | !defined(__STDC_NO_VLA__) && \ |
1908 | | !defined(__cplusplus) && \ |
1909 | | !defined(JSON_HEDLEY_PGI_VERSION) && \ |
1910 | | !defined(JSON_HEDLEY_TINYC_VERSION) |
1911 | | #define JSON_HEDLEY_ARRAY_PARAM(name) (name) |
1912 | | #else |
1913 | | #define JSON_HEDLEY_ARRAY_PARAM(name) |
1914 | | #endif |
1915 | | |
1916 | | #if defined(JSON_HEDLEY_IS_CONSTANT) |
1917 | | #undef JSON_HEDLEY_IS_CONSTANT |
1918 | | #endif |
1919 | | #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) |
1920 | | #undef JSON_HEDLEY_REQUIRE_CONSTEXPR |
1921 | | #endif |
1922 | | /* JSON_HEDLEY_IS_CONSTEXPR_ is for |
1923 | | HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ |
1924 | | #if defined(JSON_HEDLEY_IS_CONSTEXPR_) |
1925 | | #undef JSON_HEDLEY_IS_CONSTEXPR_ |
1926 | | #endif |
1927 | | #if \ |
1928 | | JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ |
1929 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ |
1930 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1931 | | JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ |
1932 | | JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ |
1933 | | JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ |
1934 | | JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ |
1935 | | (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ |
1936 | | JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ |
1937 | | JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) |
1938 | | #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) |
1939 | | #endif |
1940 | | #if !defined(__cplusplus) |
1941 | | # if \ |
1942 | | JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ |
1943 | | JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ |
1944 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
1945 | | JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ |
1946 | | JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ |
1947 | | JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ |
1948 | | JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) |
1949 | | #if defined(__INTPTR_TYPE__) |
1950 | | #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) |
1951 | | #else |
1952 | | #include <stdint.h> |
1953 | | #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) |
1954 | | #endif |
1955 | | # elif \ |
1956 | | ( \ |
1957 | | defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ |
1958 | | !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ |
1959 | | !defined(JSON_HEDLEY_PGI_VERSION) && \ |
1960 | | !defined(JSON_HEDLEY_IAR_VERSION)) || \ |
1961 | | (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ |
1962 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ |
1963 | | JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ |
1964 | | JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ |
1965 | | JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) |
1966 | | #if defined(__INTPTR_TYPE__) |
1967 | | #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) |
1968 | | #else |
1969 | | #include <stdint.h> |
1970 | | #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) |
1971 | | #endif |
1972 | | # elif \ |
1973 | | defined(JSON_HEDLEY_GCC_VERSION) || \ |
1974 | | defined(JSON_HEDLEY_INTEL_VERSION) || \ |
1975 | | defined(JSON_HEDLEY_TINYC_VERSION) || \ |
1976 | | defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ |
1977 | | JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ |
1978 | | defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ |
1979 | | defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ |
1980 | | defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ |
1981 | | defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ |
1982 | | defined(__clang__) |
1983 | | # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ |
1984 | | sizeof(void) != \ |
1985 | | sizeof(*( \ |
1986 | | 1 ? \ |
1987 | | ((void*) ((expr) * 0L) ) : \ |
1988 | | ((struct { char v[sizeof(void) * 2]; } *) 1) \ |
1989 | | ) \ |
1990 | | ) \ |
1991 | | ) |
1992 | | # endif |
1993 | | #endif |
1994 | | #if defined(JSON_HEDLEY_IS_CONSTEXPR_) |
1995 | | #if !defined(JSON_HEDLEY_IS_CONSTANT) |
1996 | | #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) |
1997 | | #endif |
1998 | | #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) |
1999 | | #else |
2000 | | #if !defined(JSON_HEDLEY_IS_CONSTANT) |
2001 | | #define JSON_HEDLEY_IS_CONSTANT(expr) (0) |
2002 | | #endif |
2003 | | #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) |
2004 | | #endif |
2005 | | |
2006 | | #if defined(JSON_HEDLEY_BEGIN_C_DECLS) |
2007 | | #undef JSON_HEDLEY_BEGIN_C_DECLS |
2008 | | #endif |
2009 | | #if defined(JSON_HEDLEY_END_C_DECLS) |
2010 | | #undef JSON_HEDLEY_END_C_DECLS |
2011 | | #endif |
2012 | | #if defined(JSON_HEDLEY_C_DECL) |
2013 | | #undef JSON_HEDLEY_C_DECL |
2014 | | #endif |
2015 | | #if defined(__cplusplus) |
2016 | | #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { |
2017 | | #define JSON_HEDLEY_END_C_DECLS } |
2018 | | #define JSON_HEDLEY_C_DECL extern "C" |
2019 | | #else |
2020 | | #define JSON_HEDLEY_BEGIN_C_DECLS |
2021 | | #define JSON_HEDLEY_END_C_DECLS |
2022 | | #define JSON_HEDLEY_C_DECL |
2023 | | #endif |
2024 | | |
2025 | | #if defined(JSON_HEDLEY_STATIC_ASSERT) |
2026 | | #undef JSON_HEDLEY_STATIC_ASSERT |
2027 | | #endif |
2028 | | #if \ |
2029 | | !defined(__cplusplus) && ( \ |
2030 | | (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ |
2031 | | (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ |
2032 | | JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ |
2033 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ |
2034 | | defined(_Static_assert) \ |
2035 | | ) |
2036 | | # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) |
2037 | | #elif \ |
2038 | | (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ |
2039 | | JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ |
2040 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
2041 | | # define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) |
2042 | | #else |
2043 | | # define JSON_HEDLEY_STATIC_ASSERT(expr, message) |
2044 | | #endif |
2045 | | |
2046 | | #if defined(JSON_HEDLEY_NULL) |
2047 | | #undef JSON_HEDLEY_NULL |
2048 | | #endif |
2049 | | #if defined(__cplusplus) |
2050 | | #if __cplusplus >= 201103L |
2051 | | #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) |
2052 | | #elif defined(NULL) |
2053 | | #define JSON_HEDLEY_NULL NULL |
2054 | | #else |
2055 | | #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) |
2056 | | #endif |
2057 | | #elif defined(NULL) |
2058 | | #define JSON_HEDLEY_NULL NULL |
2059 | | #else |
2060 | | #define JSON_HEDLEY_NULL ((void*) 0) |
2061 | | #endif |
2062 | | |
2063 | | #if defined(JSON_HEDLEY_MESSAGE) |
2064 | | #undef JSON_HEDLEY_MESSAGE |
2065 | | #endif |
2066 | | #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") |
2067 | | # define JSON_HEDLEY_MESSAGE(msg) \ |
2068 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
2069 | | JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ |
2070 | | JSON_HEDLEY_PRAGMA(message msg) \ |
2071 | | JSON_HEDLEY_DIAGNOSTIC_POP |
2072 | | #elif \ |
2073 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ |
2074 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
2075 | | # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) |
2076 | | #elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) |
2077 | | # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) |
2078 | | #elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) |
2079 | | # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) |
2080 | | #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) |
2081 | | # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) |
2082 | | #else |
2083 | | # define JSON_HEDLEY_MESSAGE(msg) |
2084 | | #endif |
2085 | | |
2086 | | #if defined(JSON_HEDLEY_WARNING) |
2087 | | #undef JSON_HEDLEY_WARNING |
2088 | | #endif |
2089 | | #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") |
2090 | | # define JSON_HEDLEY_WARNING(msg) \ |
2091 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
2092 | | JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ |
2093 | | JSON_HEDLEY_PRAGMA(clang warning msg) \ |
2094 | | JSON_HEDLEY_DIAGNOSTIC_POP |
2095 | | #elif \ |
2096 | | JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ |
2097 | | JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ |
2098 | | JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) |
2099 | | # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) |
2100 | | #elif \ |
2101 | | JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ |
2102 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
2103 | | # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) |
2104 | | #else |
2105 | | # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) |
2106 | | #endif |
2107 | | |
2108 | | #if defined(JSON_HEDLEY_REQUIRE) |
2109 | | #undef JSON_HEDLEY_REQUIRE |
2110 | | #endif |
2111 | | #if defined(JSON_HEDLEY_REQUIRE_MSG) |
2112 | | #undef JSON_HEDLEY_REQUIRE_MSG |
2113 | | #endif |
2114 | | #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) |
2115 | | # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") |
2116 | | # define JSON_HEDLEY_REQUIRE(expr) \ |
2117 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
2118 | | _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ |
2119 | | __attribute__((diagnose_if(!(expr), #expr, "error"))) \ |
2120 | | JSON_HEDLEY_DIAGNOSTIC_POP |
2121 | | # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ |
2122 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
2123 | | _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ |
2124 | | __attribute__((diagnose_if(!(expr), msg, "error"))) \ |
2125 | | JSON_HEDLEY_DIAGNOSTIC_POP |
2126 | | # else |
2127 | | # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) |
2128 | | # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) |
2129 | | # endif |
2130 | | #else |
2131 | | # define JSON_HEDLEY_REQUIRE(expr) |
2132 | | # define JSON_HEDLEY_REQUIRE_MSG(expr,msg) |
2133 | | #endif |
2134 | | |
2135 | | #if defined(JSON_HEDLEY_FLAGS) |
2136 | | #undef JSON_HEDLEY_FLAGS |
2137 | | #endif |
2138 | | #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) |
2139 | | #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) |
2140 | | #else |
2141 | | #define JSON_HEDLEY_FLAGS |
2142 | | #endif |
2143 | | |
2144 | | #if defined(JSON_HEDLEY_FLAGS_CAST) |
2145 | | #undef JSON_HEDLEY_FLAGS_CAST |
2146 | | #endif |
2147 | | #if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) |
2148 | | # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ |
2149 | | JSON_HEDLEY_DIAGNOSTIC_PUSH \ |
2150 | | _Pragma("warning(disable:188)") \ |
2151 | | ((T) (expr)); \ |
2152 | | JSON_HEDLEY_DIAGNOSTIC_POP \ |
2153 | | })) |
2154 | | #else |
2155 | | # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) |
2156 | | #endif |
2157 | | |
2158 | | #if defined(JSON_HEDLEY_EMPTY_BASES) |
2159 | | #undef JSON_HEDLEY_EMPTY_BASES |
2160 | | #endif |
2161 | | #if \ |
2162 | | (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ |
2163 | | JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) |
2164 | | #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) |
2165 | | #else |
2166 | | #define JSON_HEDLEY_EMPTY_BASES |
2167 | | #endif |
2168 | | |
2169 | | /* Remaining macros are deprecated. */ |
2170 | | |
2171 | | #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) |
2172 | | #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK |
2173 | | #endif |
2174 | | #if defined(__clang__) |
2175 | | #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) |
2176 | | #else |
2177 | | #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) |
2178 | | #endif |
2179 | | |
2180 | | #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) |
2181 | | #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE |
2182 | | #endif |
2183 | | #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) |
2184 | | |
2185 | | #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) |
2186 | | #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE |
2187 | | #endif |
2188 | | #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) |
2189 | | |
2190 | | #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) |
2191 | | #undef JSON_HEDLEY_CLANG_HAS_BUILTIN |
2192 | | #endif |
2193 | | #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) |
2194 | | |
2195 | | #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) |
2196 | | #undef JSON_HEDLEY_CLANG_HAS_FEATURE |
2197 | | #endif |
2198 | | #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) |
2199 | | |
2200 | | #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) |
2201 | | #undef JSON_HEDLEY_CLANG_HAS_EXTENSION |
2202 | | #endif |
2203 | | #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) |
2204 | | |
2205 | | #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) |
2206 | | #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE |
2207 | | #endif |
2208 | | #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) |
2209 | | |
2210 | | #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) |
2211 | | #undef JSON_HEDLEY_CLANG_HAS_WARNING |
2212 | | #endif |
2213 | | #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) |
2214 | | |
2215 | | #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ |
2216 | | |
2217 | | // #include <nlohmann/detail/meta/detected.hpp> |
2218 | | |
2219 | | |
2220 | | #include <type_traits> |
2221 | | |
2222 | | // #include <nlohmann/detail/meta/void_t.hpp> |
2223 | | |
2224 | | |
2225 | | namespace nlohmann |
2226 | | { |
2227 | | namespace detail |
2228 | | { |
2229 | | template<typename ...Ts> struct make_void |
2230 | | { |
2231 | | using type = void; |
2232 | | }; |
2233 | | template<typename ...Ts> using void_t = typename make_void<Ts...>::type; |
2234 | | } // namespace detail |
2235 | | } // namespace nlohmann |
2236 | | |
2237 | | |
2238 | | // https://en.cppreference.com/w/cpp/experimental/is_detected |
2239 | | namespace nlohmann |
2240 | | { |
2241 | | namespace detail |
2242 | | { |
2243 | | struct nonesuch |
2244 | | { |
2245 | | nonesuch() = delete; |
2246 | | ~nonesuch() = delete; |
2247 | | nonesuch(nonesuch const&) = delete; |
2248 | | nonesuch(nonesuch const&&) = delete; |
2249 | | void operator=(nonesuch const&) = delete; |
2250 | | void operator=(nonesuch&&) = delete; |
2251 | | }; |
2252 | | |
2253 | | template<class Default, |
2254 | | class AlwaysVoid, |
2255 | | template<class...> class Op, |
2256 | | class... Args> |
2257 | | struct detector |
2258 | | { |
2259 | | using value_t = std::false_type; |
2260 | | using type = Default; |
2261 | | }; |
2262 | | |
2263 | | template<class Default, template<class...> class Op, class... Args> |
2264 | | struct detector<Default, void_t<Op<Args...>>, Op, Args...> |
2265 | | { |
2266 | | using value_t = std::true_type; |
2267 | | using type = Op<Args...>; |
2268 | | }; |
2269 | | |
2270 | | template<template<class...> class Op, class... Args> |
2271 | | using is_detected = typename detector<nonesuch, void, Op, Args...>::value_t; |
2272 | | |
2273 | | template<template<class...> class Op, class... Args> |
2274 | | struct is_detected_lazy : is_detected<Op, Args...> { }; |
2275 | | |
2276 | | template<template<class...> class Op, class... Args> |
2277 | | using detected_t = typename detector<nonesuch, void, Op, Args...>::type; |
2278 | | |
2279 | | template<class Default, template<class...> class Op, class... Args> |
2280 | | using detected_or = detector<Default, void, Op, Args...>; |
2281 | | |
2282 | | template<class Default, template<class...> class Op, class... Args> |
2283 | | using detected_or_t = typename detected_or<Default, Op, Args...>::type; |
2284 | | |
2285 | | template<class Expected, template<class...> class Op, class... Args> |
2286 | | using is_detected_exact = std::is_same<Expected, detected_t<Op, Args...>>; |
2287 | | |
2288 | | template<class To, template<class...> class Op, class... Args> |
2289 | | using is_detected_convertible = |
2290 | | std::is_convertible<detected_t<Op, Args...>, To>; |
2291 | | } // namespace detail |
2292 | | } // namespace nlohmann |
2293 | | |
2294 | | |
2295 | | // This file contains all internal macro definitions |
2296 | | // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them |
2297 | | |
2298 | | // exclude unsupported compilers |
2299 | | #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) |
2300 | | #if defined(__clang__) |
2301 | | #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 |
2302 | | #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" |
2303 | | #endif |
2304 | | #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) |
2305 | | #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 |
2306 | | #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" |
2307 | | #endif |
2308 | | #endif |
2309 | | #endif |
2310 | | |
2311 | | // C++ language standard detection |
2312 | | // if the user manually specified the used c++ version this is skipped |
2313 | | #if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) |
2314 | | #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) |
2315 | | #define JSON_HAS_CPP_20 |
2316 | | #define JSON_HAS_CPP_17 |
2317 | | #define JSON_HAS_CPP_14 |
2318 | | #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 |
2319 | | #define JSON_HAS_CPP_17 |
2320 | | #define JSON_HAS_CPP_14 |
2321 | | #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) |
2322 | | #define JSON_HAS_CPP_14 |
2323 | | #endif |
2324 | | // the cpp 11 flag is always specified because it is the minimal required version |
2325 | | #define JSON_HAS_CPP_11 |
2326 | | #endif |
2327 | | |
2328 | | // disable documentation warnings on clang |
2329 | | #if defined(__clang__) |
2330 | | #pragma clang diagnostic push |
2331 | | #pragma clang diagnostic ignored "-Wdocumentation" |
2332 | | #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" |
2333 | | #endif |
2334 | | |
2335 | | // allow to disable exceptions |
2336 | | #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) |
2337 | 703 | #define JSON_THROW(exception) throw exception |
2338 | | #define JSON_TRY try |
2339 | | #define JSON_CATCH(exception) catch(exception) |
2340 | | #define JSON_INTERNAL_CATCH(exception) catch(exception) |
2341 | | #else |
2342 | | #include <cstdlib> |
2343 | | #define JSON_THROW(exception) std::abort() |
2344 | | #define JSON_TRY if(true) |
2345 | | #define JSON_CATCH(exception) if(false) |
2346 | | #define JSON_INTERNAL_CATCH(exception) if(false) |
2347 | | #endif |
2348 | | |
2349 | | // override exception macros |
2350 | | #if defined(JSON_THROW_USER) |
2351 | | #undef JSON_THROW |
2352 | | #define JSON_THROW JSON_THROW_USER |
2353 | | #endif |
2354 | | #if defined(JSON_TRY_USER) |
2355 | | #undef JSON_TRY |
2356 | | #define JSON_TRY JSON_TRY_USER |
2357 | | #endif |
2358 | | #if defined(JSON_CATCH_USER) |
2359 | | #undef JSON_CATCH |
2360 | | #define JSON_CATCH JSON_CATCH_USER |
2361 | | #undef JSON_INTERNAL_CATCH |
2362 | | #define JSON_INTERNAL_CATCH JSON_CATCH_USER |
2363 | | #endif |
2364 | | #if defined(JSON_INTERNAL_CATCH_USER) |
2365 | | #undef JSON_INTERNAL_CATCH |
2366 | | #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER |
2367 | | #endif |
2368 | | |
2369 | | // allow to override assert |
2370 | | #if !defined(JSON_ASSERT) |
2371 | | #include <cassert> // assert |
2372 | 0 | #define JSON_ASSERT(x) assert(x) |
2373 | | #endif |
2374 | | |
2375 | | // allow to access some private functions (needed by the test suite) |
2376 | | #if defined(JSON_TESTS_PRIVATE) |
2377 | | #define JSON_PRIVATE_UNLESS_TESTED public |
2378 | | #else |
2379 | | #define JSON_PRIVATE_UNLESS_TESTED private |
2380 | | #endif |
2381 | | |
2382 | | /*! |
2383 | | @brief macro to briefly define a mapping between an enum and JSON |
2384 | | @def NLOHMANN_JSON_SERIALIZE_ENUM |
2385 | | @since version 3.4.0 |
2386 | | */ |
2387 | | #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ |
2388 | | template<typename BasicJsonType> \ |
2389 | | inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ |
2390 | | { \ |
2391 | | static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \ |
2392 | | static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \ |
2393 | | auto it = std::find_if(std::begin(m), std::end(m), \ |
2394 | | [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \ |
2395 | | { \ |
2396 | | return ej_pair.first == e; \ |
2397 | | }); \ |
2398 | | j = ((it != std::end(m)) ? it : std::begin(m))->second; \ |
2399 | | } \ |
2400 | | template<typename BasicJsonType> \ |
2401 | | inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ |
2402 | | { \ |
2403 | | static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \ |
2404 | | static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \ |
2405 | | auto it = std::find_if(std::begin(m), std::end(m), \ |
2406 | | [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \ |
2407 | | { \ |
2408 | | return ej_pair.second == j; \ |
2409 | | }); \ |
2410 | | e = ((it != std::end(m)) ? it : std::begin(m))->first; \ |
2411 | | } |
2412 | | |
2413 | | // Ugly macros to avoid uglier copy-paste when specializing basic_json. They |
2414 | | // may be removed in the future once the class is split. |
2415 | | |
2416 | | #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ |
2417 | | template<template<typename, typename, typename...> class ObjectType, \ |
2418 | | template<typename, typename...> class ArrayType, \ |
2419 | | class StringType, class BooleanType, class NumberIntegerType, \ |
2420 | | class NumberUnsignedType, class NumberFloatType, \ |
2421 | | template<typename> class AllocatorType, \ |
2422 | | template<typename, typename = void> class JSONSerializer, \ |
2423 | | class BinaryType> |
2424 | | |
2425 | | #define NLOHMANN_BASIC_JSON_TPL \ |
2426 | | basic_json<ObjectType, ArrayType, StringType, BooleanType, \ |
2427 | | NumberIntegerType, NumberUnsignedType, NumberFloatType, \ |
2428 | | AllocatorType, JSONSerializer, BinaryType> |
2429 | | |
2430 | | // Macros to simplify conversion from/to types |
2431 | | |
2432 | | #define NLOHMANN_JSON_EXPAND( x ) x |
2433 | | #define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME |
2434 | | #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ |
2435 | | NLOHMANN_JSON_PASTE64, \ |
2436 | | NLOHMANN_JSON_PASTE63, \ |
2437 | | NLOHMANN_JSON_PASTE62, \ |
2438 | | NLOHMANN_JSON_PASTE61, \ |
2439 | | NLOHMANN_JSON_PASTE60, \ |
2440 | | NLOHMANN_JSON_PASTE59, \ |
2441 | | NLOHMANN_JSON_PASTE58, \ |
2442 | | NLOHMANN_JSON_PASTE57, \ |
2443 | | NLOHMANN_JSON_PASTE56, \ |
2444 | | NLOHMANN_JSON_PASTE55, \ |
2445 | | NLOHMANN_JSON_PASTE54, \ |
2446 | | NLOHMANN_JSON_PASTE53, \ |
2447 | | NLOHMANN_JSON_PASTE52, \ |
2448 | | NLOHMANN_JSON_PASTE51, \ |
2449 | | NLOHMANN_JSON_PASTE50, \ |
2450 | | NLOHMANN_JSON_PASTE49, \ |
2451 | | NLOHMANN_JSON_PASTE48, \ |
2452 | | NLOHMANN_JSON_PASTE47, \ |
2453 | | NLOHMANN_JSON_PASTE46, \ |
2454 | | NLOHMANN_JSON_PASTE45, \ |
2455 | | NLOHMANN_JSON_PASTE44, \ |
2456 | | NLOHMANN_JSON_PASTE43, \ |
2457 | | NLOHMANN_JSON_PASTE42, \ |
2458 | | NLOHMANN_JSON_PASTE41, \ |
2459 | | NLOHMANN_JSON_PASTE40, \ |
2460 | | NLOHMANN_JSON_PASTE39, \ |
2461 | | NLOHMANN_JSON_PASTE38, \ |
2462 | | NLOHMANN_JSON_PASTE37, \ |
2463 | | NLOHMANN_JSON_PASTE36, \ |
2464 | | NLOHMANN_JSON_PASTE35, \ |
2465 | | NLOHMANN_JSON_PASTE34, \ |
2466 | | NLOHMANN_JSON_PASTE33, \ |
2467 | | NLOHMANN_JSON_PASTE32, \ |
2468 | | NLOHMANN_JSON_PASTE31, \ |
2469 | | NLOHMANN_JSON_PASTE30, \ |
2470 | | NLOHMANN_JSON_PASTE29, \ |
2471 | | NLOHMANN_JSON_PASTE28, \ |
2472 | | NLOHMANN_JSON_PASTE27, \ |
2473 | | NLOHMANN_JSON_PASTE26, \ |
2474 | | NLOHMANN_JSON_PASTE25, \ |
2475 | | NLOHMANN_JSON_PASTE24, \ |
2476 | | NLOHMANN_JSON_PASTE23, \ |
2477 | | NLOHMANN_JSON_PASTE22, \ |
2478 | | NLOHMANN_JSON_PASTE21, \ |
2479 | | NLOHMANN_JSON_PASTE20, \ |
2480 | | NLOHMANN_JSON_PASTE19, \ |
2481 | | NLOHMANN_JSON_PASTE18, \ |
2482 | | NLOHMANN_JSON_PASTE17, \ |
2483 | | NLOHMANN_JSON_PASTE16, \ |
2484 | | NLOHMANN_JSON_PASTE15, \ |
2485 | | NLOHMANN_JSON_PASTE14, \ |
2486 | | NLOHMANN_JSON_PASTE13, \ |
2487 | | NLOHMANN_JSON_PASTE12, \ |
2488 | | NLOHMANN_JSON_PASTE11, \ |
2489 | | NLOHMANN_JSON_PASTE10, \ |
2490 | | NLOHMANN_JSON_PASTE9, \ |
2491 | | NLOHMANN_JSON_PASTE8, \ |
2492 | | NLOHMANN_JSON_PASTE7, \ |
2493 | | NLOHMANN_JSON_PASTE6, \ |
2494 | | NLOHMANN_JSON_PASTE5, \ |
2495 | | NLOHMANN_JSON_PASTE4, \ |
2496 | | NLOHMANN_JSON_PASTE3, \ |
2497 | | NLOHMANN_JSON_PASTE2, \ |
2498 | | NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) |
2499 | | #define NLOHMANN_JSON_PASTE2(func, v1) func(v1) |
2500 | | #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) |
2501 | | #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) |
2502 | | #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) |
2503 | | #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) |
2504 | | #define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) |
2505 | | #define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) |
2506 | | #define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) |
2507 | | #define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) |
2508 | | #define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) |
2509 | | #define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) |
2510 | | #define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) |
2511 | | #define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) |
2512 | | #define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) |
2513 | | #define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) |
2514 | | #define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) |
2515 | | #define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) |
2516 | | #define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) |
2517 | | #define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) |
2518 | | #define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) |
2519 | | #define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) |
2520 | | #define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) |
2521 | | #define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) |
2522 | | #define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) |
2523 | | #define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) |
2524 | | #define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) |
2525 | | #define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) |
2526 | | #define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) |
2527 | | #define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) |
2528 | | #define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) |
2529 | | #define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) |
2530 | | #define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) |
2531 | | #define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) |
2532 | | #define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) |
2533 | | #define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) |
2534 | | #define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) |
2535 | | #define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) |
2536 | | #define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) |
2537 | | #define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) |
2538 | | #define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) |
2539 | | #define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) |
2540 | | #define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) |
2541 | | #define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) |
2542 | | #define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) |
2543 | | #define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) |
2544 | | #define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) |
2545 | | #define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) |
2546 | | #define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) |
2547 | | #define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) |
2548 | | #define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) |
2549 | | #define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) |
2550 | | #define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) |
2551 | | #define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) |
2552 | | #define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) |
2553 | | #define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) |
2554 | | #define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) |
2555 | | #define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) |
2556 | | #define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) |
2557 | | #define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) |
2558 | | #define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) |
2559 | | #define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) |
2560 | | #define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) |
2561 | | #define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) |
2562 | | |
2563 | | #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; |
2564 | | #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); |
2565 | | |
2566 | | /*! |
2567 | | @brief macro |
2568 | | @def NLOHMANN_DEFINE_TYPE_INTRUSIVE |
2569 | | @since version 3.9.0 |
2570 | | */ |
2571 | | #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ |
2572 | | friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ |
2573 | | friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } |
2574 | | |
2575 | | /*! |
2576 | | @brief macro |
2577 | | @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE |
2578 | | @since version 3.9.0 |
2579 | | */ |
2580 | | #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ |
2581 | | 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__)) } \ |
2582 | | inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } |
2583 | | |
2584 | | |
2585 | | // inspired from https://stackoverflow.com/a/26745591 |
2586 | | // allows to call any std function as if (e.g. with begin): |
2587 | | // using std::begin; begin(x); |
2588 | | // |
2589 | | // it allows using the detected idiom to retrieve the return type |
2590 | | // of such an expression |
2591 | | #define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ |
2592 | | namespace detail { \ |
2593 | | using std::std_name; \ |
2594 | | \ |
2595 | | template<typename... T> \ |
2596 | | using result_of_##std_name = decltype(std_name(std::declval<T>()...)); \ |
2597 | | } \ |
2598 | | \ |
2599 | | namespace detail2 { \ |
2600 | | struct std_name##_tag \ |
2601 | | { \ |
2602 | | }; \ |
2603 | | \ |
2604 | | template<typename... T> \ |
2605 | | std_name##_tag std_name(T&&...); \ |
2606 | | \ |
2607 | | template<typename... T> \ |
2608 | | using result_of_##std_name = decltype(std_name(std::declval<T>()...)); \ |
2609 | | \ |
2610 | | template<typename... T> \ |
2611 | | struct would_call_std_##std_name \ |
2612 | | { \ |
2613 | | static constexpr auto const value = ::nlohmann::detail:: \ |
2614 | | is_detected_exact<std_name##_tag, result_of_##std_name, T...>::value; \ |
2615 | | }; \ |
2616 | | } /* namespace detail2 */ \ |
2617 | | \ |
2618 | | template<typename... T> \ |
2619 | | struct would_call_std_##std_name : detail2::would_call_std_##std_name<T...> \ |
2620 | | { \ |
2621 | | } |
2622 | | |
2623 | | #ifndef JSON_USE_IMPLICIT_CONVERSIONS |
2624 | | #define JSON_USE_IMPLICIT_CONVERSIONS 1 |
2625 | | #endif |
2626 | | |
2627 | | #if JSON_USE_IMPLICIT_CONVERSIONS |
2628 | | #define JSON_EXPLICIT |
2629 | | #else |
2630 | | #define JSON_EXPLICIT explicit |
2631 | | #endif |
2632 | | |
2633 | | #ifndef JSON_DIAGNOSTICS |
2634 | | #define JSON_DIAGNOSTICS 0 |
2635 | | #endif |
2636 | | |
2637 | | |
2638 | | namespace nlohmann |
2639 | | { |
2640 | | namespace detail |
2641 | | { |
2642 | | |
2643 | | /*! |
2644 | | @brief replace all occurrences of a substring by another string |
2645 | | |
2646 | | @param[in,out] s the string to manipulate; changed so that all |
2647 | | occurrences of @a f are replaced with @a t |
2648 | | @param[in] f the substring to replace with @a t |
2649 | | @param[in] t the string to replace @a f |
2650 | | |
2651 | | @pre The search string @a f must not be empty. **This precondition is |
2652 | | enforced with an assertion.** |
2653 | | |
2654 | | @since version 2.0.0 |
2655 | | */ |
2656 | | inline void replace_substring(std::string& s, const std::string& f, |
2657 | | const std::string& t) |
2658 | 0 | { |
2659 | 0 | JSON_ASSERT(!f.empty()); |
2660 | 0 | for (auto pos = s.find(f); // find first occurrence of f |
2661 | 0 | pos != std::string::npos; // make sure f was found |
2662 | 0 | s.replace(pos, f.size(), t), // replace with t, and |
2663 | 0 | pos = s.find(f, pos + t.size())) // find next occurrence of f |
2664 | 0 | {} |
2665 | 0 | } |
2666 | | |
2667 | | /*! |
2668 | | * @brief string escaping as described in RFC 6901 (Sect. 4) |
2669 | | * @param[in] s string to escape |
2670 | | * @return escaped string |
2671 | | * |
2672 | | * Note the order of escaping "~" to "~0" and "/" to "~1" is important. |
2673 | | */ |
2674 | | inline std::string escape(std::string s) |
2675 | 0 | { |
2676 | 0 | replace_substring(s, "~", "~0"); |
2677 | 0 | replace_substring(s, "/", "~1"); |
2678 | 0 | return s; |
2679 | 0 | } |
2680 | | |
2681 | | /*! |
2682 | | * @brief string unescaping as described in RFC 6901 (Sect. 4) |
2683 | | * @param[in] s string to unescape |
2684 | | * @return unescaped string |
2685 | | * |
2686 | | * Note the order of escaping "~1" to "/" and "~0" to "~" is important. |
2687 | | */ |
2688 | | static void unescape(std::string& s) |
2689 | 0 | { |
2690 | 0 | replace_substring(s, "~1", "/"); |
2691 | 0 | replace_substring(s, "~0", "~"); |
2692 | 0 | } |
2693 | | |
2694 | | } // namespace detail |
2695 | | } // namespace nlohmann |
2696 | | |
2697 | | // #include <nlohmann/detail/input/position_t.hpp> |
2698 | | |
2699 | | |
2700 | | #include <cstddef> // size_t |
2701 | | |
2702 | | namespace nlohmann |
2703 | | { |
2704 | | namespace detail |
2705 | | { |
2706 | | /// struct to capture the start position of the current token |
2707 | | struct position_t |
2708 | | { |
2709 | | /// the total number of characters read |
2710 | | std::size_t chars_read_total = 0; |
2711 | | /// the number of characters read in the current line |
2712 | | std::size_t chars_read_current_line = 0; |
2713 | | /// the number of lines read |
2714 | | std::size_t lines_read = 0; |
2715 | | |
2716 | | /// conversion to size_t to preserve SAX interface |
2717 | | constexpr operator size_t() const |
2718 | 703 | { |
2719 | 703 | return chars_read_total; |
2720 | 703 | } |
2721 | | }; |
2722 | | |
2723 | | } // namespace detail |
2724 | | } // namespace nlohmann |
2725 | | |
2726 | | // #include <nlohmann/detail/macro_scope.hpp> |
2727 | | |
2728 | | |
2729 | | namespace nlohmann |
2730 | | { |
2731 | | namespace detail |
2732 | | { |
2733 | | //////////////// |
2734 | | // exceptions // |
2735 | | //////////////// |
2736 | | |
2737 | | /*! |
2738 | | @brief general exception of the @ref basic_json class |
2739 | | |
2740 | | This class is an extension of `std::exception` objects with a member @a id for |
2741 | | exception ids. It is used as the base class for all exceptions thrown by the |
2742 | | @ref basic_json class. This class can hence be used as "wildcard" to catch |
2743 | | exceptions. |
2744 | | |
2745 | | Subclasses: |
2746 | | - @ref parse_error for exceptions indicating a parse error |
2747 | | - @ref invalid_iterator for exceptions indicating errors with iterators |
2748 | | - @ref type_error for exceptions indicating executing a member function with |
2749 | | a wrong type |
2750 | | - @ref out_of_range for exceptions indicating access out of the defined range |
2751 | | - @ref other_error for exceptions indicating other library errors |
2752 | | |
2753 | | @internal |
2754 | | @note To have nothrow-copy-constructible exceptions, we internally use |
2755 | | `std::runtime_error` which can cope with arbitrary-length error messages. |
2756 | | Intermediate strings are built with static functions and then passed to |
2757 | | the actual constructor. |
2758 | | @endinternal |
2759 | | |
2760 | | @liveexample{The following code shows how arbitrary library exceptions can be |
2761 | | caught.,exception} |
2762 | | |
2763 | | @since version 3.0.0 |
2764 | | */ |
2765 | | class exception : public std::exception |
2766 | | { |
2767 | | public: |
2768 | | /// returns the explanatory string |
2769 | | const char* what() const noexcept override |
2770 | 703 | { |
2771 | 703 | return m.what(); |
2772 | 703 | } |
2773 | | |
2774 | | /// the id of the exception |
2775 | | const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes) |
2776 | | |
2777 | | protected: |
2778 | | JSON_HEDLEY_NON_NULL(3) |
2779 | 703 | exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} |
2780 | | |
2781 | | static std::string name(const std::string& ename, int id_) |
2782 | 703 | { |
2783 | 703 | return "[json.exception." + ename + "." + std::to_string(id_) + "] "; |
2784 | 703 | } |
2785 | | |
2786 | | template<typename BasicJsonType> |
2787 | | static std::string diagnostics(const BasicJsonType& leaf_element) |
2788 | 703 | { |
2789 | | #if JSON_DIAGNOSTICS |
2790 | | std::vector<std::string> tokens; |
2791 | | for (const auto* current = &leaf_element; current->m_parent != nullptr; current = current->m_parent) |
2792 | | { |
2793 | | switch (current->m_parent->type()) |
2794 | | { |
2795 | | case value_t::array: |
2796 | | { |
2797 | | for (std::size_t i = 0; i < current->m_parent->m_value.array->size(); ++i) |
2798 | | { |
2799 | | if (¤t->m_parent->m_value.array->operator[](i) == current) |
2800 | | { |
2801 | | tokens.emplace_back(std::to_string(i)); |
2802 | | break; |
2803 | | } |
2804 | | } |
2805 | | break; |
2806 | | } |
2807 | | |
2808 | | case value_t::object: |
2809 | | { |
2810 | | for (const auto& element : *current->m_parent->m_value.object) |
2811 | | { |
2812 | | if (&element.second == current) |
2813 | | { |
2814 | | tokens.emplace_back(element.first.c_str()); |
2815 | | break; |
2816 | | } |
2817 | | } |
2818 | | break; |
2819 | | } |
2820 | | |
2821 | | case value_t::null: // LCOV_EXCL_LINE |
2822 | | case value_t::string: // LCOV_EXCL_LINE |
2823 | | case value_t::boolean: // LCOV_EXCL_LINE |
2824 | | case value_t::number_integer: // LCOV_EXCL_LINE |
2825 | | case value_t::number_unsigned: // LCOV_EXCL_LINE |
2826 | | case value_t::number_float: // LCOV_EXCL_LINE |
2827 | | case value_t::binary: // LCOV_EXCL_LINE |
2828 | | case value_t::discarded: // LCOV_EXCL_LINE |
2829 | | default: // LCOV_EXCL_LINE |
2830 | | break; // LCOV_EXCL_LINE |
2831 | | } |
2832 | | } |
2833 | | |
2834 | | if (tokens.empty()) |
2835 | | { |
2836 | | return ""; |
2837 | | } |
2838 | | |
2839 | | return "(" + std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, |
2840 | | [](const std::string & a, const std::string & b) |
2841 | | { |
2842 | | return a + "/" + detail::escape(b); |
2843 | | }) + ") "; |
2844 | | #else |
2845 | 703 | static_cast<void>(leaf_element); |
2846 | 703 | return ""; |
2847 | 703 | #endif |
2848 | 703 | } |
2849 | | |
2850 | | private: |
2851 | | /// an exception object as storage for error messages |
2852 | | std::runtime_error m; |
2853 | | }; |
2854 | | |
2855 | | /*! |
2856 | | @brief exception indicating a parse error |
2857 | | |
2858 | | This exception is thrown by the library when a parse error occurs. Parse errors |
2859 | | can occur during the deserialization of JSON text, CBOR, MessagePack, as well |
2860 | | as when using JSON Patch. |
2861 | | |
2862 | | Member @a byte holds the byte index of the last read character in the input |
2863 | | file. |
2864 | | |
2865 | | Exceptions have ids 1xx. |
2866 | | |
2867 | | name / id | example message | description |
2868 | | ------------------------------ | --------------- | ------------------------- |
2869 | | json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. |
2870 | | json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. |
2871 | | json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. |
2872 | | json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. |
2873 | | json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. |
2874 | | json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. |
2875 | | json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. |
2876 | | json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. |
2877 | | json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. |
2878 | | json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. |
2879 | | json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. |
2880 | | json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. |
2881 | | json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). |
2882 | | json.exception.parse_error.115 | parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A | A UBJSON high-precision number could not be parsed. |
2883 | | |
2884 | | @note For an input with n bytes, 1 is the index of the first character and n+1 |
2885 | | is the index of the terminating null byte or the end of file. This also |
2886 | | holds true when reading a byte vector (CBOR or MessagePack). |
2887 | | |
2888 | | @liveexample{The following code shows how a `parse_error` exception can be |
2889 | | caught.,parse_error} |
2890 | | |
2891 | | @sa - @ref exception for the base class of the library exceptions |
2892 | | @sa - @ref invalid_iterator for exceptions indicating errors with iterators |
2893 | | @sa - @ref type_error for exceptions indicating executing a member function with |
2894 | | a wrong type |
2895 | | @sa - @ref out_of_range for exceptions indicating access out of the defined range |
2896 | | @sa - @ref other_error for exceptions indicating other library errors |
2897 | | |
2898 | | @since version 3.0.0 |
2899 | | */ |
2900 | | class parse_error : public exception |
2901 | | { |
2902 | | public: |
2903 | | /*! |
2904 | | @brief create a parse error exception |
2905 | | @param[in] id_ the id of the exception |
2906 | | @param[in] pos the position where the error occurred (or with |
2907 | | chars_read_total=0 if the position cannot be |
2908 | | determined) |
2909 | | @param[in] what_arg the explanatory string |
2910 | | @return parse_error object |
2911 | | */ |
2912 | | template<typename BasicJsonType> |
2913 | | static parse_error create(int id_, const position_t& pos, const std::string& what_arg, const BasicJsonType& context) |
2914 | 701 | { |
2915 | 701 | std::string w = exception::name("parse_error", id_) + "parse error" + |
2916 | 701 | position_string(pos) + ": " + exception::diagnostics(context) + what_arg; |
2917 | 701 | return parse_error(id_, pos.chars_read_total, w.c_str()); |
2918 | 701 | } |
2919 | | |
2920 | | template<typename BasicJsonType> |
2921 | | static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, const BasicJsonType& context) |
2922 | 0 | { |
2923 | 0 | std::string w = exception::name("parse_error", id_) + "parse error" + |
2924 | 0 | (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + |
2925 | 0 | ": " + exception::diagnostics(context) + what_arg; |
2926 | 0 | return parse_error(id_, byte_, w.c_str()); |
2927 | 0 | } |
2928 | | |
2929 | | /*! |
2930 | | @brief byte index of the parse error |
2931 | | |
2932 | | The byte index of the last read character in the input file. |
2933 | | |
2934 | | @note For an input with n bytes, 1 is the index of the first character and |
2935 | | n+1 is the index of the terminating null byte or the end of file. |
2936 | | This also holds true when reading a byte vector (CBOR or MessagePack). |
2937 | | */ |
2938 | | const std::size_t byte; |
2939 | | |
2940 | | private: |
2941 | | parse_error(int id_, std::size_t byte_, const char* what_arg) |
2942 | 701 | : exception(id_, what_arg), byte(byte_) {} |
2943 | | |
2944 | | static std::string position_string(const position_t& pos) |
2945 | 701 | { |
2946 | 701 | return " at line " + std::to_string(pos.lines_read + 1) + |
2947 | 701 | ", column " + std::to_string(pos.chars_read_current_line); |
2948 | 701 | } |
2949 | | }; |
2950 | | |
2951 | | /*! |
2952 | | @brief exception indicating errors with iterators |
2953 | | |
2954 | | This exception is thrown if iterators passed to a library function do not match |
2955 | | the expected semantics. |
2956 | | |
2957 | | Exceptions have ids 2xx. |
2958 | | |
2959 | | name / id | example message | description |
2960 | | ----------------------------------- | --------------- | ------------------------- |
2961 | | json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. |
2962 | | json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. |
2963 | | json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. |
2964 | | json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. |
2965 | | json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. |
2966 | | json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. |
2967 | | json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. |
2968 | | json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. |
2969 | | json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. |
2970 | | json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. |
2971 | | json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. |
2972 | | json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. |
2973 | | json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. |
2974 | | json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). |
2975 | | |
2976 | | @liveexample{The following code shows how an `invalid_iterator` exception can be |
2977 | | caught.,invalid_iterator} |
2978 | | |
2979 | | @sa - @ref exception for the base class of the library exceptions |
2980 | | @sa - @ref parse_error for exceptions indicating a parse error |
2981 | | @sa - @ref type_error for exceptions indicating executing a member function with |
2982 | | a wrong type |
2983 | | @sa - @ref out_of_range for exceptions indicating access out of the defined range |
2984 | | @sa - @ref other_error for exceptions indicating other library errors |
2985 | | |
2986 | | @since version 3.0.0 |
2987 | | */ |
2988 | | class invalid_iterator : public exception |
2989 | | { |
2990 | | public: |
2991 | | template<typename BasicJsonType> |
2992 | | static invalid_iterator create(int id_, const std::string& what_arg, const BasicJsonType& context) |
2993 | 0 | { |
2994 | 0 | std::string w = exception::name("invalid_iterator", id_) + exception::diagnostics(context) + what_arg; |
2995 | 0 | return invalid_iterator(id_, w.c_str()); |
2996 | 0 | } |
2997 | | |
2998 | | private: |
2999 | | JSON_HEDLEY_NON_NULL(3) |
3000 | | invalid_iterator(int id_, const char* what_arg) |
3001 | 0 | : exception(id_, what_arg) {} |
3002 | | }; |
3003 | | |
3004 | | /*! |
3005 | | @brief exception indicating executing a member function with a wrong type |
3006 | | |
3007 | | This exception is thrown in case of a type error; that is, a library function is |
3008 | | executed on a JSON value whose type does not match the expected semantics. |
3009 | | |
3010 | | Exceptions have ids 3xx. |
3011 | | |
3012 | | name / id | example message | description |
3013 | | ----------------------------- | --------------- | ------------------------- |
3014 | | json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. |
3015 | | json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. |
3016 | | json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &. |
3017 | | json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. |
3018 | | json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. |
3019 | | json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. |
3020 | | json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. |
3021 | | json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. |
3022 | | json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. |
3023 | | json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. |
3024 | | json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. |
3025 | | json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. |
3026 | | json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. |
3027 | | json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. |
3028 | | json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. |
3029 | | json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | |
3030 | | json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) | |
3031 | | |
3032 | | @liveexample{The following code shows how a `type_error` exception can be |
3033 | | caught.,type_error} |
3034 | | |
3035 | | @sa - @ref exception for the base class of the library exceptions |
3036 | | @sa - @ref parse_error for exceptions indicating a parse error |
3037 | | @sa - @ref invalid_iterator for exceptions indicating errors with iterators |
3038 | | @sa - @ref out_of_range for exceptions indicating access out of the defined range |
3039 | | @sa - @ref other_error for exceptions indicating other library errors |
3040 | | |
3041 | | @since version 3.0.0 |
3042 | | */ |
3043 | | class type_error : public exception |
3044 | | { |
3045 | | public: |
3046 | | template<typename BasicJsonType> |
3047 | | static type_error create(int id_, const std::string& what_arg, const BasicJsonType& context) |
3048 | 0 | { |
3049 | 0 | std::string w = exception::name("type_error", id_) + exception::diagnostics(context) + what_arg; |
3050 | 0 | return type_error(id_, w.c_str()); |
3051 | 0 | } |
3052 | | |
3053 | | private: |
3054 | | JSON_HEDLEY_NON_NULL(3) |
3055 | 0 | type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} |
3056 | | }; |
3057 | | |
3058 | | /*! |
3059 | | @brief exception indicating access out of the defined range |
3060 | | |
3061 | | This exception is thrown in case a library function is called on an input |
3062 | | parameter that exceeds the expected range, for instance in case of array |
3063 | | indices or nonexisting object keys. |
3064 | | |
3065 | | Exceptions have ids 4xx. |
3066 | | |
3067 | | name / id | example message | description |
3068 | | ------------------------------- | --------------- | ------------------------- |
3069 | | json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. |
3070 | | json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. |
3071 | | json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. |
3072 | | json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. |
3073 | | json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. |
3074 | | json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. |
3075 | | json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. (until version 3.8.0) | |
3076 | | json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | |
3077 | | json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | |
3078 | | |
3079 | | @liveexample{The following code shows how an `out_of_range` exception can be |
3080 | | caught.,out_of_range} |
3081 | | |
3082 | | @sa - @ref exception for the base class of the library exceptions |
3083 | | @sa - @ref parse_error for exceptions indicating a parse error |
3084 | | @sa - @ref invalid_iterator for exceptions indicating errors with iterators |
3085 | | @sa - @ref type_error for exceptions indicating executing a member function with |
3086 | | a wrong type |
3087 | | @sa - @ref other_error for exceptions indicating other library errors |
3088 | | |
3089 | | @since version 3.0.0 |
3090 | | */ |
3091 | | class out_of_range : public exception |
3092 | | { |
3093 | | public: |
3094 | | template<typename BasicJsonType> |
3095 | | static out_of_range create(int id_, const std::string& what_arg, const BasicJsonType& context) |
3096 | 2 | { |
3097 | 2 | std::string w = exception::name("out_of_range", id_) + exception::diagnostics(context) + what_arg; |
3098 | 2 | return out_of_range(id_, w.c_str()); |
3099 | 2 | } |
3100 | | |
3101 | | private: |
3102 | | JSON_HEDLEY_NON_NULL(3) |
3103 | 2 | out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} |
3104 | | }; |
3105 | | |
3106 | | /*! |
3107 | | @brief exception indicating other library errors |
3108 | | |
3109 | | This exception is thrown in case of errors that cannot be classified with the |
3110 | | other exception types. |
3111 | | |
3112 | | Exceptions have ids 5xx. |
3113 | | |
3114 | | name / id | example message | description |
3115 | | ------------------------------ | --------------- | ------------------------- |
3116 | | json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. |
3117 | | |
3118 | | @sa - @ref exception for the base class of the library exceptions |
3119 | | @sa - @ref parse_error for exceptions indicating a parse error |
3120 | | @sa - @ref invalid_iterator for exceptions indicating errors with iterators |
3121 | | @sa - @ref type_error for exceptions indicating executing a member function with |
3122 | | a wrong type |
3123 | | @sa - @ref out_of_range for exceptions indicating access out of the defined range |
3124 | | |
3125 | | @liveexample{The following code shows how an `other_error` exception can be |
3126 | | caught.,other_error} |
3127 | | |
3128 | | @since version 3.0.0 |
3129 | | */ |
3130 | | class other_error : public exception |
3131 | | { |
3132 | | public: |
3133 | | template<typename BasicJsonType> |
3134 | | static other_error create(int id_, const std::string& what_arg, const BasicJsonType& context) |
3135 | 0 | { |
3136 | 0 | std::string w = exception::name("other_error", id_) + exception::diagnostics(context) + what_arg; |
3137 | 0 | return other_error(id_, w.c_str()); |
3138 | 0 | } |
3139 | | |
3140 | | private: |
3141 | | JSON_HEDLEY_NON_NULL(3) |
3142 | 0 | other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} |
3143 | | }; |
3144 | | } // namespace detail |
3145 | | } // namespace nlohmann |
3146 | | |
3147 | | // #include <nlohmann/detail/macro_scope.hpp> |
3148 | | |
3149 | | // #include <nlohmann/detail/meta/cpp_future.hpp> |
3150 | | |
3151 | | |
3152 | | #include <cstddef> // size_t |
3153 | | #include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type |
3154 | | #include <utility> // index_sequence, make_index_sequence, index_sequence_for |
3155 | | |
3156 | | // #include <nlohmann/detail/macro_scope.hpp> |
3157 | | |
3158 | | |
3159 | | namespace nlohmann |
3160 | | { |
3161 | | namespace detail |
3162 | | { |
3163 | | |
3164 | | template<typename T> |
3165 | | using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; |
3166 | | |
3167 | | #ifdef JSON_HAS_CPP_14 |
3168 | | |
3169 | | // the following utilities are natively available in C++14 |
3170 | | using std::enable_if_t; |
3171 | | using std::index_sequence; |
3172 | | using std::make_index_sequence; |
3173 | | using std::index_sequence_for; |
3174 | | |
3175 | | #else |
3176 | | |
3177 | | // alias templates to reduce boilerplate |
3178 | | template<bool B, typename T = void> |
3179 | | using enable_if_t = typename std::enable_if<B, T>::type; |
3180 | | |
3181 | | // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h |
3182 | | // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. |
3183 | | |
3184 | | //// START OF CODE FROM GOOGLE ABSEIL |
3185 | | |
3186 | | // integer_sequence |
3187 | | // |
3188 | | // Class template representing a compile-time integer sequence. An instantiation |
3189 | | // of `integer_sequence<T, Ints...>` has a sequence of integers encoded in its |
3190 | | // type through its template arguments (which is a common need when |
3191 | | // working with C++11 variadic templates). `absl::integer_sequence` is designed |
3192 | | // to be a drop-in replacement for C++14's `std::integer_sequence`. |
3193 | | // |
3194 | | // Example: |
3195 | | // |
3196 | | // template< class T, T... Ints > |
3197 | | // void user_function(integer_sequence<T, Ints...>); |
3198 | | // |
3199 | | // int main() |
3200 | | // { |
3201 | | // // user_function's `T` will be deduced to `int` and `Ints...` |
3202 | | // // will be deduced to `0, 1, 2, 3, 4`. |
3203 | | // user_function(make_integer_sequence<int, 5>()); |
3204 | | // } |
3205 | | template <typename T, T... Ints> |
3206 | | struct integer_sequence |
3207 | | { |
3208 | | using value_type = T; |
3209 | | static constexpr std::size_t size() noexcept |
3210 | | { |
3211 | | return sizeof...(Ints); |
3212 | | } |
3213 | | }; |
3214 | | |
3215 | | // index_sequence |
3216 | | // |
3217 | | // A helper template for an `integer_sequence` of `size_t`, |
3218 | | // `absl::index_sequence` is designed to be a drop-in replacement for C++14's |
3219 | | // `std::index_sequence`. |
3220 | | template <size_t... Ints> |
3221 | | using index_sequence = integer_sequence<size_t, Ints...>; |
3222 | | |
3223 | | namespace utility_internal |
3224 | | { |
3225 | | |
3226 | | template <typename Seq, size_t SeqSize, size_t Rem> |
3227 | | struct Extend; |
3228 | | |
3229 | | // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. |
3230 | | template <typename T, T... Ints, size_t SeqSize> |
3231 | | struct Extend<integer_sequence<T, Ints...>, SeqSize, 0> |
3232 | | { |
3233 | | using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; |
3234 | | }; |
3235 | | |
3236 | | template <typename T, T... Ints, size_t SeqSize> |
3237 | | struct Extend<integer_sequence<T, Ints...>, SeqSize, 1> |
3238 | | { |
3239 | | using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; |
3240 | | }; |
3241 | | |
3242 | | // Recursion helper for 'make_integer_sequence<T, N>'. |
3243 | | // 'Gen<T, N>::type' is an alias for 'integer_sequence<T, 0, 1, ... N-1>'. |
3244 | | template <typename T, size_t N> |
3245 | | struct Gen |
3246 | | { |
3247 | | using type = |
3248 | | typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; |
3249 | | }; |
3250 | | |
3251 | | template <typename T> |
3252 | | struct Gen<T, 0> |
3253 | | { |
3254 | | using type = integer_sequence<T>; |
3255 | | }; |
3256 | | |
3257 | | } // namespace utility_internal |
3258 | | |
3259 | | // Compile-time sequences of integers |
3260 | | |
3261 | | // make_integer_sequence |
3262 | | // |
3263 | | // This template alias is equivalent to |
3264 | | // `integer_sequence<int, 0, 1, ..., N-1>`, and is designed to be a drop-in |
3265 | | // replacement for C++14's `std::make_integer_sequence`. |
3266 | | template <typename T, T N> |
3267 | | using make_integer_sequence = typename utility_internal::Gen<T, N>::type; |
3268 | | |
3269 | | // make_index_sequence |
3270 | | // |
3271 | | // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, |
3272 | | // and is designed to be a drop-in replacement for C++14's |
3273 | | // `std::make_index_sequence`. |
3274 | | template <size_t N> |
3275 | | using make_index_sequence = make_integer_sequence<size_t, N>; |
3276 | | |
3277 | | // index_sequence_for |
3278 | | // |
3279 | | // Converts a typename pack into an index sequence of the same length, and |
3280 | | // is designed to be a drop-in replacement for C++14's |
3281 | | // `std::index_sequence_for()` |
3282 | | template <typename... Ts> |
3283 | | using index_sequence_for = make_index_sequence<sizeof...(Ts)>; |
3284 | | |
3285 | | //// END OF CODE FROM GOOGLE ABSEIL |
3286 | | |
3287 | | #endif |
3288 | | |
3289 | | // dispatch utility (taken from ranges-v3) |
3290 | | template<unsigned N> struct priority_tag : priority_tag < N - 1 > {}; |
3291 | | template<> struct priority_tag<0> {}; |
3292 | | |
3293 | | // taken from ranges-v3 |
3294 | | template<typename T> |
3295 | | struct static_const |
3296 | | { |
3297 | | static constexpr T value{}; |
3298 | | }; |
3299 | | |
3300 | | template<typename T> |
3301 | | constexpr T static_const<T>::value; |
3302 | | |
3303 | | } // namespace detail |
3304 | | } // namespace nlohmann |
3305 | | |
3306 | | // #include <nlohmann/detail/meta/identity_tag.hpp> |
3307 | | |
3308 | | |
3309 | | namespace nlohmann |
3310 | | { |
3311 | | namespace detail |
3312 | | { |
3313 | | // dispatching helper struct |
3314 | | template <class T> struct identity_tag {}; |
3315 | | } // namespace detail |
3316 | | } // namespace nlohmann |
3317 | | |
3318 | | // #include <nlohmann/detail/meta/type_traits.hpp> |
3319 | | |
3320 | | |
3321 | | #include <limits> // numeric_limits |
3322 | | #include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type |
3323 | | #include <utility> // declval |
3324 | | #include <tuple> // tuple |
3325 | | |
3326 | | // #include <nlohmann/detail/macro_scope.hpp> |
3327 | | |
3328 | | |
3329 | | // #include <nlohmann/detail/iterators/iterator_traits.hpp> |
3330 | | |
3331 | | |
3332 | | #include <iterator> // random_access_iterator_tag |
3333 | | |
3334 | | // #include <nlohmann/detail/meta/void_t.hpp> |
3335 | | |
3336 | | // #include <nlohmann/detail/meta/cpp_future.hpp> |
3337 | | |
3338 | | |
3339 | | namespace nlohmann |
3340 | | { |
3341 | | namespace detail |
3342 | | { |
3343 | | template<typename It, typename = void> |
3344 | | struct iterator_types {}; |
3345 | | |
3346 | | template<typename It> |
3347 | | struct iterator_types < |
3348 | | It, |
3349 | | void_t<typename It::difference_type, typename It::value_type, typename It::pointer, |
3350 | | typename It::reference, typename It::iterator_category >> |
3351 | | { |
3352 | | using difference_type = typename It::difference_type; |
3353 | | using value_type = typename It::value_type; |
3354 | | using pointer = typename It::pointer; |
3355 | | using reference = typename It::reference; |
3356 | | using iterator_category = typename It::iterator_category; |
3357 | | }; |
3358 | | |
3359 | | // This is required as some compilers implement std::iterator_traits in a way that |
3360 | | // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. |
3361 | | template<typename T, typename = void> |
3362 | | struct iterator_traits |
3363 | | { |
3364 | | }; |
3365 | | |
3366 | | template<typename T> |
3367 | | struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >> |
3368 | | : iterator_types<T> |
3369 | | { |
3370 | | }; |
3371 | | |
3372 | | template<typename T> |
3373 | | struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>> |
3374 | | { |
3375 | | using iterator_category = std::random_access_iterator_tag; |
3376 | | using value_type = T; |
3377 | | using difference_type = ptrdiff_t; |
3378 | | using pointer = T*; |
3379 | | using reference = T&; |
3380 | | }; |
3381 | | } // namespace detail |
3382 | | } // namespace nlohmann |
3383 | | |
3384 | | // #include <nlohmann/detail/meta/call_std/begin.hpp> |
3385 | | |
3386 | | |
3387 | | // #include <nlohmann/detail/macro_scope.hpp> |
3388 | | |
3389 | | |
3390 | | namespace nlohmann |
3391 | | { |
3392 | | NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); |
3393 | | } // namespace nlohmann |
3394 | | |
3395 | | // #include <nlohmann/detail/meta/call_std/end.hpp> |
3396 | | |
3397 | | |
3398 | | // #include <nlohmann/detail/macro_scope.hpp> |
3399 | | |
3400 | | |
3401 | | namespace nlohmann |
3402 | | { |
3403 | | NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); |
3404 | | } // namespace nlohmann |
3405 | | |
3406 | | // #include <nlohmann/detail/meta/cpp_future.hpp> |
3407 | | |
3408 | | // #include <nlohmann/detail/meta/detected.hpp> |
3409 | | |
3410 | | // #include <nlohmann/json_fwd.hpp> |
3411 | | #ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ |
3412 | | #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ |
3413 | | |
3414 | | #include <cstdint> // int64_t, uint64_t |
3415 | | #include <map> // map |
3416 | | #include <memory> // allocator |
3417 | | #include <string> // string |
3418 | | #include <vector> // vector |
3419 | | |
3420 | | /*! |
3421 | | @brief namespace for Niels Lohmann |
3422 | | @see https://github.com/nlohmann |
3423 | | @since version 1.0.0 |
3424 | | */ |
3425 | | namespace nlohmann |
3426 | | { |
3427 | | /*! |
3428 | | @brief default JSONSerializer template argument |
3429 | | |
3430 | | This serializer ignores the template arguments and uses ADL |
3431 | | ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) |
3432 | | for serialization. |
3433 | | */ |
3434 | | template<typename T = void, typename SFINAE = void> |
3435 | | struct adl_serializer; |
3436 | | |
3437 | | template<template<typename U, typename V, typename... Args> class ObjectType = |
3438 | | std::map, |
3439 | | template<typename U, typename... Args> class ArrayType = std::vector, |
3440 | | class StringType = std::string, class BooleanType = bool, |
3441 | | class NumberIntegerType = std::int64_t, |
3442 | | class NumberUnsignedType = std::uint64_t, |
3443 | | class NumberFloatType = double, |
3444 | | template<typename U> class AllocatorType = std::allocator, |
3445 | | template<typename T, typename SFINAE = void> class JSONSerializer = |
3446 | | adl_serializer, |
3447 | | class BinaryType = std::vector<std::uint8_t>> |
3448 | | class basic_json; |
3449 | | |
3450 | | /*! |
3451 | | @brief JSON Pointer |
3452 | | |
3453 | | A JSON pointer defines a string syntax for identifying a specific value |
3454 | | within a JSON document. It can be used with functions `at` and |
3455 | | `operator[]`. Furthermore, JSON pointers are the base for JSON patches. |
3456 | | |
3457 | | @sa [RFC 6901](https://tools.ietf.org/html/rfc6901) |
3458 | | |
3459 | | @since version 2.0.0 |
3460 | | */ |
3461 | | template<typename BasicJsonType> |
3462 | | class json_pointer; |
3463 | | |
3464 | | /*! |
3465 | | @brief default JSON class |
3466 | | |
3467 | | This type is the default specialization of the @ref basic_json class which |
3468 | | uses the standard template types. |
3469 | | |
3470 | | @since version 1.0.0 |
3471 | | */ |
3472 | | using json = basic_json<>; |
3473 | | |
3474 | | template<class Key, class T, class IgnoredLess, class Allocator> |
3475 | | struct ordered_map; |
3476 | | |
3477 | | /*! |
3478 | | @brief ordered JSON class |
3479 | | |
3480 | | This type preserves the insertion order of object keys. |
3481 | | |
3482 | | @since version 3.9.0 |
3483 | | */ |
3484 | | using ordered_json = basic_json<nlohmann::ordered_map>; |
3485 | | |
3486 | | } // namespace nlohmann |
3487 | | |
3488 | | #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ |
3489 | | |
3490 | | |
3491 | | namespace nlohmann |
3492 | | { |
3493 | | /*! |
3494 | | @brief detail namespace with internal helper functions |
3495 | | |
3496 | | This namespace collects functions that should not be exposed, |
3497 | | implementations of some @ref basic_json methods, and meta-programming helpers. |
3498 | | |
3499 | | @since version 2.1.0 |
3500 | | */ |
3501 | | namespace detail |
3502 | | { |
3503 | | ///////////// |
3504 | | // helpers // |
3505 | | ///////////// |
3506 | | |
3507 | | // Note to maintainers: |
3508 | | // |
3509 | | // Every trait in this file expects a non CV-qualified type. |
3510 | | // The only exceptions are in the 'aliases for detected' section |
3511 | | // (i.e. those of the form: decltype(T::member_function(std::declval<T>()))) |
3512 | | // |
3513 | | // In this case, T has to be properly CV-qualified to constraint the function arguments |
3514 | | // (e.g. to_json(BasicJsonType&, const T&)) |
3515 | | |
3516 | | template<typename> struct is_basic_json : std::false_type {}; |
3517 | | |
3518 | | NLOHMANN_BASIC_JSON_TPL_DECLARATION |
3519 | | struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {}; |
3520 | | |
3521 | | ////////////////////// |
3522 | | // json_ref helpers // |
3523 | | ////////////////////// |
3524 | | |
3525 | | template<typename> |
3526 | | class json_ref; |
3527 | | |
3528 | | template<typename> |
3529 | | struct is_json_ref : std::false_type {}; |
3530 | | |
3531 | | template<typename T> |
3532 | | struct is_json_ref<json_ref<T>> : std::true_type {}; |
3533 | | |
3534 | | ////////////////////////// |
3535 | | // aliases for detected // |
3536 | | ////////////////////////// |
3537 | | |
3538 | | template<typename T> |
3539 | | using mapped_type_t = typename T::mapped_type; |
3540 | | |
3541 | | template<typename T> |
3542 | | using key_type_t = typename T::key_type; |
3543 | | |
3544 | | template<typename T> |
3545 | | using value_type_t = typename T::value_type; |
3546 | | |
3547 | | template<typename T> |
3548 | | using difference_type_t = typename T::difference_type; |
3549 | | |
3550 | | template<typename T> |
3551 | | using pointer_t = typename T::pointer; |
3552 | | |
3553 | | template<typename T> |
3554 | | using reference_t = typename T::reference; |
3555 | | |
3556 | | template<typename T> |
3557 | | using iterator_category_t = typename T::iterator_category; |
3558 | | |
3559 | | template<typename T, typename... Args> |
3560 | | using to_json_function = decltype(T::to_json(std::declval<Args>()...)); |
3561 | | |
3562 | | template<typename T, typename... Args> |
3563 | | using from_json_function = decltype(T::from_json(std::declval<Args>()...)); |
3564 | | |
3565 | | template<typename T, typename U> |
3566 | | using get_template_function = decltype(std::declval<T>().template get<U>()); |
3567 | | |
3568 | | // trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists |
3569 | | template<typename BasicJsonType, typename T, typename = void> |
3570 | | struct has_from_json : std::false_type {}; |
3571 | | |
3572 | | // trait checking if j.get<T> is valid |
3573 | | // use this trait instead of std::is_constructible or std::is_convertible, |
3574 | | // both rely on, or make use of implicit conversions, and thus fail when T |
3575 | | // has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) |
3576 | | template <typename BasicJsonType, typename T> |
3577 | | struct is_getable |
3578 | | { |
3579 | | static constexpr bool value = is_detected<get_template_function, const BasicJsonType&, T>::value; |
3580 | | }; |
3581 | | |
3582 | | template<typename BasicJsonType, typename T> |
3583 | | struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> |
3584 | | { |
3585 | | using serializer = typename BasicJsonType::template json_serializer<T, void>; |
3586 | | |
3587 | | static constexpr bool value = |
3588 | | is_detected_exact<void, from_json_function, serializer, |
3589 | | const BasicJsonType&, T&>::value; |
3590 | | }; |
3591 | | |
3592 | | // This trait checks if JSONSerializer<T>::from_json(json const&) exists |
3593 | | // this overload is used for non-default-constructible user-defined-types |
3594 | | template<typename BasicJsonType, typename T, typename = void> |
3595 | | struct has_non_default_from_json : std::false_type {}; |
3596 | | |
3597 | | template<typename BasicJsonType, typename T> |
3598 | | struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> |
3599 | | { |
3600 | | using serializer = typename BasicJsonType::template json_serializer<T, void>; |
3601 | | |
3602 | | static constexpr bool value = |
3603 | | is_detected_exact<T, from_json_function, serializer, |
3604 | | const BasicJsonType&>::value; |
3605 | | }; |
3606 | | |
3607 | | // This trait checks if BasicJsonType::json_serializer<T>::to_json exists |
3608 | | // Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. |
3609 | | template<typename BasicJsonType, typename T, typename = void> |
3610 | | struct has_to_json : std::false_type {}; |
3611 | | |
3612 | | template<typename BasicJsonType, typename T> |
3613 | | struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json<T>::value >> |
3614 | | { |
3615 | | using serializer = typename BasicJsonType::template json_serializer<T, void>; |
3616 | | |
3617 | | static constexpr bool value = |
3618 | | is_detected_exact<void, to_json_function, serializer, BasicJsonType&, |
3619 | | T>::value; |
3620 | | }; |
3621 | | |
3622 | | |
3623 | | /////////////////// |
3624 | | // is_ functions // |
3625 | | /////////////////// |
3626 | | |
3627 | | // https://en.cppreference.com/w/cpp/types/conjunction |
3628 | | template<class...> struct conjunction : std::true_type { }; |
3629 | | template<class B1> struct conjunction<B1> : B1 { }; |
3630 | | template<class B1, class... Bn> |
3631 | | struct conjunction<B1, Bn...> |
3632 | | : std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type {}; |
3633 | | |
3634 | | // https://en.cppreference.com/w/cpp/types/negation |
3635 | | template<class B> struct negation : std::integral_constant < bool, !B::value > { }; |
3636 | | |
3637 | | // Reimplementation of is_constructible and is_default_constructible, due to them being broken for |
3638 | | // std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). |
3639 | | // This causes compile errors in e.g. clang 3.5 or gcc 4.9. |
3640 | | template <typename T> |
3641 | | struct is_default_constructible : std::is_default_constructible<T> {}; |
3642 | | |
3643 | | template <typename T1, typename T2> |
3644 | | struct is_default_constructible<std::pair<T1, T2>> |
3645 | | : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {}; |
3646 | | |
3647 | | template <typename T1, typename T2> |
3648 | | struct is_default_constructible<const std::pair<T1, T2>> |
3649 | | : conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {}; |
3650 | | |
3651 | | template <typename... Ts> |
3652 | | struct is_default_constructible<std::tuple<Ts...>> |
3653 | | : conjunction<is_default_constructible<Ts>...> {}; |
3654 | | |
3655 | | template <typename... Ts> |
3656 | | struct is_default_constructible<const std::tuple<Ts...>> |
3657 | | : conjunction<is_default_constructible<Ts>...> {}; |
3658 | | |
3659 | | |
3660 | | template <typename T, typename... Args> |
3661 | | struct is_constructible : std::is_constructible<T, Args...> {}; |
3662 | | |
3663 | | template <typename T1, typename T2> |
3664 | | struct is_constructible<std::pair<T1, T2>> : is_default_constructible<std::pair<T1, T2>> {}; |
3665 | | |
3666 | | template <typename T1, typename T2> |
3667 | | struct is_constructible<const std::pair<T1, T2>> : is_default_constructible<const std::pair<T1, T2>> {}; |
3668 | | |
3669 | | template <typename... Ts> |
3670 | | struct is_constructible<std::tuple<Ts...>> : is_default_constructible<std::tuple<Ts...>> {}; |
3671 | | |
3672 | | template <typename... Ts> |
3673 | | struct is_constructible<const std::tuple<Ts...>> : is_default_constructible<const std::tuple<Ts...>> {}; |
3674 | | |
3675 | | |
3676 | | template<typename T, typename = void> |
3677 | | struct is_iterator_traits : std::false_type {}; |
3678 | | |
3679 | | template<typename T> |
3680 | | struct is_iterator_traits<iterator_traits<T>> |
3681 | | { |
3682 | | private: |
3683 | | using traits = iterator_traits<T>; |
3684 | | |
3685 | | public: |
3686 | | static constexpr auto value = |
3687 | | is_detected<value_type_t, traits>::value && |
3688 | | is_detected<difference_type_t, traits>::value && |
3689 | | is_detected<pointer_t, traits>::value && |
3690 | | is_detected<iterator_category_t, traits>::value && |
3691 | | is_detected<reference_t, traits>::value; |
3692 | | }; |
3693 | | |
3694 | | template<typename T> |
3695 | | struct is_range |
3696 | | { |
3697 | | private: |
3698 | | using t_ref = typename std::add_lvalue_reference<T>::type; |
3699 | | |
3700 | | using iterator = detected_t<result_of_begin, t_ref>; |
3701 | | using sentinel = detected_t<result_of_end, t_ref>; |
3702 | | |
3703 | | // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator |
3704 | | // and https://en.cppreference.com/w/cpp/iterator/sentinel_for |
3705 | | // but reimplementing these would be too much work, as a lot of other concepts are used underneath |
3706 | | static constexpr auto is_iterator_begin = |
3707 | | is_iterator_traits<iterator_traits<iterator>>::value; |
3708 | | |
3709 | | public: |
3710 | | static constexpr bool value = !std::is_same<iterator, nonesuch>::value && !std::is_same<sentinel, nonesuch>::value && is_iterator_begin; |
3711 | | }; |
3712 | | |
3713 | | template<typename R> |
3714 | | using iterator_t = enable_if_t<is_range<R>::value, result_of_begin<decltype(std::declval<R&>())>>; |
3715 | | |
3716 | | template<typename T> |
3717 | | using range_value_t = value_type_t<iterator_traits<iterator_t<T>>>; |
3718 | | |
3719 | | // The following implementation of is_complete_type is taken from |
3720 | | // https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ |
3721 | | // and is written by Xiang Fan who agreed to using it in this library. |
3722 | | |
3723 | | template<typename T, typename = void> |
3724 | | struct is_complete_type : std::false_type {}; |
3725 | | |
3726 | | template<typename T> |
3727 | | struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_type {}; |
3728 | | |
3729 | | template<typename BasicJsonType, typename CompatibleObjectType, |
3730 | | typename = void> |
3731 | | struct is_compatible_object_type_impl : std::false_type {}; |
3732 | | |
3733 | | template<typename BasicJsonType, typename CompatibleObjectType> |
3734 | | struct is_compatible_object_type_impl < |
3735 | | BasicJsonType, CompatibleObjectType, |
3736 | | enable_if_t < is_detected<mapped_type_t, CompatibleObjectType>::value&& |
3737 | | is_detected<key_type_t, CompatibleObjectType>::value >> |
3738 | | { |
3739 | | using object_t = typename BasicJsonType::object_t; |
3740 | | |
3741 | | // macOS's is_constructible does not play well with nonesuch... |
3742 | | static constexpr bool value = |
3743 | | is_constructible<typename object_t::key_type, |
3744 | | typename CompatibleObjectType::key_type>::value && |
3745 | | is_constructible<typename object_t::mapped_type, |
3746 | | typename CompatibleObjectType::mapped_type>::value; |
3747 | | }; |
3748 | | |
3749 | | template<typename BasicJsonType, typename CompatibleObjectType> |
3750 | | struct is_compatible_object_type |
3751 | | : is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {}; |
3752 | | |
3753 | | template<typename BasicJsonType, typename ConstructibleObjectType, |
3754 | | typename = void> |
3755 | | struct is_constructible_object_type_impl : std::false_type {}; |
3756 | | |
3757 | | template<typename BasicJsonType, typename ConstructibleObjectType> |
3758 | | struct is_constructible_object_type_impl < |
3759 | | BasicJsonType, ConstructibleObjectType, |
3760 | | enable_if_t < is_detected<mapped_type_t, ConstructibleObjectType>::value&& |
3761 | | is_detected<key_type_t, ConstructibleObjectType>::value >> |
3762 | | { |
3763 | | using object_t = typename BasicJsonType::object_t; |
3764 | | |
3765 | | static constexpr bool value = |
3766 | | (is_default_constructible<ConstructibleObjectType>::value && |
3767 | | (std::is_move_assignable<ConstructibleObjectType>::value || |
3768 | | std::is_copy_assignable<ConstructibleObjectType>::value) && |
3769 | | (is_constructible<typename ConstructibleObjectType::key_type, |
3770 | | typename object_t::key_type>::value && |
3771 | | std::is_same < |
3772 | | typename object_t::mapped_type, |
3773 | | typename ConstructibleObjectType::mapped_type >::value)) || |
3774 | | (has_from_json<BasicJsonType, |
3775 | | typename ConstructibleObjectType::mapped_type>::value || |
3776 | | has_non_default_from_json < |
3777 | | BasicJsonType, |
3778 | | typename ConstructibleObjectType::mapped_type >::value); |
3779 | | }; |
3780 | | |
3781 | | template<typename BasicJsonType, typename ConstructibleObjectType> |
3782 | | struct is_constructible_object_type |
3783 | | : is_constructible_object_type_impl<BasicJsonType, |
3784 | | ConstructibleObjectType> {}; |
3785 | | |
3786 | | template<typename BasicJsonType, typename CompatibleStringType> |
3787 | | struct is_compatible_string_type |
3788 | | { |
3789 | | static constexpr auto value = |
3790 | | is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value; |
3791 | | }; |
3792 | | |
3793 | | template<typename BasicJsonType, typename ConstructibleStringType> |
3794 | | struct is_constructible_string_type |
3795 | | { |
3796 | | static constexpr auto value = |
3797 | | is_constructible<ConstructibleStringType, |
3798 | | typename BasicJsonType::string_t>::value; |
3799 | | }; |
3800 | | |
3801 | | template<typename BasicJsonType, typename CompatibleArrayType, typename = void> |
3802 | | struct is_compatible_array_type_impl : std::false_type {}; |
3803 | | |
3804 | | template<typename BasicJsonType, typename CompatibleArrayType> |
3805 | | struct is_compatible_array_type_impl < |
3806 | | BasicJsonType, CompatibleArrayType, |
3807 | | enable_if_t < |
3808 | | is_detected<iterator_t, CompatibleArrayType>::value&& |
3809 | | is_iterator_traits<iterator_traits<detected_t<iterator_t, CompatibleArrayType>>>::value&& |
3810 | | // special case for types like std::filesystem::path whose iterator's value_type are themselves |
3811 | | // c.f. https://github.com/nlohmann/json/pull/3073 |
3812 | | !std::is_same<CompatibleArrayType, detected_t<range_value_t, CompatibleArrayType>>::value >> |
3813 | | { |
3814 | | static constexpr bool value = |
3815 | | is_constructible<BasicJsonType, |
3816 | | range_value_t<CompatibleArrayType>>::value; |
3817 | | }; |
3818 | | |
3819 | | template<typename BasicJsonType, typename CompatibleArrayType> |
3820 | | struct is_compatible_array_type |
3821 | | : is_compatible_array_type_impl<BasicJsonType, CompatibleArrayType> {}; |
3822 | | |
3823 | | template<typename BasicJsonType, typename ConstructibleArrayType, typename = void> |
3824 | | struct is_constructible_array_type_impl : std::false_type {}; |
3825 | | |
3826 | | template<typename BasicJsonType, typename ConstructibleArrayType> |
3827 | | struct is_constructible_array_type_impl < |
3828 | | BasicJsonType, ConstructibleArrayType, |
3829 | | enable_if_t<std::is_same<ConstructibleArrayType, |
3830 | | typename BasicJsonType::value_type>::value >> |
3831 | | : std::true_type {}; |
3832 | | |
3833 | | template<typename BasicJsonType, typename ConstructibleArrayType> |
3834 | | struct is_constructible_array_type_impl < |
3835 | | BasicJsonType, ConstructibleArrayType, |
3836 | | enable_if_t < !std::is_same<ConstructibleArrayType, |
3837 | | typename BasicJsonType::value_type>::value&& |
3838 | | !is_compatible_string_type<BasicJsonType, ConstructibleArrayType>::value&& |
3839 | | is_default_constructible<ConstructibleArrayType>::value&& |
3840 | | (std::is_move_assignable<ConstructibleArrayType>::value || |
3841 | | std::is_copy_assignable<ConstructibleArrayType>::value)&& |
3842 | | is_detected<iterator_t, ConstructibleArrayType>::value&& |
3843 | | is_iterator_traits<iterator_traits<detected_t<iterator_t, ConstructibleArrayType>>>::value&& |
3844 | | is_detected<range_value_t, ConstructibleArrayType>::value&& |
3845 | | // special case for types like std::filesystem::path whose iterator's value_type are themselves |
3846 | | // c.f. https://github.com/nlohmann/json/pull/3073 |
3847 | | !std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&& |
3848 | | is_complete_type < |
3849 | | detected_t<range_value_t, ConstructibleArrayType >>::value >> |
3850 | | { |
3851 | | using value_type = range_value_t<ConstructibleArrayType>; |
3852 | | |
3853 | | static constexpr bool value = |
3854 | | std::is_same<value_type, |
3855 | | typename BasicJsonType::array_t::value_type>::value || |
3856 | | has_from_json<BasicJsonType, |
3857 | | value_type>::value || |
3858 | | has_non_default_from_json < |
3859 | | BasicJsonType, |
3860 | | value_type >::value; |
3861 | | }; |
3862 | | |
3863 | | template<typename BasicJsonType, typename ConstructibleArrayType> |
3864 | | struct is_constructible_array_type |
3865 | | : is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {}; |
3866 | | |
3867 | | template<typename RealIntegerType, typename CompatibleNumberIntegerType, |
3868 | | typename = void> |
3869 | | struct is_compatible_integer_type_impl : std::false_type {}; |
3870 | | |
3871 | | template<typename RealIntegerType, typename CompatibleNumberIntegerType> |
3872 | | struct is_compatible_integer_type_impl < |
3873 | | RealIntegerType, CompatibleNumberIntegerType, |
3874 | | enable_if_t < std::is_integral<RealIntegerType>::value&& |
3875 | | std::is_integral<CompatibleNumberIntegerType>::value&& |
3876 | | !std::is_same<bool, CompatibleNumberIntegerType>::value >> |
3877 | | { |
3878 | | // is there an assert somewhere on overflows? |
3879 | | using RealLimits = std::numeric_limits<RealIntegerType>; |
3880 | | using CompatibleLimits = std::numeric_limits<CompatibleNumberIntegerType>; |
3881 | | |
3882 | | static constexpr auto value = |
3883 | | is_constructible<RealIntegerType, |
3884 | | CompatibleNumberIntegerType>::value && |
3885 | | CompatibleLimits::is_integer && |
3886 | | RealLimits::is_signed == CompatibleLimits::is_signed; |
3887 | | }; |
3888 | | |
3889 | | template<typename RealIntegerType, typename CompatibleNumberIntegerType> |
3890 | | struct is_compatible_integer_type |
3891 | | : is_compatible_integer_type_impl<RealIntegerType, |
3892 | | CompatibleNumberIntegerType> {}; |
3893 | | |
3894 | | template<typename BasicJsonType, typename CompatibleType, typename = void> |
3895 | | struct is_compatible_type_impl: std::false_type {}; |
3896 | | |
3897 | | template<typename BasicJsonType, typename CompatibleType> |
3898 | | struct is_compatible_type_impl < |
3899 | | BasicJsonType, CompatibleType, |
3900 | | enable_if_t<is_complete_type<CompatibleType>::value >> |
3901 | | { |
3902 | | static constexpr bool value = |
3903 | | has_to_json<BasicJsonType, CompatibleType>::value; |
3904 | | }; |
3905 | | |
3906 | | template<typename BasicJsonType, typename CompatibleType> |
3907 | | struct is_compatible_type |
3908 | | : is_compatible_type_impl<BasicJsonType, CompatibleType> {}; |
3909 | | |
3910 | | template<typename T1, typename T2> |
3911 | | struct is_constructible_tuple : std::false_type {}; |
3912 | | |
3913 | | template<typename T1, typename... Args> |
3914 | | struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<is_constructible<T1, Args>...> {}; |
3915 | | |
3916 | | // a naive helper to check if a type is an ordered_map (exploits the fact that |
3917 | | // ordered_map inherits capacity() from std::vector) |
3918 | | template <typename T> |
3919 | | struct is_ordered_map |
3920 | | { |
3921 | | using one = char; |
3922 | | |
3923 | | struct two |
3924 | | { |
3925 | | char x[2]; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) |
3926 | | }; |
3927 | | |
3928 | | template <typename C> static one test( decltype(&C::capacity) ) ; |
3929 | | template <typename C> static two test(...); |
3930 | | |
3931 | | enum { value = sizeof(test<T>(nullptr)) == sizeof(char) }; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) |
3932 | | }; |
3933 | | |
3934 | | // to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) |
3935 | | template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 > |
3936 | | T conditional_static_cast(U value) |
3937 | | { |
3938 | | return static_cast<T>(value); |
3939 | | } |
3940 | | |
3941 | | template<typename T, typename U, enable_if_t<std::is_same<T, U>::value, int> = 0> |
3942 | | T conditional_static_cast(U value) |
3943 | | { |
3944 | | return value; |
3945 | | } |
3946 | | |
3947 | | } // namespace detail |
3948 | | } // namespace nlohmann |
3949 | | |
3950 | | // #include <nlohmann/detail/value_t.hpp> |
3951 | | |
3952 | | |
3953 | | #ifdef JSON_HAS_CPP_17 |
3954 | | #include <filesystem> |
3955 | | #endif |
3956 | | |
3957 | | namespace nlohmann |
3958 | | { |
3959 | | namespace detail |
3960 | | { |
3961 | | template<typename BasicJsonType> |
3962 | | void from_json(const BasicJsonType& j, typename std::nullptr_t& n) |
3963 | | { |
3964 | | if (JSON_HEDLEY_UNLIKELY(!j.is_null())) |
3965 | | { |
3966 | | JSON_THROW(type_error::create(302, "type must be null, but is " + std::string(j.type_name()), j)); |
3967 | | } |
3968 | | n = nullptr; |
3969 | | } |
3970 | | |
3971 | | // overloads for basic_json template parameters |
3972 | | template < typename BasicJsonType, typename ArithmeticType, |
3973 | | enable_if_t < std::is_arithmetic<ArithmeticType>::value&& |
3974 | | !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value, |
3975 | | int > = 0 > |
3976 | | void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) |
3977 | 2.86M | { |
3978 | 2.86M | switch (static_cast<value_t>(j)) |
3979 | 2.86M | { |
3980 | 2.84M | case value_t::number_unsigned: |
3981 | 2.84M | { |
3982 | 2.84M | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>()); |
3983 | 2.84M | break; |
3984 | 0 | } |
3985 | 8.35k | case value_t::number_integer: |
3986 | 8.35k | { |
3987 | 8.35k | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>()); |
3988 | 8.35k | break; |
3989 | 0 | } |
3990 | 6.66k | case value_t::number_float: |
3991 | 6.66k | { |
3992 | 6.66k | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>()); |
3993 | 6.66k | break; |
3994 | 0 | } |
3995 | | |
3996 | 0 | case value_t::null: |
3997 | 0 | case value_t::object: |
3998 | 0 | case value_t::array: |
3999 | 0 | case value_t::string: |
4000 | 0 | case value_t::boolean: |
4001 | 0 | case value_t::binary: |
4002 | 0 | case value_t::discarded: |
4003 | 0 | default: |
4004 | 0 | JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()), j)); |
4005 | 2.86M | } |
4006 | 2.86M | } void nlohmann::detail::get_arithmetic_value<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, long, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&, long&) Line | Count | Source | 3977 | 1.15M | { | 3978 | 1.15M | switch (static_cast<value_t>(j)) | 3979 | 1.15M | { | 3980 | 1.14M | case value_t::number_unsigned: | 3981 | 1.14M | { | 3982 | 1.14M | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>()); | 3983 | 1.14M | break; | 3984 | 0 | } | 3985 | 5.69k | case value_t::number_integer: | 3986 | 5.69k | { | 3987 | 5.69k | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>()); | 3988 | 5.69k | break; | 3989 | 0 | } | 3990 | 0 | case value_t::number_float: | 3991 | 0 | { | 3992 | 0 | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>()); | 3993 | 0 | break; | 3994 | 0 | } | 3995 | | | 3996 | 0 | case value_t::null: | 3997 | 0 | case value_t::object: | 3998 | 0 | case value_t::array: | 3999 | 0 | case value_t::string: | 4000 | 0 | case value_t::boolean: | 4001 | 0 | case value_t::binary: | 4002 | 0 | case value_t::discarded: | 4003 | 0 | default: | 4004 | 0 | JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()), j)); | 4005 | 1.15M | } | 4006 | 1.15M | } |
void nlohmann::detail::get_arithmetic_value<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, double, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&, double&) Line | Count | Source | 3977 | 1.70M | { | 3978 | 1.70M | switch (static_cast<value_t>(j)) | 3979 | 1.70M | { | 3980 | 1.69M | case value_t::number_unsigned: | 3981 | 1.69M | { | 3982 | 1.69M | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>()); | 3983 | 1.69M | break; | 3984 | 0 | } | 3985 | 2.66k | case value_t::number_integer: | 3986 | 2.66k | { | 3987 | 2.66k | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>()); | 3988 | 2.66k | break; | 3989 | 0 | } | 3990 | 6.66k | case value_t::number_float: | 3991 | 6.66k | { | 3992 | 6.66k | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>()); | 3993 | 6.66k | break; | 3994 | 0 | } | 3995 | | | 3996 | 0 | case value_t::null: | 3997 | 0 | case value_t::object: | 3998 | 0 | case value_t::array: | 3999 | 0 | case value_t::string: | 4000 | 0 | case value_t::boolean: | 4001 | 0 | case value_t::binary: | 4002 | 0 | case value_t::discarded: | 4003 | 0 | default: | 4004 | 0 | JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()), j)); | 4005 | 1.70M | } | 4006 | 1.70M | } |
Unexecuted instantiation: void nlohmann::detail::get_arithmetic_value<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, unsigned long, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&, unsigned long&) |
4007 | | |
4008 | | template<typename BasicJsonType> |
4009 | | void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) |
4010 | 568 | { |
4011 | 568 | if (JSON_HEDLEY_UNLIKELY(!j.is_boolean())) |
4012 | 0 | { |
4013 | 0 | JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name()), j)); |
4014 | 0 | } |
4015 | 568 | b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>(); |
4016 | 568 | } |
4017 | | |
4018 | | template<typename BasicJsonType> |
4019 | | void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) |
4020 | 87.2k | { |
4021 | 87.2k | if (JSON_HEDLEY_UNLIKELY(!j.is_string())) |
4022 | 0 | { |
4023 | 0 | JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()), j)); |
4024 | 0 | } |
4025 | 87.2k | s = *j.template get_ptr<const typename BasicJsonType::string_t*>(); |
4026 | 87.2k | } |
4027 | | |
4028 | | template < |
4029 | | typename BasicJsonType, typename ConstructibleStringType, |
4030 | | enable_if_t < |
4031 | | is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value&& |
4032 | | !std::is_same<typename BasicJsonType::string_t, |
4033 | | ConstructibleStringType>::value, |
4034 | | int > = 0 > |
4035 | | void from_json(const BasicJsonType& j, ConstructibleStringType& s) |
4036 | | { |
4037 | | if (JSON_HEDLEY_UNLIKELY(!j.is_string())) |
4038 | | { |
4039 | | JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()), j)); |
4040 | | } |
4041 | | |
4042 | | s = *j.template get_ptr<const typename BasicJsonType::string_t*>(); |
4043 | | } |
4044 | | |
4045 | | template<typename BasicJsonType> |
4046 | | void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val) |
4047 | 1.70M | { |
4048 | 1.70M | get_arithmetic_value(j, val); |
4049 | 1.70M | } |
4050 | | |
4051 | | template<typename BasicJsonType> |
4052 | | void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val) |
4053 | 0 | { |
4054 | 0 | get_arithmetic_value(j, val); |
4055 | 0 | } |
4056 | | |
4057 | | template<typename BasicJsonType> |
4058 | | void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val) |
4059 | 1.15M | { |
4060 | 1.15M | get_arithmetic_value(j, val); |
4061 | 1.15M | } |
4062 | | |
4063 | | template<typename BasicJsonType, typename EnumType, |
4064 | | enable_if_t<std::is_enum<EnumType>::value, int> = 0> |
4065 | | void from_json(const BasicJsonType& j, EnumType& e) |
4066 | | { |
4067 | | typename std::underlying_type<EnumType>::type val; |
4068 | | get_arithmetic_value(j, val); |
4069 | | e = static_cast<EnumType>(val); |
4070 | | } |
4071 | | |
4072 | | // forward_list doesn't have an insert method |
4073 | | template<typename BasicJsonType, typename T, typename Allocator, |
4074 | | enable_if_t<is_getable<BasicJsonType, T>::value, int> = 0> |
4075 | | void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l) |
4076 | | { |
4077 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4078 | | { |
4079 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4080 | | } |
4081 | | l.clear(); |
4082 | | std::transform(j.rbegin(), j.rend(), |
4083 | | std::front_inserter(l), [](const BasicJsonType & i) |
4084 | | { |
4085 | | return i.template get<T>(); |
4086 | | }); |
4087 | | } |
4088 | | |
4089 | | // valarray doesn't have an insert method |
4090 | | template<typename BasicJsonType, typename T, |
4091 | | enable_if_t<is_getable<BasicJsonType, T>::value, int> = 0> |
4092 | | void from_json(const BasicJsonType& j, std::valarray<T>& l) |
4093 | | { |
4094 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4095 | | { |
4096 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4097 | | } |
4098 | | l.resize(j.size()); |
4099 | | std::transform(j.begin(), j.end(), std::begin(l), |
4100 | | [](const BasicJsonType & elem) |
4101 | | { |
4102 | | return elem.template get<T>(); |
4103 | | }); |
4104 | | } |
4105 | | |
4106 | | template<typename BasicJsonType, typename T, std::size_t N> |
4107 | | auto from_json(const BasicJsonType& j, T (&arr)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) |
4108 | | -> decltype(j.template get<T>(), void()) |
4109 | | { |
4110 | | for (std::size_t i = 0; i < N; ++i) |
4111 | | { |
4112 | | arr[i] = j.at(i).template get<T>(); |
4113 | | } |
4114 | | } |
4115 | | |
4116 | | template<typename BasicJsonType> |
4117 | | void from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_t& arr, priority_tag<3> /*unused*/) |
4118 | | { |
4119 | | arr = *j.template get_ptr<const typename BasicJsonType::array_t*>(); |
4120 | | } |
4121 | | |
4122 | | template<typename BasicJsonType, typename T, std::size_t N> |
4123 | | auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& arr, |
4124 | | priority_tag<2> /*unused*/) |
4125 | | -> decltype(j.template get<T>(), void()) |
4126 | | { |
4127 | | for (std::size_t i = 0; i < N; ++i) |
4128 | | { |
4129 | | arr[i] = j.at(i).template get<T>(); |
4130 | | } |
4131 | | } |
4132 | | |
4133 | | template<typename BasicJsonType, typename ConstructibleArrayType, |
4134 | | enable_if_t< |
4135 | | std::is_assignable<ConstructibleArrayType&, ConstructibleArrayType>::value, |
4136 | | int> = 0> |
4137 | | auto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<1> /*unused*/) |
4138 | | -> decltype( |
4139 | | arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()), |
4140 | | j.template get<typename ConstructibleArrayType::value_type>(), |
4141 | | void()) |
4142 | | { |
4143 | | using std::end; |
4144 | | |
4145 | | ConstructibleArrayType ret; |
4146 | | ret.reserve(j.size()); |
4147 | | std::transform(j.begin(), j.end(), |
4148 | | std::inserter(ret, end(ret)), [](const BasicJsonType & i) |
4149 | | { |
4150 | | // get<BasicJsonType>() returns *this, this won't call a from_json |
4151 | | // method when value_type is BasicJsonType |
4152 | | return i.template get<typename ConstructibleArrayType::value_type>(); |
4153 | | }); |
4154 | | arr = std::move(ret); |
4155 | | } |
4156 | | |
4157 | | template<typename BasicJsonType, typename ConstructibleArrayType, |
4158 | | enable_if_t< |
4159 | | std::is_assignable<ConstructibleArrayType&, ConstructibleArrayType>::value, |
4160 | | int> = 0> |
4161 | | void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, |
4162 | | priority_tag<0> /*unused*/) |
4163 | | { |
4164 | | using std::end; |
4165 | | |
4166 | | ConstructibleArrayType ret; |
4167 | | std::transform( |
4168 | | j.begin(), j.end(), std::inserter(ret, end(ret)), |
4169 | | [](const BasicJsonType & i) |
4170 | | { |
4171 | | // get<BasicJsonType>() returns *this, this won't call a from_json |
4172 | | // method when value_type is BasicJsonType |
4173 | | return i.template get<typename ConstructibleArrayType::value_type>(); |
4174 | | }); |
4175 | | arr = std::move(ret); |
4176 | | } |
4177 | | |
4178 | | template < typename BasicJsonType, typename ConstructibleArrayType, |
4179 | | enable_if_t < |
4180 | | is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value&& |
4181 | | !is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value&& |
4182 | | !is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value&& |
4183 | | !std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value&& |
4184 | | !is_basic_json<ConstructibleArrayType>::value, |
4185 | | int > = 0 > |
4186 | | auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr) |
4187 | | -> decltype(from_json_array_impl(j, arr, priority_tag<3> {}), |
4188 | | j.template get<typename ConstructibleArrayType::value_type>(), |
4189 | | void()) |
4190 | | { |
4191 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4192 | | { |
4193 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4194 | | } |
4195 | | |
4196 | | from_json_array_impl(j, arr, priority_tag<3> {}); |
4197 | | } |
4198 | | |
4199 | | template < typename BasicJsonType, typename T, std::size_t... Idx > |
4200 | | std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j, |
4201 | | identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/) |
4202 | | { |
4203 | | return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } }; |
4204 | | } |
4205 | | |
4206 | | template < typename BasicJsonType, typename T, std::size_t N > |
4207 | | auto from_json(BasicJsonType&& j, identity_tag<std::array<T, N>> tag) |
4208 | | -> decltype(from_json_inplace_array_impl(std::forward<BasicJsonType>(j), tag, make_index_sequence<N> {})) |
4209 | | { |
4210 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4211 | | { |
4212 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4213 | | } |
4214 | | |
4215 | | return from_json_inplace_array_impl(std::forward<BasicJsonType>(j), tag, make_index_sequence<N> {}); |
4216 | | } |
4217 | | |
4218 | | template<typename BasicJsonType> |
4219 | | void from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin) |
4220 | | { |
4221 | | if (JSON_HEDLEY_UNLIKELY(!j.is_binary())) |
4222 | | { |
4223 | | JSON_THROW(type_error::create(302, "type must be binary, but is " + std::string(j.type_name()), j)); |
4224 | | } |
4225 | | |
4226 | | bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>(); |
4227 | | } |
4228 | | |
4229 | | template<typename BasicJsonType, typename ConstructibleObjectType, |
4230 | | enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0> |
4231 | | void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) |
4232 | | { |
4233 | | if (JSON_HEDLEY_UNLIKELY(!j.is_object())) |
4234 | | { |
4235 | | JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name()), j)); |
4236 | | } |
4237 | | |
4238 | | ConstructibleObjectType ret; |
4239 | | const auto* inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>(); |
4240 | | using value_type = typename ConstructibleObjectType::value_type; |
4241 | | std::transform( |
4242 | | inner_object->begin(), inner_object->end(), |
4243 | | std::inserter(ret, ret.begin()), |
4244 | | [](typename BasicJsonType::object_t::value_type const & p) |
4245 | | { |
4246 | | return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>()); |
4247 | | }); |
4248 | | obj = std::move(ret); |
4249 | | } |
4250 | | |
4251 | | // overload for arithmetic types, not chosen for basic_json template arguments |
4252 | | // (BooleanType, etc..); note: Is it really necessary to provide explicit |
4253 | | // overloads for boolean_t etc. in case of a custom BooleanType which is not |
4254 | | // an arithmetic type? |
4255 | | template < typename BasicJsonType, typename ArithmeticType, |
4256 | | enable_if_t < |
4257 | | std::is_arithmetic<ArithmeticType>::value&& |
4258 | | !std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value&& |
4259 | | !std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value&& |
4260 | | !std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value&& |
4261 | | !std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value, |
4262 | | int > = 0 > |
4263 | | void from_json(const BasicJsonType& j, ArithmeticType& val) |
4264 | | { |
4265 | | switch (static_cast<value_t>(j)) |
4266 | | { |
4267 | | case value_t::number_unsigned: |
4268 | | { |
4269 | | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>()); |
4270 | | break; |
4271 | | } |
4272 | | case value_t::number_integer: |
4273 | | { |
4274 | | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>()); |
4275 | | break; |
4276 | | } |
4277 | | case value_t::number_float: |
4278 | | { |
4279 | | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>()); |
4280 | | break; |
4281 | | } |
4282 | | case value_t::boolean: |
4283 | | { |
4284 | | val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>()); |
4285 | | break; |
4286 | | } |
4287 | | |
4288 | | case value_t::null: |
4289 | | case value_t::object: |
4290 | | case value_t::array: |
4291 | | case value_t::string: |
4292 | | case value_t::binary: |
4293 | | case value_t::discarded: |
4294 | | default: |
4295 | | JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name()), j)); |
4296 | | } |
4297 | | } |
4298 | | |
4299 | | template<typename BasicJsonType, typename... Args, std::size_t... Idx> |
4300 | | std::tuple<Args...> from_json_tuple_impl_base(BasicJsonType&& j, index_sequence<Idx...> /*unused*/) |
4301 | | { |
4302 | | return std::make_tuple(std::forward<BasicJsonType>(j).at(Idx).template get<Args>()...); |
4303 | | } |
4304 | | |
4305 | | template < typename BasicJsonType, class A1, class A2 > |
4306 | | std::pair<A1, A2> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::pair<A1, A2>> /*unused*/, priority_tag<0> /*unused*/) |
4307 | | { |
4308 | | return {std::forward<BasicJsonType>(j).at(0).template get<A1>(), |
4309 | | std::forward<BasicJsonType>(j).at(1).template get<A2>()}; |
4310 | | } |
4311 | | |
4312 | | template<typename BasicJsonType, typename A1, typename A2> |
4313 | | void from_json_tuple_impl(BasicJsonType&& j, std::pair<A1, A2>& p, priority_tag<1> /*unused*/) |
4314 | | { |
4315 | | p = from_json_tuple_impl(std::forward<BasicJsonType>(j), identity_tag<std::pair<A1, A2>> {}, priority_tag<0> {}); |
4316 | | } |
4317 | | |
4318 | | template<typename BasicJsonType, typename... Args> |
4319 | | std::tuple<Args...> from_json_tuple_impl(BasicJsonType&& j, identity_tag<std::tuple<Args...>> /*unused*/, priority_tag<2> /*unused*/) |
4320 | | { |
4321 | | return from_json_tuple_impl_base<BasicJsonType, Args...>(std::forward<BasicJsonType>(j), index_sequence_for<Args...> {}); |
4322 | | } |
4323 | | |
4324 | | template<typename BasicJsonType, typename... Args> |
4325 | | void from_json_tuple_impl(BasicJsonType&& j, std::tuple<Args...>& t, priority_tag<3> /*unused*/) |
4326 | | { |
4327 | | t = from_json_tuple_impl_base<BasicJsonType, Args...>(std::forward<BasicJsonType>(j), index_sequence_for<Args...> {}); |
4328 | | } |
4329 | | |
4330 | | template<typename BasicJsonType, typename TupleRelated> |
4331 | | auto from_json(BasicJsonType&& j, TupleRelated&& t) |
4332 | | -> decltype(from_json_tuple_impl(std::forward<BasicJsonType>(j), std::forward<TupleRelated>(t), priority_tag<3> {})) |
4333 | | { |
4334 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4335 | | { |
4336 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4337 | | } |
4338 | | |
4339 | | return from_json_tuple_impl(std::forward<BasicJsonType>(j), std::forward<TupleRelated>(t), priority_tag<3> {}); |
4340 | | } |
4341 | | |
4342 | | template < typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator, |
4343 | | typename = enable_if_t < !std::is_constructible < |
4344 | | typename BasicJsonType::string_t, Key >::value >> |
4345 | | void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m) |
4346 | | { |
4347 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4348 | | { |
4349 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4350 | | } |
4351 | | m.clear(); |
4352 | | for (const auto& p : j) |
4353 | | { |
4354 | | if (JSON_HEDLEY_UNLIKELY(!p.is_array())) |
4355 | | { |
4356 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name()), j)); |
4357 | | } |
4358 | | m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>()); |
4359 | | } |
4360 | | } |
4361 | | |
4362 | | template < typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator, |
4363 | | typename = enable_if_t < !std::is_constructible < |
4364 | | typename BasicJsonType::string_t, Key >::value >> |
4365 | | void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m) |
4366 | | { |
4367 | | if (JSON_HEDLEY_UNLIKELY(!j.is_array())) |
4368 | | { |
4369 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name()), j)); |
4370 | | } |
4371 | | m.clear(); |
4372 | | for (const auto& p : j) |
4373 | | { |
4374 | | if (JSON_HEDLEY_UNLIKELY(!p.is_array())) |
4375 | | { |
4376 | | JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name()), j)); |
4377 | | } |
4378 | | m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>()); |
4379 | | } |
4380 | | } |
4381 | | |
4382 | | #ifdef JSON_HAS_CPP_17 |
4383 | | template<typename BasicJsonType> |
4384 | | void from_json(const BasicJsonType& j, std::filesystem::path& p) |
4385 | | { |
4386 | | if (JSON_HEDLEY_UNLIKELY(!j.is_string())) |
4387 | | { |
4388 | | JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()), j)); |
4389 | | } |
4390 | | p = *j.template get_ptr<const typename BasicJsonType::string_t*>(); |
4391 | | } |
4392 | | #endif |
4393 | | |
4394 | | struct from_json_fn |
4395 | | { |
4396 | | template<typename BasicJsonType, typename T> |
4397 | | auto operator()(const BasicJsonType& j, T&& val) const |
4398 | | noexcept(noexcept(from_json(j, std::forward<T>(val)))) |
4399 | | -> decltype(from_json(j, std::forward<T>(val))) |
4400 | 2.94M | { |
4401 | 2.94M | return from_json(j, std::forward<T>(val)); |
4402 | 2.94M | } _ZNK8nlohmann6detail12from_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERbEEDTcl9from_jsonfp_clsr3stdE7forwardIT0_Efp0_EEERKT_OSI_ Line | Count | Source | 4400 | 568 | { | 4401 | 568 | return from_json(j, std::forward<T>(val)); | 4402 | 568 | } |
_ZNK8nlohmann6detail12from_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERlEEDTcl9from_jsonfp_clsr3stdE7forwardIT0_Efp0_EEERKT_OSI_ Line | Count | Source | 4400 | 1.15M | { | 4401 | 1.15M | return from_json(j, std::forward<T>(val)); | 4402 | 1.15M | } |
_ZNK8nlohmann6detail12from_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERdEEDTcl9from_jsonfp_clsr3stdE7forwardIT0_Efp0_EEERKT_OSI_ Line | Count | Source | 4400 | 1.70M | { | 4401 | 1.70M | return from_json(j, std::forward<T>(val)); | 4402 | 1.70M | } |
_ZNK8nlohmann6detail12from_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERSC_EEDTcl9from_jsonfp_clsr3stdE7forwardIT0_Efp0_EEERKT_OSI_ Line | Count | Source | 4400 | 87.2k | { | 4401 | 87.2k | return from_json(j, std::forward<T>(val)); | 4402 | 87.2k | } |
Unexecuted instantiation: _ZNK8nlohmann6detail12from_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERmEEDTcl9from_jsonfp_clsr3stdE7forwardIT0_Efp0_EEERKT_OSI_ |
4403 | | }; |
4404 | | } // namespace detail |
4405 | | |
4406 | | /// namespace to hold default `from_json` function |
4407 | | /// to see why this is required: |
4408 | | /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html |
4409 | | namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces) |
4410 | | { |
4411 | | constexpr const auto& from_json = detail::static_const<detail::from_json_fn>::value; // NOLINT(misc-definitions-in-headers) |
4412 | | } // namespace |
4413 | | } // namespace nlohmann |
4414 | | |
4415 | | // #include <nlohmann/detail/conversions/to_json.hpp> |
4416 | | |
4417 | | |
4418 | | #include <algorithm> // copy |
4419 | | #include <iterator> // begin, end |
4420 | | #include <string> // string |
4421 | | #include <tuple> // tuple, get |
4422 | | #include <type_traits> // is_same, is_constructible, is_floating_point, is_enum, underlying_type |
4423 | | #include <utility> // move, forward, declval, pair |
4424 | | #include <valarray> // valarray |
4425 | | #include <vector> // vector |
4426 | | |
4427 | | // #include <nlohmann/detail/macro_scope.hpp> |
4428 | | |
4429 | | // #include <nlohmann/detail/iterators/iteration_proxy.hpp> |
4430 | | |
4431 | | |
4432 | | #include <cstddef> // size_t |
4433 | | #include <iterator> // input_iterator_tag |
4434 | | #include <string> // string, to_string |
4435 | | #include <tuple> // tuple_size, get, tuple_element |
4436 | | #include <utility> // move |
4437 | | |
4438 | | // #include <nlohmann/detail/meta/type_traits.hpp> |
4439 | | |
4440 | | // #include <nlohmann/detail/value_t.hpp> |
4441 | | |
4442 | | |
4443 | | namespace nlohmann |
4444 | | { |
4445 | | namespace detail |
4446 | | { |
4447 | | template<typename string_type> |
4448 | | void int_to_string( string_type& target, std::size_t value ) |
4449 | 0 | { |
4450 | 0 | // For ADL |
4451 | 0 | using std::to_string; |
4452 | 0 | target = to_string(value); |
4453 | 0 | } |
4454 | | template<typename IteratorType> class iteration_proxy_value |
4455 | | { |
4456 | | public: |
4457 | | using difference_type = std::ptrdiff_t; |
4458 | | using value_type = iteration_proxy_value; |
4459 | | using pointer = value_type * ; |
4460 | | using reference = value_type & ; |
4461 | | using iterator_category = std::input_iterator_tag; |
4462 | | using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type; |
4463 | | |
4464 | | private: |
4465 | | /// the iterator |
4466 | | IteratorType anchor; |
4467 | | /// an index for arrays (used to create key names) |
4468 | | std::size_t array_index = 0; |
4469 | | /// last stringified array index |
4470 | | mutable std::size_t array_index_last = 0; |
4471 | | /// a string representation of the array index |
4472 | | mutable string_type array_index_str = "0"; |
4473 | | /// an empty string (to return a reference for primitive values) |
4474 | | const string_type empty_str{}; |
4475 | | |
4476 | | public: |
4477 | | explicit iteration_proxy_value(IteratorType it) noexcept |
4478 | | : anchor(std::move(it)) |
4479 | | {} |
4480 | | |
4481 | | /// dereference operator (needed for range-based for) |
4482 | | iteration_proxy_value& operator*() |
4483 | 0 | { |
4484 | 0 | return *this; |
4485 | 0 | } |
4486 | | |
4487 | | /// increment operator (needed for range-based for) |
4488 | | iteration_proxy_value& operator++() |
4489 | 0 | { |
4490 | 0 | ++anchor; |
4491 | 0 | ++array_index; |
4492 | 0 |
|
4493 | 0 | return *this; |
4494 | 0 | } |
4495 | | |
4496 | | /// equality operator (needed for InputIterator) |
4497 | | bool operator==(const iteration_proxy_value& o) const |
4498 | | { |
4499 | | return anchor == o.anchor; |
4500 | | } |
4501 | | |
4502 | | /// inequality operator (needed for range-based for) |
4503 | | bool operator!=(const iteration_proxy_value& o) const |
4504 | 0 | { |
4505 | 0 | return anchor != o.anchor; |
4506 | 0 | } |
4507 | | |
4508 | | /// return key of the iterator |
4509 | | const string_type& key() const |
4510 | 0 | { |
4511 | 0 | JSON_ASSERT(anchor.m_object != nullptr); |
4512 | 0 |
|
4513 | 0 | switch (anchor.m_object->type()) |
4514 | 0 | { |
4515 | 0 | // use integer array index as key |
4516 | 0 | case value_t::array: |
4517 | 0 | { |
4518 | 0 | if (array_index != array_index_last) |
4519 | 0 | { |
4520 | 0 | int_to_string( array_index_str, array_index ); |
4521 | 0 | array_index_last = array_index; |
4522 | 0 | } |
4523 | 0 | return array_index_str; |
4524 | 0 | } |
4525 | 0 |
|
4526 | 0 | // use key from the object |
4527 | 0 | case value_t::object: |
4528 | 0 | return anchor.key(); |
4529 | 0 |
|
4530 | 0 | // use an empty key for all primitive types |
4531 | 0 | case value_t::null: |
4532 | 0 | case value_t::string: |
4533 | 0 | case value_t::boolean: |
4534 | 0 | case value_t::number_integer: |
4535 | 0 | case value_t::number_unsigned: |
4536 | 0 | case value_t::number_float: |
4537 | 0 | case value_t::binary: |
4538 | 0 | case value_t::discarded: |
4539 | 0 | default: |
4540 | 0 | return empty_str; |
4541 | 0 | } |
4542 | 0 | } |
4543 | | |
4544 | | /// return value of the iterator |
4545 | | typename IteratorType::reference value() const |
4546 | 0 | { |
4547 | 0 | return anchor.value(); |
4548 | 0 | } |
4549 | | }; |
4550 | | |
4551 | | /// proxy class for the items() function |
4552 | | template<typename IteratorType> class iteration_proxy |
4553 | | { |
4554 | | private: |
4555 | | /// the container to iterate |
4556 | | typename IteratorType::reference container; |
4557 | | |
4558 | | public: |
4559 | | /// construct iteration proxy from a container |
4560 | | explicit iteration_proxy(typename IteratorType::reference cont) noexcept |
4561 | | : container(cont) {} |
4562 | | |
4563 | | /// return iterator begin (needed for range-based for) |
4564 | | iteration_proxy_value<IteratorType> begin() noexcept |
4565 | 0 | { |
4566 | 0 | return iteration_proxy_value<IteratorType>(container.begin()); |
4567 | 0 | } |
4568 | | |
4569 | | /// return iterator end (needed for range-based for) |
4570 | | iteration_proxy_value<IteratorType> end() noexcept |
4571 | 0 | { |
4572 | 0 | return iteration_proxy_value<IteratorType>(container.end()); |
4573 | 0 | } |
4574 | | }; |
4575 | | // Structured Bindings Support |
4576 | | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ |
4577 | | // And see https://github.com/nlohmann/json/pull/1391 |
4578 | | template<std::size_t N, typename IteratorType, enable_if_t<N == 0, int> = 0> |
4579 | | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key()) |
4580 | | { |
4581 | | return i.key(); |
4582 | | } |
4583 | | // Structured Bindings Support |
4584 | | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ |
4585 | | // And see https://github.com/nlohmann/json/pull/1391 |
4586 | | template<std::size_t N, typename IteratorType, enable_if_t<N == 1, int> = 0> |
4587 | | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.value()) |
4588 | | { |
4589 | | return i.value(); |
4590 | | } |
4591 | | } // namespace detail |
4592 | | } // namespace nlohmann |
4593 | | |
4594 | | // The Addition to the STD Namespace is required to add |
4595 | | // Structured Bindings Support to the iteration_proxy_value class |
4596 | | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ |
4597 | | // And see https://github.com/nlohmann/json/pull/1391 |
4598 | | namespace std |
4599 | | { |
4600 | | #if defined(__clang__) |
4601 | | // Fix: https://github.com/nlohmann/json/issues/1401 |
4602 | | #pragma clang diagnostic push |
4603 | | #pragma clang diagnostic ignored "-Wmismatched-tags" |
4604 | | #endif |
4605 | | template<typename IteratorType> |
4606 | | class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> |
4607 | | : public std::integral_constant<std::size_t, 2> {}; |
4608 | | |
4609 | | template<std::size_t N, typename IteratorType> |
4610 | | class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> |
4611 | | { |
4612 | | public: |
4613 | | using type = decltype( |
4614 | | get<N>(std::declval < |
4615 | | ::nlohmann::detail::iteration_proxy_value<IteratorType >> ())); |
4616 | | }; |
4617 | | #if defined(__clang__) |
4618 | | #pragma clang diagnostic pop |
4619 | | #endif |
4620 | | } // namespace std |
4621 | | |
4622 | | // #include <nlohmann/detail/meta/cpp_future.hpp> |
4623 | | |
4624 | | // #include <nlohmann/detail/meta/type_traits.hpp> |
4625 | | |
4626 | | // #include <nlohmann/detail/value_t.hpp> |
4627 | | |
4628 | | |
4629 | | #ifdef JSON_HAS_CPP_17 |
4630 | | #include <filesystem> |
4631 | | #endif |
4632 | | |
4633 | | namespace nlohmann |
4634 | | { |
4635 | | namespace detail |
4636 | | { |
4637 | | ////////////////// |
4638 | | // constructors // |
4639 | | ////////////////// |
4640 | | |
4641 | | /* |
4642 | | * Note all external_constructor<>::construct functions need to call |
4643 | | * j.m_value.destroy(j.m_type) to avoid a memory leak in case j contains an |
4644 | | * allocated value (e.g., a string). See bug issue |
4645 | | * https://github.com/nlohmann/json/issues/2865 for more information. |
4646 | | */ |
4647 | | |
4648 | | template<value_t> struct external_constructor; |
4649 | | |
4650 | | template<> |
4651 | | struct external_constructor<value_t::boolean> |
4652 | | { |
4653 | | template<typename BasicJsonType> |
4654 | | static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept |
4655 | 29.9k | { |
4656 | 29.9k | j.m_value.destroy(j.m_type); |
4657 | 29.9k | j.m_type = value_t::boolean; |
4658 | 29.9k | j.m_value = b; |
4659 | 29.9k | j.assert_invariant(); |
4660 | 29.9k | } |
4661 | | }; |
4662 | | |
4663 | | template<> |
4664 | | struct external_constructor<value_t::string> |
4665 | | { |
4666 | | template<typename BasicJsonType> |
4667 | | static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s) |
4668 | 112k | { |
4669 | 112k | j.m_value.destroy(j.m_type); |
4670 | 112k | j.m_type = value_t::string; |
4671 | 112k | j.m_value = s; |
4672 | 112k | j.assert_invariant(); |
4673 | 112k | } |
4674 | | |
4675 | | template<typename BasicJsonType> |
4676 | | static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s) |
4677 | | { |
4678 | | j.m_value.destroy(j.m_type); |
4679 | | j.m_type = value_t::string; |
4680 | | j.m_value = std::move(s); |
4681 | | j.assert_invariant(); |
4682 | | } |
4683 | | |
4684 | | template < typename BasicJsonType, typename CompatibleStringType, |
4685 | | enable_if_t < !std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value, |
4686 | | int > = 0 > |
4687 | | static void construct(BasicJsonType& j, const CompatibleStringType& str) |
4688 | 0 | { |
4689 | 0 | j.m_value.destroy(j.m_type); |
4690 | 0 | j.m_type = value_t::string; |
4691 | 0 | j.m_value.string = j.template create<typename BasicJsonType::string_t>(str); |
4692 | 0 | j.assert_invariant(); |
4693 | 0 | } |
4694 | | }; |
4695 | | |
4696 | | template<> |
4697 | | struct external_constructor<value_t::binary> |
4698 | | { |
4699 | | template<typename BasicJsonType> |
4700 | | static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b) |
4701 | | { |
4702 | | j.m_value.destroy(j.m_type); |
4703 | | j.m_type = value_t::binary; |
4704 | | j.m_value = typename BasicJsonType::binary_t(b); |
4705 | | j.assert_invariant(); |
4706 | | } |
4707 | | |
4708 | | template<typename BasicJsonType> |
4709 | | static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b) |
4710 | | { |
4711 | | j.m_value.destroy(j.m_type); |
4712 | | j.m_type = value_t::binary; |
4713 | | j.m_value = typename BasicJsonType::binary_t(std::move(b)); |
4714 | | j.assert_invariant(); |
4715 | | } |
4716 | | }; |
4717 | | |
4718 | | template<> |
4719 | | struct external_constructor<value_t::number_float> |
4720 | | { |
4721 | | template<typename BasicJsonType> |
4722 | | static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept |
4723 | 33.6k | { |
4724 | 33.6k | j.m_value.destroy(j.m_type); |
4725 | 33.6k | j.m_type = value_t::number_float; |
4726 | 33.6k | j.m_value = val; |
4727 | 33.6k | j.assert_invariant(); |
4728 | 33.6k | } |
4729 | | }; |
4730 | | |
4731 | | template<> |
4732 | | struct external_constructor<value_t::number_unsigned> |
4733 | | { |
4734 | | template<typename BasicJsonType> |
4735 | | static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept |
4736 | 6.20M | { |
4737 | 6.20M | j.m_value.destroy(j.m_type); |
4738 | 6.20M | j.m_type = value_t::number_unsigned; |
4739 | 6.20M | j.m_value = val; |
4740 | 6.20M | j.assert_invariant(); |
4741 | 6.20M | } |
4742 | | }; |
4743 | | |
4744 | | template<> |
4745 | | struct external_constructor<value_t::number_integer> |
4746 | | { |
4747 | | template<typename BasicJsonType> |
4748 | | static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept |
4749 | 22.8k | { |
4750 | 22.8k | j.m_value.destroy(j.m_type); |
4751 | 22.8k | j.m_type = value_t::number_integer; |
4752 | 22.8k | j.m_value = val; |
4753 | 22.8k | j.assert_invariant(); |
4754 | 22.8k | } |
4755 | | }; |
4756 | | |
4757 | | template<> |
4758 | | struct external_constructor<value_t::array> |
4759 | | { |
4760 | | template<typename BasicJsonType> |
4761 | | static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr) |
4762 | | { |
4763 | | j.m_value.destroy(j.m_type); |
4764 | | j.m_type = value_t::array; |
4765 | | j.m_value = arr; |
4766 | | j.set_parents(); |
4767 | | j.assert_invariant(); |
4768 | | } |
4769 | | |
4770 | | template<typename BasicJsonType> |
4771 | | static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr) |
4772 | | { |
4773 | | j.m_value.destroy(j.m_type); |
4774 | | j.m_type = value_t::array; |
4775 | | j.m_value = std::move(arr); |
4776 | | j.set_parents(); |
4777 | | j.assert_invariant(); |
4778 | | } |
4779 | | |
4780 | | template < typename BasicJsonType, typename CompatibleArrayType, |
4781 | | enable_if_t < !std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value, |
4782 | | int > = 0 > |
4783 | | static void construct(BasicJsonType& j, const CompatibleArrayType& arr) |
4784 | | { |
4785 | | using std::begin; |
4786 | | using std::end; |
4787 | | |
4788 | | j.m_value.destroy(j.m_type); |
4789 | | j.m_type = value_t::array; |
4790 | | j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr)); |
4791 | | j.set_parents(); |
4792 | | j.assert_invariant(); |
4793 | | } |
4794 | | |
4795 | | template<typename BasicJsonType> |
4796 | | static void construct(BasicJsonType& j, const std::vector<bool>& arr) |
4797 | | { |
4798 | | j.m_value.destroy(j.m_type); |
4799 | | j.m_type = value_t::array; |
4800 | | j.m_value = value_t::array; |
4801 | | j.m_value.array->reserve(arr.size()); |
4802 | | for (const bool x : arr) |
4803 | | { |
4804 | | j.m_value.array->push_back(x); |
4805 | | j.set_parent(j.m_value.array->back()); |
4806 | | } |
4807 | | j.assert_invariant(); |
4808 | | } |
4809 | | |
4810 | | template<typename BasicJsonType, typename T, |
4811 | | enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0> |
4812 | | static void construct(BasicJsonType& j, const std::valarray<T>& arr) |
4813 | | { |
4814 | | j.m_value.destroy(j.m_type); |
4815 | | j.m_type = value_t::array; |
4816 | | j.m_value = value_t::array; |
4817 | | j.m_value.array->resize(arr.size()); |
4818 | | if (arr.size() > 0) |
4819 | | { |
4820 | | std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin()); |
4821 | | } |
4822 | | j.set_parents(); |
4823 | | j.assert_invariant(); |
4824 | | } |
4825 | | }; |
4826 | | |
4827 | | template<> |
4828 | | struct external_constructor<value_t::object> |
4829 | | { |
4830 | | template<typename BasicJsonType> |
4831 | | static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj) |
4832 | | { |
4833 | | j.m_value.destroy(j.m_type); |
4834 | | j.m_type = value_t::object; |
4835 | | j.m_value = obj; |
4836 | | j.set_parents(); |
4837 | | j.assert_invariant(); |
4838 | | } |
4839 | | |
4840 | | template<typename BasicJsonType> |
4841 | | static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj) |
4842 | | { |
4843 | | j.m_value.destroy(j.m_type); |
4844 | | j.m_type = value_t::object; |
4845 | | j.m_value = std::move(obj); |
4846 | | j.set_parents(); |
4847 | | j.assert_invariant(); |
4848 | | } |
4849 | | |
4850 | | template < typename BasicJsonType, typename CompatibleObjectType, |
4851 | | enable_if_t < !std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int > = 0 > |
4852 | | static void construct(BasicJsonType& j, const CompatibleObjectType& obj) |
4853 | | { |
4854 | | using std::begin; |
4855 | | using std::end; |
4856 | | |
4857 | | j.m_value.destroy(j.m_type); |
4858 | | j.m_type = value_t::object; |
4859 | | j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj)); |
4860 | | j.set_parents(); |
4861 | | j.assert_invariant(); |
4862 | | } |
4863 | | }; |
4864 | | |
4865 | | ///////////// |
4866 | | // to_json // |
4867 | | ///////////// |
4868 | | |
4869 | | template<typename BasicJsonType, typename T, |
4870 | | enable_if_t<std::is_same<T, typename BasicJsonType::boolean_t>::value, int> = 0> |
4871 | | void to_json(BasicJsonType& j, T b) noexcept |
4872 | 29.9k | { |
4873 | 29.9k | external_constructor<value_t::boolean>::construct(j, b); |
4874 | 29.9k | } |
4875 | | |
4876 | | template<typename BasicJsonType, typename CompatibleString, |
4877 | | enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0> |
4878 | | void to_json(BasicJsonType& j, const CompatibleString& s) |
4879 | 112k | { |
4880 | 112k | external_constructor<value_t::string>::construct(j, s); |
4881 | 112k | } void nlohmann::detail::to_json<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 4879 | 112k | { | 4880 | 112k | external_constructor<value_t::string>::construct(j, s); | 4881 | 112k | } |
Unexecuted instantiation: void nlohmann::detail::to_json<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, char const*, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >&, char const* const&) |
4882 | | |
4883 | | template<typename BasicJsonType> |
4884 | | void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s) |
4885 | | { |
4886 | | external_constructor<value_t::string>::construct(j, std::move(s)); |
4887 | | } |
4888 | | |
4889 | | template<typename BasicJsonType, typename FloatType, |
4890 | | enable_if_t<std::is_floating_point<FloatType>::value, int> = 0> |
4891 | | void to_json(BasicJsonType& j, FloatType val) noexcept |
4892 | 33.6k | { |
4893 | 33.6k | external_constructor<value_t::number_float>::construct(j, static_cast<typename BasicJsonType::number_float_t>(val)); |
4894 | 33.6k | } |
4895 | | |
4896 | | template<typename BasicJsonType, typename CompatibleNumberUnsignedType, |
4897 | | enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value, int> = 0> |
4898 | | void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept |
4899 | 6.20M | { |
4900 | 6.20M | external_constructor<value_t::number_unsigned>::construct(j, static_cast<typename BasicJsonType::number_unsigned_t>(val)); |
4901 | 6.20M | } |
4902 | | |
4903 | | template<typename BasicJsonType, typename CompatibleNumberIntegerType, |
4904 | | enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value, int> = 0> |
4905 | | void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept |
4906 | 22.8k | { |
4907 | 22.8k | external_constructor<value_t::number_integer>::construct(j, static_cast<typename BasicJsonType::number_integer_t>(val)); |
4908 | 22.8k | } Unexecuted instantiation: void nlohmann::detail::to_json<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, int, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >&, int) void nlohmann::detail::to_json<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, long, 0>(nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long, unsigned long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >&, long) Line | Count | Source | 4906 | 22.8k | { | 4907 | 22.8k | external_constructor<value_t::number_integer>::construct(j, static_cast<typename BasicJsonType::number_integer_t>(val)); | 4908 | 22.8k | } |
|
4909 | | |
4910 | | template<typename BasicJsonType, typename EnumType, |
4911 | | enable_if_t<std::is_enum<EnumType>::value, int> = 0> |
4912 | | void to_json(BasicJsonType& j, EnumType e) noexcept |
4913 | | { |
4914 | | using underlying_type = typename std::underlying_type<EnumType>::type; |
4915 | | external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e)); |
4916 | | } |
4917 | | |
4918 | | template<typename BasicJsonType> |
4919 | | void to_json(BasicJsonType& j, const std::vector<bool>& e) |
4920 | | { |
4921 | | external_constructor<value_t::array>::construct(j, e); |
4922 | | } |
4923 | | |
4924 | | template < typename BasicJsonType, typename CompatibleArrayType, |
4925 | | enable_if_t < is_compatible_array_type<BasicJsonType, |
4926 | | CompatibleArrayType>::value&& |
4927 | | !is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value&& |
4928 | | !is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value&& |
4929 | | !std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value&& |
4930 | | !is_basic_json<CompatibleArrayType>::value, |
4931 | | int > = 0 > |
4932 | | void to_json(BasicJsonType& j, const CompatibleArrayType& arr) |
4933 | | { |
4934 | | external_constructor<value_t::array>::construct(j, arr); |
4935 | | } |
4936 | | |
4937 | | template<typename BasicJsonType> |
4938 | | void to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin) |
4939 | | { |
4940 | | external_constructor<value_t::binary>::construct(j, bin); |
4941 | | } |
4942 | | |
4943 | | template<typename BasicJsonType, typename T, |
4944 | | enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0> |
4945 | | void to_json(BasicJsonType& j, const std::valarray<T>& arr) |
4946 | | { |
4947 | | external_constructor<value_t::array>::construct(j, std::move(arr)); |
4948 | | } |
4949 | | |
4950 | | template<typename BasicJsonType> |
4951 | | void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr) |
4952 | | { |
4953 | | external_constructor<value_t::array>::construct(j, std::move(arr)); |
4954 | | } |
4955 | | |
4956 | | template < typename BasicJsonType, typename CompatibleObjectType, |
4957 | | enable_if_t < is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value&& !is_basic_json<CompatibleObjectType>::value, int > = 0 > |
4958 | | void to_json(BasicJsonType& j, const CompatibleObjectType& obj) |
4959 | | { |
4960 | | external_constructor<value_t::object>::construct(j, obj); |
4961 | | } |
4962 | | |
4963 | | template<typename BasicJsonType> |
4964 | | void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj) |
4965 | | { |
4966 | | external_constructor<value_t::object>::construct(j, std::move(obj)); |
4967 | | } |
4968 | | |
4969 | | template < |
4970 | | typename BasicJsonType, typename T, std::size_t N, |
4971 | | enable_if_t < !std::is_constructible<typename BasicJsonType::string_t, |
4972 | | const T(&)[N]>::value, // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) |
4973 | | int > = 0 > |
4974 | | void to_json(BasicJsonType& j, const T(&arr)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) |
4975 | | { |
4976 | | external_constructor<value_t::array>::construct(j, arr); |
4977 | | } |
4978 | | |
4979 | | template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 > |
4980 | | void to_json(BasicJsonType& j, const std::pair<T1, T2>& p) |
4981 | | { |
4982 | | j = { p.first, p.second }; |
4983 | | } |
4984 | | |
4985 | | // for https://github.com/nlohmann/json/pull/1134 |
4986 | | template<typename BasicJsonType, typename T, |
4987 | | enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0> |
4988 | | void to_json(BasicJsonType& j, const T& b) |
4989 | | { |
4990 | | j = { {b.key(), b.value()} }; |
4991 | | } |
4992 | | |
4993 | | template<typename BasicJsonType, typename Tuple, std::size_t... Idx> |
4994 | | void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence<Idx...> /*unused*/) |
4995 | | { |
4996 | | j = { std::get<Idx>(t)... }; |
4997 | | } |
4998 | | |
4999 | | template<typename BasicJsonType, typename T, enable_if_t<is_constructible_tuple<BasicJsonType, T>::value, int > = 0> |
5000 | | void to_json(BasicJsonType& j, const T& t) |
5001 | | { |
5002 | | to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {}); |
5003 | | } |
5004 | | |
5005 | | #ifdef JSON_HAS_CPP_17 |
5006 | | template<typename BasicJsonType> |
5007 | | void to_json(BasicJsonType& j, const std::filesystem::path& p) |
5008 | | { |
5009 | | j = p.string(); |
5010 | | } |
5011 | | #endif |
5012 | | |
5013 | | struct to_json_fn |
5014 | | { |
5015 | | template<typename BasicJsonType, typename T> |
5016 | | auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward<T>(val)))) |
5017 | | -> decltype(to_json(j, std::forward<T>(val)), void()) |
5018 | 6.40M | { |
5019 | 6.40M | return to_json(j, std::forward<T>(val)); |
5020 | 6.40M | } _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERmEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ Line | Count | Source | 5018 | 6.20M | { | 5019 | 6.20M | return to_json(j, std::forward<T>(val)); | 5020 | 6.20M | } |
Unexecuted instantiation: _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERKdEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ Unexecuted instantiation: _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERKiEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ Unexecuted instantiation: _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERKbEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ Unexecuted instantiation: _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERKSC_EEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERdEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ Line | Count | Source | 5018 | 33.6k | { | 5019 | 33.6k | return to_json(j, std::forward<T>(val)); | 5020 | 33.6k | } |
Unexecuted instantiation: _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERiEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERbEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ Line | Count | Source | 5018 | 29.9k | { | 5019 | 29.9k | return to_json(j, std::forward<T>(val)); | 5020 | 29.9k | } |
_ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERSC_EEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ Line | Count | Source | 5018 | 112k | { | 5019 | 112k | return to_json(j, std::forward<T>(val)); | 5020 | 112k | } |
_ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERlEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ Line | Count | Source | 5018 | 22.8k | { | 5019 | 22.8k | return to_json(j, std::forward<T>(val)); | 5020 | 22.8k | } |
Unexecuted instantiation: _ZNK8nlohmann6detail10to_json_fnclINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_NS_14adl_serializerENS6_IhNSA_IhEEEEEERPKcEEDTcmcl7to_jsonfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSK_ |
5021 | | }; |
5022 | | } // namespace detail |
5023 | | |
5024 | | /// namespace to hold default `to_json` function |
5025 | | /// to see why this is required: |
5026 | | /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html |
5027 | | namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces) |
5028 | | { |
5029 | | constexpr const auto& to_json = detail::static_const<detail::to_json_fn>::value; // NOLINT(misc-definitions-in-headers) |
5030 | | } // namespace |
5031 | | } // namespace nlohmann |
5032 | | |
5033 | | // #include <nlohmann/detail/meta/identity_tag.hpp> |
5034 | | |
5035 | | // #include <nlohmann/detail/meta/type_traits.hpp> |
5036 | | |
5037 | | |
5038 | | namespace nlohmann |
5039 | | { |
5040 | | |
5041 | | template<typename ValueType, typename> |
5042 | | struct adl_serializer |
5043 | | { |
5044 | | /*! |
5045 | | @brief convert a JSON value to any value type |
5046 | | |
5047 | | This function is usually called by the `get()` function of the |
5048 | | @ref basic_json class (either explicit or via conversion operators). |
5049 | | |
5050 | | @note This function is chosen for default-constructible value types. |
5051 | | |
5052 | | @param[in] j JSON value to read from |
5053 | | @param[in,out] val value to write to |
5054 | | */ |
5055 | | template<typename BasicJsonType, typename TargetType = ValueType> |
5056 | | static auto from_json(BasicJsonType && j, TargetType& val) noexcept( |
5057 | | noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val))) |
5058 | | -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void()) |
5059 | 2.94M | { |
5060 | 2.94M | ::nlohmann::from_json(std::forward<BasicJsonType>(j), val); |
5061 | 2.94M | } _ZN8nlohmann14adl_serializerIbvE9from_jsonIRKNS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEEbEEDTcmclL_ZNS_12_GLOBAL__N_19from_jsonEEclsr3stdE7forwardIT_Efp_Efp0_Ecvv_EEOSJ_RT0_ Line | Count | Source | 5059 | 568 | { | 5060 | 568 | ::nlohmann::from_json(std::forward<BasicJsonType>(j), val); | 5061 | 568 | } |
_ZN8nlohmann14adl_serializerIlvE9from_jsonIRKNS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEElEEDTcmclL_ZNS_12_GLOBAL__N_19from_jsonEEclsr3stdE7forwardIT_Efp_Efp0_Ecvv_EEOSJ_RT0_ Line | Count | Source | 5059 | 1.15M | { | 5060 | 1.15M | ::nlohmann::from_json(std::forward<BasicJsonType>(j), val); | 5061 | 1.15M | } |
_ZN8nlohmann14adl_serializerIdvE9from_jsonIRKNS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEEdEEDTcmclL_ZNS_12_GLOBAL__N_19from_jsonEEclsr3stdE7forwardIT_Efp_Efp0_Ecvv_EEOSJ_RT0_ Line | Count | Source | 5059 | 1.70M | { | 5060 | 1.70M | ::nlohmann::from_json(std::forward<BasicJsonType>(j), val); | 5061 | 1.70M | } |
_ZN8nlohmann14adl_serializerINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEvE9from_jsonIRKNS_10basic_jsonINS1_3mapENS1_6vectorES7_blmdS5_S0_NSC_IhNS5_IhEEEEEES7_EEDTcmclL_ZNS_12_GLOBAL__N_19from_jsonEEclsr3stdE7forwardIT_Efp_Efp0_Ecvv_EEOSJ_RT0_ Line | Count | Source | 5059 | 87.2k | { | 5060 | 87.2k | ::nlohmann::from_json(std::forward<BasicJsonType>(j), val); | 5061 | 87.2k | } |
Unexecuted instantiation: _ZN8nlohmann14adl_serializerImvE9from_jsonIRKNS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEEmEEDTcmclL_ZNS_12_GLOBAL__N_19from_jsonEEclsr3stdE7forwardIT_Efp_Efp0_Ecvv_EEOSJ_RT0_ |
5062 | | |
5063 | | /*! |
5064 | | @brief convert a JSON value to any value type |
5065 | | |
5066 | | This function is usually called by the `get()` function of the |
5067 | | @ref basic_json class (either explicit or via conversion operators). |
5068 | | |
5069 | | @note This function is chosen for value types which are not default-constructible. |
5070 | | |
5071 | | @param[in] j JSON value to read from |
5072 | | |
5073 | | @return copy of the JSON value, converted to @a ValueType |
5074 | | */ |
5075 | | template<typename BasicJsonType, typename TargetType = ValueType> |
5076 | | static auto from_json(BasicJsonType && j) noexcept( |
5077 | | noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))) |
5078 | | -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})) |
5079 | | { |
5080 | | return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}); |
5081 | | } |
5082 | | |
5083 | | /*! |
5084 | | @brief convert any value type to a JSON value |
5085 | | |
5086 | | This function is usually called by the constructors of the @ref basic_json |
5087 | | class. |
5088 | | |
5089 | | @param[in,out] j JSON value to write to |
5090 | | @param[in] val value to read from |
5091 | | */ |
5092 | | template<typename BasicJsonType, typename TargetType = ValueType> |
5093 | | static auto to_json(BasicJsonType& j, TargetType && val) noexcept( |
5094 | | noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val)))) |
5095 | | -> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void()) |
5096 | 6.40M | { |
5097 | 6.40M | ::nlohmann::to_json(j, std::forward<TargetType>(val)); |
5098 | 6.40M | } _ZN8nlohmann14adl_serializerImvE7to_jsonINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEERmEEDTcmclL_ZNS_12_GLOBAL__N_17to_jsonEEfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSI_ Line | Count | Source | 5096 | 6.20M | { | 5097 | 6.20M | ::nlohmann::to_json(j, std::forward<TargetType>(val)); | 5098 | 6.20M | } |
Unexecuted instantiation: _ZN8nlohmann14adl_serializerIdvE7to_jsonINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEERKdEEDTcmclL_ZNS_12_GLOBAL__N_17to_jsonEEfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ Unexecuted instantiation: _ZN8nlohmann14adl_serializerIivE7to_jsonINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEERKiEEDTcmclL_ZNS_12_GLOBAL__N_17to_jsonEEfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ Unexecuted instantiation: _ZN8nlohmann14adl_serializerIbvE7to_jsonINS_10basic_jsonINSt3__13mapENS4_6vectorENS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEblmdSA_S0_NS6_IhNSA_IhEEEEEERKbEEDTcmclL_ZNS_12_GLOBAL__N_17to_jsonEEfp_clsr3stdE7forwardIT0_Efp0_EEcvv_EERT_OSJ_ Unexecuted instantiation: _ZN8nlohmann14adl_serializerINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEvE7to_jsonINS_10basic_jsonINS1_3mapENS1_6vectorES7_bl
|