mqt-core 3.0.2__cp310-cp310-win_amd64.whl → 3.1.0__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mqt-core might be problematic. Click here for more details.

Files changed (105) hide show
  1. mqt/core/__init__.py +3 -3
  2. mqt/core/_version.py +2 -2
  3. mqt/core/bin/mqt-core-algorithms.dll +0 -0
  4. mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
  5. mqt/core/bin/mqt-core-dd.dll +0 -0
  6. mqt/core/bin/mqt-core-ds.dll +0 -0
  7. mqt/core/bin/mqt-core-ir.dll +0 -0
  8. mqt/core/bin/mqt-core-na.dll +0 -0
  9. mqt/core/bin/mqt-core-qasm.dll +0 -0
  10. mqt/core/bin/mqt-core-zx.dll +0 -0
  11. mqt/core/dd.cp310-win_amd64.pyd +0 -0
  12. mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
  13. mqt/core/include/mqt-core/dd/Complex.hpp +6 -0
  14. mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +0 -18
  15. mqt/core/include/mqt-core/dd/ComputeTable.hpp +4 -1
  16. mqt/core/include/mqt-core/dd/DDDefinitions.hpp +0 -7
  17. mqt/core/include/mqt-core/dd/Edge.hpp +16 -0
  18. mqt/core/include/mqt-core/dd/Export.hpp +1 -2
  19. mqt/core/include/mqt-core/dd/Node.hpp +26 -49
  20. mqt/core/include/mqt-core/dd/Operations.hpp +27 -0
  21. mqt/core/include/mqt-core/dd/Package.hpp +138 -120
  22. mqt/core/include/mqt-core/dd/RealNumber.hpp +49 -66
  23. mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +14 -25
  24. mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
  25. mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +6 -4
  26. mqt/core/include/mqt-core/dd/UniqueTable.hpp +13 -39
  27. mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +8 -7
  28. mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +0 -10
  29. mqt/core/include/mqt-core/ir/QuantumComputation.hpp +3 -0
  30. mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +2 -0
  31. mqt/core/include/mqt-core/ir/operations/Operation.hpp +2 -2
  32. mqt/core/ir.cp310-win_amd64.pyd +0 -0
  33. mqt/core/lib/mqt-core-algorithms.lib +0 -0
  34. mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
  35. mqt/core/lib/mqt-core-dd.lib +0 -0
  36. mqt/core/lib/mqt-core-ds.lib +0 -0
  37. mqt/core/lib/mqt-core-ir.lib +0 -0
  38. mqt/core/lib/mqt-core-na.lib +0 -0
  39. mqt/core/lib/mqt-core-qasm.lib +0 -0
  40. mqt/core/lib/mqt-core-zx.lib +0 -0
  41. mqt/core/plugins/__init__.py +0 -8
  42. mqt/core/plugins/qiskit/qiskit_to_mqt.py +6 -0
  43. mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +52 -0
  44. mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +4 -4
  45. mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +3 -3
  46. mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +1 -0
  47. mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +1 -1
  48. mqt_core-3.1.0.dist-info/DELVEWHEEL +2 -0
  49. {mqt_core-3.0.2.dist-info → mqt_core-3.1.0.dist-info}/METADATA +46 -21
  50. {mqt_core-3.0.2.dist-info → mqt_core-3.1.0.dist-info}/RECORD +54 -101
  51. {mqt_core-3.0.2.dist-info → mqt_core-3.1.0.dist-info}/WHEEL +1 -1
  52. mqt_core.libs/msvcp140.dll +0 -0
  53. mqt/core/include/nlohmann/adl_serializer.hpp +0 -55
  54. mqt/core/include/nlohmann/byte_container_with_subtype.hpp +0 -103
  55. mqt/core/include/nlohmann/detail/abi_macros.hpp +0 -100
  56. mqt/core/include/nlohmann/detail/conversions/from_json.hpp +0 -497
  57. mqt/core/include/nlohmann/detail/conversions/to_chars.hpp +0 -1118
  58. mqt/core/include/nlohmann/detail/conversions/to_json.hpp +0 -446
  59. mqt/core/include/nlohmann/detail/exceptions.hpp +0 -257
  60. mqt/core/include/nlohmann/detail/hash.hpp +0 -129
  61. mqt/core/include/nlohmann/detail/input/binary_reader.hpp +0 -3009
  62. mqt/core/include/nlohmann/detail/input/input_adapters.hpp +0 -492
  63. mqt/core/include/nlohmann/detail/input/json_sax.hpp +0 -727
  64. mqt/core/include/nlohmann/detail/input/lexer.hpp +0 -1633
  65. mqt/core/include/nlohmann/detail/input/parser.hpp +0 -519
  66. mqt/core/include/nlohmann/detail/input/position_t.hpp +0 -37
  67. mqt/core/include/nlohmann/detail/iterators/internal_iterator.hpp +0 -35
  68. mqt/core/include/nlohmann/detail/iterators/iter_impl.hpp +0 -751
  69. mqt/core/include/nlohmann/detail/iterators/iteration_proxy.hpp +0 -242
  70. mqt/core/include/nlohmann/detail/iterators/iterator_traits.hpp +0 -61
  71. mqt/core/include/nlohmann/detail/iterators/json_reverse_iterator.hpp +0 -130
  72. mqt/core/include/nlohmann/detail/iterators/primitive_iterator.hpp +0 -132
  73. mqt/core/include/nlohmann/detail/json_custom_base_class.hpp +0 -39
  74. mqt/core/include/nlohmann/detail/json_pointer.hpp +0 -988
  75. mqt/core/include/nlohmann/detail/json_ref.hpp +0 -78
  76. mqt/core/include/nlohmann/detail/macro_scope.hpp +0 -482
  77. mqt/core/include/nlohmann/detail/macro_unscope.hpp +0 -45
  78. mqt/core/include/nlohmann/detail/meta/call_std/begin.hpp +0 -17
  79. mqt/core/include/nlohmann/detail/meta/call_std/end.hpp +0 -17
  80. mqt/core/include/nlohmann/detail/meta/cpp_future.hpp +0 -171
  81. mqt/core/include/nlohmann/detail/meta/detected.hpp +0 -70
  82. mqt/core/include/nlohmann/detail/meta/identity_tag.hpp +0 -21
  83. mqt/core/include/nlohmann/detail/meta/is_sax.hpp +0 -159
  84. mqt/core/include/nlohmann/detail/meta/std_fs.hpp +0 -29
  85. mqt/core/include/nlohmann/detail/meta/type_traits.hpp +0 -795
  86. mqt/core/include/nlohmann/detail/meta/void_t.hpp +0 -24
  87. mqt/core/include/nlohmann/detail/output/binary_writer.hpp +0 -1838
  88. mqt/core/include/nlohmann/detail/output/output_adapters.hpp +0 -147
  89. mqt/core/include/nlohmann/detail/output/serializer.hpp +0 -988
  90. mqt/core/include/nlohmann/detail/string_concat.hpp +0 -146
  91. mqt/core/include/nlohmann/detail/string_escape.hpp +0 -72
  92. mqt/core/include/nlohmann/detail/value_t.hpp +0 -118
  93. mqt/core/include/nlohmann/json.hpp +0 -5258
  94. mqt/core/include/nlohmann/json_fwd.hpp +0 -75
  95. mqt/core/include/nlohmann/ordered_map.hpp +0 -359
  96. mqt/core/include/nlohmann/thirdparty/hedley/hedley.hpp +0 -2045
  97. mqt/core/include/nlohmann/thirdparty/hedley/hedley_undef.hpp +0 -158
  98. mqt/core/nlohmann_json.natvis +0 -278
  99. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake +0 -15
  100. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonConfigVersion.cmake +0 -20
  101. mqt/core/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake +0 -110
  102. mqt/core/share/pkgconfig/nlohmann_json.pc +0 -4
  103. mqt_core-3.0.2.dist-info/DELVEWHEEL +0 -2
  104. {mqt_core-3.0.2.dist-info → mqt_core-3.1.0.dist-info}/entry_points.txt +0 -0
  105. {mqt_core-3.0.2.dist-info → mqt_core-3.1.0.dist-info}/licenses/LICENSE.md +0 -0
@@ -1,446 +0,0 @@
1
- // __ _____ _____ _____
2
- // __| | __| | | | JSON for Modern C++
3
- // | | |__ | | | | | | version 3.11.3
4
- // |_____|_____|_____|_|___| https://github.com/nlohmann/json
5
- //
6
- // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
7
- // SPDX-License-Identifier: MIT
8
-
9
- #pragma once
10
-
11
- #include <algorithm> // copy
12
- #include <iterator> // begin, end
13
- #include <string> // string
14
- #include <tuple> // tuple, get
15
- #include <type_traits> // is_same, is_constructible, is_floating_point, is_enum, underlying_type
16
- #include <utility> // move, forward, declval, pair
17
- #include <valarray> // valarray
18
- #include <vector> // vector
19
-
20
- #include <nlohmann/detail/iterators/iteration_proxy.hpp>
21
- #include <nlohmann/detail/macro_scope.hpp>
22
- #include <nlohmann/detail/meta/cpp_future.hpp>
23
- #include <nlohmann/detail/meta/std_fs.hpp>
24
- #include <nlohmann/detail/meta/type_traits.hpp>
25
- #include <nlohmann/detail/value_t.hpp>
26
-
27
- NLOHMANN_JSON_NAMESPACE_BEGIN
28
- namespace detail
29
- {
30
-
31
- //////////////////
32
- // constructors //
33
- //////////////////
34
-
35
- /*
36
- * Note all external_constructor<>::construct functions need to call
37
- * j.m_data.m_value.destroy(j.m_data.m_type) to avoid a memory leak in case j contains an
38
- * allocated value (e.g., a string). See bug issue
39
- * https://github.com/nlohmann/json/issues/2865 for more information.
40
- */
41
-
42
- template<value_t> struct external_constructor;
43
-
44
- template<>
45
- struct external_constructor<value_t::boolean>
46
- {
47
- template<typename BasicJsonType>
48
- static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept
49
- {
50
- j.m_data.m_value.destroy(j.m_data.m_type);
51
- j.m_data.m_type = value_t::boolean;
52
- j.m_data.m_value = b;
53
- j.assert_invariant();
54
- }
55
- };
56
-
57
- template<>
58
- struct external_constructor<value_t::string>
59
- {
60
- template<typename BasicJsonType>
61
- static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s)
62
- {
63
- j.m_data.m_value.destroy(j.m_data.m_type);
64
- j.m_data.m_type = value_t::string;
65
- j.m_data.m_value = s;
66
- j.assert_invariant();
67
- }
68
-
69
- template<typename BasicJsonType>
70
- static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s)
71
- {
72
- j.m_data.m_value.destroy(j.m_data.m_type);
73
- j.m_data.m_type = value_t::string;
74
- j.m_data.m_value = std::move(s);
75
- j.assert_invariant();
76
- }
77
-
78
- template < typename BasicJsonType, typename CompatibleStringType,
79
- enable_if_t < !std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,
80
- int > = 0 >
81
- static void construct(BasicJsonType& j, const CompatibleStringType& str)
82
- {
83
- j.m_data.m_value.destroy(j.m_data.m_type);
84
- j.m_data.m_type = value_t::string;
85
- j.m_data.m_value.string = j.template create<typename BasicJsonType::string_t>(str);
86
- j.assert_invariant();
87
- }
88
- };
89
-
90
- template<>
91
- struct external_constructor<value_t::binary>
92
- {
93
- template<typename BasicJsonType>
94
- static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b)
95
- {
96
- j.m_data.m_value.destroy(j.m_data.m_type);
97
- j.m_data.m_type = value_t::binary;
98
- j.m_data.m_value = typename BasicJsonType::binary_t(b);
99
- j.assert_invariant();
100
- }
101
-
102
- template<typename BasicJsonType>
103
- static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b)
104
- {
105
- j.m_data.m_value.destroy(j.m_data.m_type);
106
- j.m_data.m_type = value_t::binary;
107
- j.m_data.m_value = typename BasicJsonType::binary_t(std::move(b));
108
- j.assert_invariant();
109
- }
110
- };
111
-
112
- template<>
113
- struct external_constructor<value_t::number_float>
114
- {
115
- template<typename BasicJsonType>
116
- static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept
117
- {
118
- j.m_data.m_value.destroy(j.m_data.m_type);
119
- j.m_data.m_type = value_t::number_float;
120
- j.m_data.m_value = val;
121
- j.assert_invariant();
122
- }
123
- };
124
-
125
- template<>
126
- struct external_constructor<value_t::number_unsigned>
127
- {
128
- template<typename BasicJsonType>
129
- static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept
130
- {
131
- j.m_data.m_value.destroy(j.m_data.m_type);
132
- j.m_data.m_type = value_t::number_unsigned;
133
- j.m_data.m_value = val;
134
- j.assert_invariant();
135
- }
136
- };
137
-
138
- template<>
139
- struct external_constructor<value_t::number_integer>
140
- {
141
- template<typename BasicJsonType>
142
- static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept
143
- {
144
- j.m_data.m_value.destroy(j.m_data.m_type);
145
- j.m_data.m_type = value_t::number_integer;
146
- j.m_data.m_value = val;
147
- j.assert_invariant();
148
- }
149
- };
150
-
151
- template<>
152
- struct external_constructor<value_t::array>
153
- {
154
- template<typename BasicJsonType>
155
- static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr)
156
- {
157
- j.m_data.m_value.destroy(j.m_data.m_type);
158
- j.m_data.m_type = value_t::array;
159
- j.m_data.m_value = arr;
160
- j.set_parents();
161
- j.assert_invariant();
162
- }
163
-
164
- template<typename BasicJsonType>
165
- static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
166
- {
167
- j.m_data.m_value.destroy(j.m_data.m_type);
168
- j.m_data.m_type = value_t::array;
169
- j.m_data.m_value = std::move(arr);
170
- j.set_parents();
171
- j.assert_invariant();
172
- }
173
-
174
- template < typename BasicJsonType, typename CompatibleArrayType,
175
- enable_if_t < !std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,
176
- int > = 0 >
177
- static void construct(BasicJsonType& j, const CompatibleArrayType& arr)
178
- {
179
- using std::begin;
180
- using std::end;
181
-
182
- j.m_data.m_value.destroy(j.m_data.m_type);
183
- j.m_data.m_type = value_t::array;
184
- j.m_data.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
185
- j.set_parents();
186
- j.assert_invariant();
187
- }
188
-
189
- template<typename BasicJsonType>
190
- static void construct(BasicJsonType& j, const std::vector<bool>& arr)
191
- {
192
- j.m_data.m_value.destroy(j.m_data.m_type);
193
- j.m_data.m_type = value_t::array;
194
- j.m_data.m_value = value_t::array;
195
- j.m_data.m_value.array->reserve(arr.size());
196
- for (const bool x : arr)
197
- {
198
- j.m_data.m_value.array->push_back(x);
199
- j.set_parent(j.m_data.m_value.array->back());
200
- }
201
- j.assert_invariant();
202
- }
203
-
204
- template<typename BasicJsonType, typename T,
205
- enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>
206
- static void construct(BasicJsonType& j, const std::valarray<T>& arr)
207
- {
208
- j.m_data.m_value.destroy(j.m_data.m_type);
209
- j.m_data.m_type = value_t::array;
210
- j.m_data.m_value = value_t::array;
211
- j.m_data.m_value.array->resize(arr.size());
212
- if (arr.size() > 0)
213
- {
214
- std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin());
215
- }
216
- j.set_parents();
217
- j.assert_invariant();
218
- }
219
- };
220
-
221
- template<>
222
- struct external_constructor<value_t::object>
223
- {
224
- template<typename BasicJsonType>
225
- static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj)
226
- {
227
- j.m_data.m_value.destroy(j.m_data.m_type);
228
- j.m_data.m_type = value_t::object;
229
- j.m_data.m_value = obj;
230
- j.set_parents();
231
- j.assert_invariant();
232
- }
233
-
234
- template<typename BasicJsonType>
235
- static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
236
- {
237
- j.m_data.m_value.destroy(j.m_data.m_type);
238
- j.m_data.m_type = value_t::object;
239
- j.m_data.m_value = std::move(obj);
240
- j.set_parents();
241
- j.assert_invariant();
242
- }
243
-
244
- template < typename BasicJsonType, typename CompatibleObjectType,
245
- enable_if_t < !std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int > = 0 >
246
- static void construct(BasicJsonType& j, const CompatibleObjectType& obj)
247
- {
248
- using std::begin;
249
- using std::end;
250
-
251
- j.m_data.m_value.destroy(j.m_data.m_type);
252
- j.m_data.m_type = value_t::object;
253
- j.m_data.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
254
- j.set_parents();
255
- j.assert_invariant();
256
- }
257
- };
258
-
259
- /////////////
260
- // to_json //
261
- /////////////
262
-
263
- template<typename BasicJsonType, typename T,
264
- enable_if_t<std::is_same<T, typename BasicJsonType::boolean_t>::value, int> = 0>
265
- inline void to_json(BasicJsonType& j, T b) noexcept
266
- {
267
- external_constructor<value_t::boolean>::construct(j, b);
268
- }
269
-
270
- template < typename BasicJsonType, typename BoolRef,
271
- enable_if_t <
272
- ((std::is_same<std::vector<bool>::reference, BoolRef>::value
273
- && !std::is_same <std::vector<bool>::reference, typename BasicJsonType::boolean_t&>::value)
274
- || (std::is_same<std::vector<bool>::const_reference, BoolRef>::value
275
- && !std::is_same <detail::uncvref_t<std::vector<bool>::const_reference>,
276
- typename BasicJsonType::boolean_t >::value))
277
- && std::is_convertible<const BoolRef&, typename BasicJsonType::boolean_t>::value, int > = 0 >
278
- inline void to_json(BasicJsonType& j, const BoolRef& b) noexcept
279
- {
280
- external_constructor<value_t::boolean>::construct(j, static_cast<typename BasicJsonType::boolean_t>(b));
281
- }
282
-
283
- template<typename BasicJsonType, typename CompatibleString,
284
- enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0>
285
- inline void to_json(BasicJsonType& j, const CompatibleString& s)
286
- {
287
- external_constructor<value_t::string>::construct(j, s);
288
- }
289
-
290
- template<typename BasicJsonType>
291
- inline void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)
292
- {
293
- external_constructor<value_t::string>::construct(j, std::move(s));
294
- }
295
-
296
- template<typename BasicJsonType, typename FloatType,
297
- enable_if_t<std::is_floating_point<FloatType>::value, int> = 0>
298
- inline void to_json(BasicJsonType& j, FloatType val) noexcept
299
- {
300
- external_constructor<value_t::number_float>::construct(j, static_cast<typename BasicJsonType::number_float_t>(val));
301
- }
302
-
303
- template<typename BasicJsonType, typename CompatibleNumberUnsignedType,
304
- enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value, int> = 0>
305
- inline void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
306
- {
307
- external_constructor<value_t::number_unsigned>::construct(j, static_cast<typename BasicJsonType::number_unsigned_t>(val));
308
- }
309
-
310
- template<typename BasicJsonType, typename CompatibleNumberIntegerType,
311
- enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value, int> = 0>
312
- inline void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept
313
- {
314
- external_constructor<value_t::number_integer>::construct(j, static_cast<typename BasicJsonType::number_integer_t>(val));
315
- }
316
-
317
- #if !JSON_DISABLE_ENUM_SERIALIZATION
318
- template<typename BasicJsonType, typename EnumType,
319
- enable_if_t<std::is_enum<EnumType>::value, int> = 0>
320
- inline void to_json(BasicJsonType& j, EnumType e) noexcept
321
- {
322
- using underlying_type = typename std::underlying_type<EnumType>::type;
323
- external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
324
- }
325
- #endif // JSON_DISABLE_ENUM_SERIALIZATION
326
-
327
- template<typename BasicJsonType>
328
- inline void to_json(BasicJsonType& j, const std::vector<bool>& e)
329
- {
330
- external_constructor<value_t::array>::construct(j, e);
331
- }
332
-
333
- template < typename BasicJsonType, typename CompatibleArrayType,
334
- enable_if_t < is_compatible_array_type<BasicJsonType,
335
- CompatibleArrayType>::value&&
336
- !is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value&&
337
- !is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value&&
338
- !std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value&&
339
- !is_basic_json<CompatibleArrayType>::value,
340
- int > = 0 >
341
- inline void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
342
- {
343
- external_constructor<value_t::array>::construct(j, arr);
344
- }
345
-
346
- template<typename BasicJsonType>
347
- inline void to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin)
348
- {
349
- external_constructor<value_t::binary>::construct(j, bin);
350
- }
351
-
352
- template<typename BasicJsonType, typename T,
353
- enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>
354
- inline void to_json(BasicJsonType& j, const std::valarray<T>& arr)
355
- {
356
- external_constructor<value_t::array>::construct(j, std::move(arr));
357
- }
358
-
359
- template<typename BasicJsonType>
360
- inline void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
361
- {
362
- external_constructor<value_t::array>::construct(j, std::move(arr));
363
- }
364
-
365
- template < typename BasicJsonType, typename CompatibleObjectType,
366
- enable_if_t < is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value&& !is_basic_json<CompatibleObjectType>::value, int > = 0 >
367
- inline void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
368
- {
369
- external_constructor<value_t::object>::construct(j, obj);
370
- }
371
-
372
- template<typename BasicJsonType>
373
- inline void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
374
- {
375
- external_constructor<value_t::object>::construct(j, std::move(obj));
376
- }
377
-
378
- template <
379
- typename BasicJsonType, typename T, std::size_t N,
380
- enable_if_t < !std::is_constructible<typename BasicJsonType::string_t,
381
- const T(&)[N]>::value, // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
382
- int > = 0 >
383
- inline void to_json(BasicJsonType& j, const T(&arr)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
384
- {
385
- external_constructor<value_t::array>::construct(j, arr);
386
- }
387
-
388
- template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 >
389
- inline void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
390
- {
391
- j = { p.first, p.second };
392
- }
393
-
394
- // for https://github.com/nlohmann/json/pull/1134
395
- template<typename BasicJsonType, typename T,
396
- enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0>
397
- inline void to_json(BasicJsonType& j, const T& b)
398
- {
399
- j = { {b.key(), b.value()} };
400
- }
401
-
402
- template<typename BasicJsonType, typename Tuple, std::size_t... Idx>
403
- inline void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence<Idx...> /*unused*/)
404
- {
405
- j = { std::get<Idx>(t)... };
406
- }
407
-
408
- template<typename BasicJsonType, typename T, enable_if_t<is_constructible_tuple<BasicJsonType, T>::value, int > = 0>
409
- inline void to_json(BasicJsonType& j, const T& t)
410
- {
411
- to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});
412
- }
413
-
414
- #if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM
415
- template<typename BasicJsonType>
416
- inline void to_json(BasicJsonType& j, const std_fs::path& p)
417
- {
418
- j = p.string();
419
- }
420
- #endif
421
-
422
- struct to_json_fn
423
- {
424
- template<typename BasicJsonType, typename T>
425
- auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward<T>(val))))
426
- -> decltype(to_json(j, std::forward<T>(val)), void())
427
- {
428
- return to_json(j, std::forward<T>(val));
429
- }
430
- };
431
- } // namespace detail
432
-
433
- #ifndef JSON_HAS_CPP_17
434
- /// namespace to hold default `to_json` function
435
- /// to see why this is required:
436
- /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html
437
- namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces)
438
- {
439
- #endif
440
- JSON_INLINE_VARIABLE constexpr const auto& to_json = // NOLINT(misc-definitions-in-headers)
441
- detail::static_const<detail::to_json_fn>::value;
442
- #ifndef JSON_HAS_CPP_17
443
- } // namespace
444
- #endif
445
-
446
- NLOHMANN_JSON_NAMESPACE_END
@@ -1,257 +0,0 @@
1
- // __ _____ _____ _____
2
- // __| | __| | | | JSON for Modern C++
3
- // | | |__ | | | | | | version 3.11.3
4
- // |_____|_____|_____|_|___| https://github.com/nlohmann/json
5
- //
6
- // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
7
- // SPDX-License-Identifier: MIT
8
-
9
- #pragma once
10
-
11
- #include <cstddef> // nullptr_t
12
- #include <exception> // exception
13
- #if JSON_DIAGNOSTICS
14
- #include <numeric> // accumulate
15
- #endif
16
- #include <stdexcept> // runtime_error
17
- #include <string> // to_string
18
- #include <vector> // vector
19
-
20
- #include <nlohmann/detail/value_t.hpp>
21
- #include <nlohmann/detail/string_escape.hpp>
22
- #include <nlohmann/detail/input/position_t.hpp>
23
- #include <nlohmann/detail/macro_scope.hpp>
24
- #include <nlohmann/detail/meta/cpp_future.hpp>
25
- #include <nlohmann/detail/meta/type_traits.hpp>
26
- #include <nlohmann/detail/string_concat.hpp>
27
-
28
- NLOHMANN_JSON_NAMESPACE_BEGIN
29
- namespace detail
30
- {
31
-
32
- ////////////////
33
- // exceptions //
34
- ////////////////
35
-
36
- /// @brief general exception of the @ref basic_json class
37
- /// @sa https://json.nlohmann.me/api/basic_json/exception/
38
- class exception : public std::exception
39
- {
40
- public:
41
- /// returns the explanatory string
42
- const char* what() const noexcept override
43
- {
44
- return m.what();
45
- }
46
-
47
- /// the id of the exception
48
- const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes)
49
-
50
- protected:
51
- JSON_HEDLEY_NON_NULL(3)
52
- exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing)
53
-
54
- static std::string name(const std::string& ename, int id_)
55
- {
56
- return concat("[json.exception.", ename, '.', std::to_string(id_), "] ");
57
- }
58
-
59
- static std::string diagnostics(std::nullptr_t /*leaf_element*/)
60
- {
61
- return "";
62
- }
63
-
64
- template<typename BasicJsonType>
65
- static std::string diagnostics(const BasicJsonType* leaf_element)
66
- {
67
- #if JSON_DIAGNOSTICS
68
- std::vector<std::string> tokens;
69
- for (const auto* current = leaf_element; current != nullptr && current->m_parent != nullptr; current = current->m_parent)
70
- {
71
- switch (current->m_parent->type())
72
- {
73
- case value_t::array:
74
- {
75
- for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i)
76
- {
77
- if (&current->m_parent->m_data.m_value.array->operator[](i) == current)
78
- {
79
- tokens.emplace_back(std::to_string(i));
80
- break;
81
- }
82
- }
83
- break;
84
- }
85
-
86
- case value_t::object:
87
- {
88
- for (const auto& element : *current->m_parent->m_data.m_value.object)
89
- {
90
- if (&element.second == current)
91
- {
92
- tokens.emplace_back(element.first.c_str());
93
- break;
94
- }
95
- }
96
- break;
97
- }
98
-
99
- case value_t::null: // LCOV_EXCL_LINE
100
- case value_t::string: // LCOV_EXCL_LINE
101
- case value_t::boolean: // LCOV_EXCL_LINE
102
- case value_t::number_integer: // LCOV_EXCL_LINE
103
- case value_t::number_unsigned: // LCOV_EXCL_LINE
104
- case value_t::number_float: // LCOV_EXCL_LINE
105
- case value_t::binary: // LCOV_EXCL_LINE
106
- case value_t::discarded: // LCOV_EXCL_LINE
107
- default: // LCOV_EXCL_LINE
108
- break; // LCOV_EXCL_LINE
109
- }
110
- }
111
-
112
- if (tokens.empty())
113
- {
114
- return "";
115
- }
116
-
117
- auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{},
118
- [](const std::string & a, const std::string & b)
119
- {
120
- return concat(a, '/', detail::escape(b));
121
- });
122
- return concat('(', str, ") ");
123
- #else
124
- static_cast<void>(leaf_element);
125
- return "";
126
- #endif
127
- }
128
-
129
- private:
130
- /// an exception object as storage for error messages
131
- std::runtime_error m;
132
- };
133
-
134
- /// @brief exception indicating a parse error
135
- /// @sa https://json.nlohmann.me/api/basic_json/parse_error/
136
- class parse_error : public exception
137
- {
138
- public:
139
- /*!
140
- @brief create a parse error exception
141
- @param[in] id_ the id of the exception
142
- @param[in] pos the position where the error occurred (or with
143
- chars_read_total=0 if the position cannot be
144
- determined)
145
- @param[in] what_arg the explanatory string
146
- @return parse_error object
147
- */
148
- template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>
149
- static parse_error create(int id_, const position_t& pos, const std::string& what_arg, BasicJsonContext context)
150
- {
151
- const std::string w = concat(exception::name("parse_error", id_), "parse error",
152
- position_string(pos), ": ", exception::diagnostics(context), what_arg);
153
- return {id_, pos.chars_read_total, w.c_str()};
154
- }
155
-
156
- template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>
157
- static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, BasicJsonContext context)
158
- {
159
- const std::string w = concat(exception::name("parse_error", id_), "parse error",
160
- (byte_ != 0 ? (concat(" at byte ", std::to_string(byte_))) : ""),
161
- ": ", exception::diagnostics(context), what_arg);
162
- return {id_, byte_, w.c_str()};
163
- }
164
-
165
- /*!
166
- @brief byte index of the parse error
167
-
168
- The byte index of the last read character in the input file.
169
-
170
- @note For an input with n bytes, 1 is the index of the first character and
171
- n+1 is the index of the terminating null byte or the end of file.
172
- This also holds true when reading a byte vector (CBOR or MessagePack).
173
- */
174
- const std::size_t byte;
175
-
176
- private:
177
- parse_error(int id_, std::size_t byte_, const char* what_arg)
178
- : exception(id_, what_arg), byte(byte_) {}
179
-
180
- static std::string position_string(const position_t& pos)
181
- {
182
- return concat(" at line ", std::to_string(pos.lines_read + 1),
183
- ", column ", std::to_string(pos.chars_read_current_line));
184
- }
185
- };
186
-
187
- /// @brief exception indicating errors with iterators
188
- /// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/
189
- class invalid_iterator : public exception
190
- {
191
- public:
192
- template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>
193
- static invalid_iterator create(int id_, const std::string& what_arg, BasicJsonContext context)
194
- {
195
- const std::string w = concat(exception::name("invalid_iterator", id_), exception::diagnostics(context), what_arg);
196
- return {id_, w.c_str()};
197
- }
198
-
199
- private:
200
- JSON_HEDLEY_NON_NULL(3)
201
- invalid_iterator(int id_, const char* what_arg)
202
- : exception(id_, what_arg) {}
203
- };
204
-
205
- /// @brief exception indicating executing a member function with a wrong type
206
- /// @sa https://json.nlohmann.me/api/basic_json/type_error/
207
- class type_error : public exception
208
- {
209
- public:
210
- template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>
211
- static type_error create(int id_, const std::string& what_arg, BasicJsonContext context)
212
- {
213
- const std::string w = concat(exception::name("type_error", id_), exception::diagnostics(context), what_arg);
214
- return {id_, w.c_str()};
215
- }
216
-
217
- private:
218
- JSON_HEDLEY_NON_NULL(3)
219
- type_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
220
- };
221
-
222
- /// @brief exception indicating access out of the defined range
223
- /// @sa https://json.nlohmann.me/api/basic_json/out_of_range/
224
- class out_of_range : public exception
225
- {
226
- public:
227
- template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>
228
- static out_of_range create(int id_, const std::string& what_arg, BasicJsonContext context)
229
- {
230
- const std::string w = concat(exception::name("out_of_range", id_), exception::diagnostics(context), what_arg);
231
- return {id_, w.c_str()};
232
- }
233
-
234
- private:
235
- JSON_HEDLEY_NON_NULL(3)
236
- out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {}
237
- };
238
-
239
- /// @brief exception indicating other library errors
240
- /// @sa https://json.nlohmann.me/api/basic_json/other_error/
241
- class other_error : public exception
242
- {
243
- public:
244
- template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0>
245
- static other_error create(int id_, const std::string& what_arg, BasicJsonContext context)
246
- {
247
- const std::string w = concat(exception::name("other_error", id_), exception::diagnostics(context), what_arg);
248
- return {id_, w.c_str()};
249
- }
250
-
251
- private:
252
- JSON_HEDLEY_NON_NULL(3)
253
- other_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
254
- };
255
-
256
- } // namespace detail
257
- NLOHMANN_JSON_NAMESPACE_END