@@ -79,6 +79,150 @@ license you like.
79
79
// / to prevent private header inclusion.
80
80
#define JSON_IS_AMALGAMATION
81
81
82
+ // //////////////////////////////////////////////////////////////////////
83
+ // Beginning of content of file: include/json/version.h
84
+ // //////////////////////////////////////////////////////////////////////
85
+
86
+ #ifndef JSON_VERSION_H_INCLUDED
87
+ #define JSON_VERSION_H_INCLUDED
88
+
89
+ // Note: version must be updated in three places when doing a release. This
90
+ // annoying process ensures that amalgamate, CMake, and meson all report the
91
+ // correct version.
92
+ // 1. /meson.build
93
+ // 2. /include/json/version.h
94
+ // 3. /CMakeLists.txt
95
+ // IMPORTANT: also update the SOVERSION!!
96
+
97
+ #define JSONCPP_VERSION_STRING " 1.9.5"
98
+ #define JSONCPP_VERSION_MAJOR 1
99
+ #define JSONCPP_VERSION_MINOR 9
100
+ #define JSONCPP_VERSION_PATCH 5
101
+ #define JSONCPP_VERSION_QUALIFIER
102
+ #define JSONCPP_VERSION_HEXA \
103
+ ((JSONCPP_VERSION_MAJOR << 24 ) | (JSONCPP_VERSION_MINOR << 16 ) | \
104
+ (JSONCPP_VERSION_PATCH << 8 ))
105
+
106
+ #ifdef JSONCPP_USING_SECURE_MEMORY
107
+ #undef JSONCPP_USING_SECURE_MEMORY
108
+ #endif
109
+ #define JSONCPP_USING_SECURE_MEMORY 0
110
+ // If non-zero, the library zeroes any memory that it has allocated before
111
+ // it frees its memory.
112
+
113
+ #endif // JSON_VERSION_H_INCLUDED
114
+
115
+ // //////////////////////////////////////////////////////////////////////
116
+ // End of content of file: include/json/version.h
117
+ // //////////////////////////////////////////////////////////////////////
118
+
119
+
120
+
121
+
122
+
123
+
124
+ // //////////////////////////////////////////////////////////////////////
125
+ // Beginning of content of file: include/json/allocator.h
126
+ // //////////////////////////////////////////////////////////////////////
127
+
128
+ // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
129
+ // Distributed under MIT license, or public domain if desired and
130
+ // recognized in your jurisdiction.
131
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
132
+
133
+ #ifndef JSON_ALLOCATOR_H_INCLUDED
134
+ #define JSON_ALLOCATOR_H_INCLUDED
135
+
136
+ #include < cstring>
137
+ #include < memory>
138
+
139
+ #pragma pack(push, 8)
140
+
141
+ namespace Json {
142
+ template <typename T> class SecureAllocator {
143
+ public:
144
+ // Type definitions
145
+ using value_type = T;
146
+ using pointer = T*;
147
+ using const_pointer = const T*;
148
+ using reference = T&;
149
+ using const_reference = const T&;
150
+ using size_type = std::size_t ;
151
+ using difference_type = std::ptrdiff_t ;
152
+
153
+ /* *
154
+ * Allocate memory for N items using the standard allocator.
155
+ */
156
+ pointer allocate (size_type n) {
157
+ // allocate using "global operator new"
158
+ return static_cast <pointer>(::operator new (n * sizeof (T)));
159
+ }
160
+
161
+ /* *
162
+ * Release memory which was allocated for N items at pointer P.
163
+ *
164
+ * The memory block is filled with zeroes before being released.
165
+ */
166
+ void deallocate (pointer p, size_type n) {
167
+ // memset_s is used because memset may be optimized away by the compiler
168
+ memset_s (p, n * sizeof (T), 0 , n * sizeof (T));
169
+ // free using "global operator delete"
170
+ ::operator delete (p);
171
+ }
172
+
173
+ /* *
174
+ * Construct an item in-place at pointer P.
175
+ */
176
+ template <typename ... Args> void construct (pointer p, Args&&... args) {
177
+ // construct using "placement new" and "perfect forwarding"
178
+ ::new (static_cast <void *>(p)) T (std::forward<Args>(args)...);
179
+ }
180
+
181
+ size_type max_size () const { return size_t (-1 ) / sizeof (T); }
182
+
183
+ pointer address (reference x) const { return std::addressof (x); }
184
+
185
+ const_pointer address (const_reference x) const { return std::addressof (x); }
186
+
187
+ /* *
188
+ * Destroy an item in-place at pointer P.
189
+ */
190
+ void destroy (pointer p) {
191
+ // destroy using "explicit destructor"
192
+ p->~T ();
193
+ }
194
+
195
+ // Boilerplate
196
+ SecureAllocator () {}
197
+ template <typename U> SecureAllocator (const SecureAllocator<U>&) {}
198
+ template <typename U> struct rebind { using other = SecureAllocator<U>; };
199
+ };
200
+
201
+ template <typename T, typename U>
202
+ bool operator ==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
203
+ return true ;
204
+ }
205
+
206
+ template <typename T, typename U>
207
+ bool operator !=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
208
+ return false ;
209
+ }
210
+
211
+ } // namespace Json
212
+
213
+ #pragma pack(pop)
214
+
215
+ #endif // JSON_ALLOCATOR_H_INCLUDED
216
+
217
+ // //////////////////////////////////////////////////////////////////////
218
+ // End of content of file: include/json/allocator.h
219
+ // //////////////////////////////////////////////////////////////////////
220
+
221
+
222
+
223
+
224
+
225
+
82
226
// //////////////////////////////////////////////////////////////////////
83
227
// Beginning of content of file: include/json/config.h
84
228
// //////////////////////////////////////////////////////////////////////
@@ -99,47 +243,38 @@ license you like.
99
243
#include < string>
100
244
#include < type_traits>
101
245
102
- // / If defined, indicates that json library is embedded in CppTL library.
103
- // # define JSON_IN_CPPTL 1
104
-
105
- // / If defined, indicates that json may leverage CppTL library
106
- // # define JSON_USE_CPPTL 1
107
- // / If defined, indicates that cpptl vector based map should be used instead of
108
- // / std::map
109
- // / as Value container.
110
- // # define JSON_USE_CPPTL_SMALLMAP 1
111
-
112
246
// If non-zero, the library uses exceptions to report bad input instead of C
113
247
// assertion macros. The default is to use exceptions.
114
248
#ifndef JSON_USE_EXCEPTION
115
249
#define JSON_USE_EXCEPTION 1
116
250
#endif
117
251
252
+ // Temporary, tracked for removal with issue #982.
253
+ #ifndef JSON_USE_NULLREF
254
+ #define JSON_USE_NULLREF 1
255
+ #endif
256
+
118
257
// / If defined, indicates that the source file is amalgamated
119
258
// / to prevent private header inclusion.
120
259
// / Remarks: it is automatically defined in the generated amalgamated header.
121
260
// #define JSON_IS_AMALGAMATION
122
261
123
- #ifdef JSON_IN_CPPTL
124
- #include < cpptl/config.h>
125
- #ifndef JSON_USE_CPPTL
126
- #define JSON_USE_CPPTL 1
127
- #endif
128
- #endif
129
-
130
- #ifdef JSON_IN_CPPTL
131
- #define JSON_API CPPTL_API
132
- #elif defined(JSON_DLL_BUILD)
262
+ // Export macros for DLL visibility
263
+ #if defined(JSON_DLL_BUILD)
133
264
#if defined(_MSC_VER) || defined(__MINGW32__)
134
265
#define JSON_API __declspec (dllexport)
135
266
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
267
+ #elif defined(__GNUC__) || defined(__clang__)
268
+ #define JSON_API __attribute__ ((visibility(" default" )))
136
269
#endif // if defined(_MSC_VER)
270
+
137
271
#elif defined(JSON_DLL)
138
272
#if defined(_MSC_VER) || defined(__MINGW32__)
139
273
#define JSON_API __declspec (dllimport)
140
274
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
141
275
#endif // if defined(_MSC_VER)
142
- #endif // ifdef JSON_IN_CPPTL
276
+ #endif // ifdef JSON_DLL_BUILD
277
+
143
278
#if !defined(JSON_API)
144
279
#define JSON_API
145
280
#endif
@@ -152,8 +287,8 @@ license you like.
152
287
#if defined(_MSC_VER) && _MSC_VER < 1900
153
288
// As recommended at
154
289
// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
155
- extern JSON_API int
156
- msvc_pre1900_c99_snprintf ( char * outBuf, size_t size, const char * format, ...);
290
+ extern JSON_API int msvc_pre1900_c99_snprintf ( char * outBuf, size_t size,
291
+ const char * format, ...);
157
292
#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
158
293
#else
159
294
#define jsoncpp_snprintf std::snprintf
@@ -164,69 +299,30 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
164
299
// Storages, and 64 bits integer support is disabled.
165
300
// #define JSON_NO_INT64 1
166
301
167
- #if defined(_MSC_VER) // MSVC
168
- #define JSONCPP_DEPRECATED (message ) __declspec(deprecated(message))
169
- #endif // defined(_MSC_VER)
170
-
171
302
// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
172
303
// C++11 should be used directly in JSONCPP.
173
304
#define JSONCPP_OVERRIDE override
174
305
175
- #if __cplusplus >= 201103L
176
- #define JSONCPP_NOEXCEPT noexcept
177
- #define JSONCPP_OP_EXPLICIT explicit
178
- #elif defined(_MSC_VER) && _MSC_VER < 1900
179
- #define JSONCPP_NOEXCEPT throw ()
180
- #define JSONCPP_OP_EXPLICIT explicit
181
- #elif defined(_MSC_VER) && _MSC_VER >= 1900
182
- #define JSONCPP_NOEXCEPT noexcept
183
- #define JSONCPP_OP_EXPLICIT explicit
184
- #else
185
- #define JSONCPP_NOEXCEPT throw ()
186
- #define JSONCPP_OP_EXPLICIT
187
- #endif
188
-
189
- #ifndef JSON_HAS_RVALUE_REFERENCES
190
-
191
- #if defined(_MSC_VER)
192
- #define JSON_HAS_RVALUE_REFERENCES 1
193
- #endif // MSVC >= 2013
194
-
195
- #ifdef __clang__
196
- #if __has_feature(cxx_rvalue_references)
197
- #define JSON_HAS_RVALUE_REFERENCES 1
198
- #endif // has_feature
199
-
200
- #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
201
- #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
202
- #define JSON_HAS_RVALUE_REFERENCES 1
203
- #endif // GXX_EXPERIMENTAL
204
-
205
- #endif // __clang__ || __GNUC__
206
-
207
- #endif // not defined JSON_HAS_RVALUE_REFERENCES
208
-
209
- #ifndef JSON_HAS_RVALUE_REFERENCES
210
- #define JSON_HAS_RVALUE_REFERENCES 0
211
- #endif
212
-
213
306
#ifdef __clang__
214
307
#if __has_extension(attribute_deprecated_with_message)
215
308
#define JSONCPP_DEPRECATED (message ) __attribute__((deprecated(message)))
216
309
#endif
217
- #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
310
+ #elif defined( __GNUC__) // not clang (gcc comes later since clang emulates gcc)
218
311
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
219
312
#define JSONCPP_DEPRECATED (message ) __attribute__((deprecated(message)))
220
313
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
221
314
#define JSONCPP_DEPRECATED (message ) __attribute__((__deprecated__))
222
- #endif // GNUC version
223
- #endif // __clang__ || __GNUC__
315
+ #endif // GNUC version
316
+ #elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates
317
+ // MSVC)
318
+ #define JSONCPP_DEPRECATED (message ) __declspec(deprecated(message))
319
+ #endif // __clang__ || __GNUC__ || _MSC_VER
224
320
225
321
#if !defined(JSONCPP_DEPRECATED)
226
322
#define JSONCPP_DEPRECATED (message )
227
323
#endif // if !defined(JSONCPP_DEPRECATED)
228
324
229
- #if __GNUC__ >= 6
325
+ #if defined(__clang__) || (defined( __GNUC__) && (__GNUC__ >= 6))
230
326
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
231
327
#endif
232
328
@@ -238,37 +334,37 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
238
334
#endif // if !defined(JSON_IS_AMALGAMATION)
239
335
240
336
namespace Json {
241
- typedef int Int;
242
- typedef unsigned int UInt ;
337
+ using Int = int ;
338
+ using UInt = unsigned int ;
243
339
#if defined(JSON_NO_INT64)
244
- typedef int LargestInt;
245
- typedef unsigned int LargestUInt ;
340
+ using LargestInt = int ;
341
+ using LargestUInt = unsigned int ;
246
342
#undef JSON_HAS_INT64
247
343
#else // if defined(JSON_NO_INT64)
248
344
// For Microsoft Visual use specific types as long long is not supported
249
345
#if defined(_MSC_VER) // Microsoft Visual Studio
250
- typedef __int64 Int64;
251
- typedef unsigned __int64 UInt64 ;
346
+ using Int64 = __int64 ;
347
+ using UInt64 = unsigned __int64;
252
348
#else // if defined(_MSC_VER) // Other platforms, use long long
253
- typedef int64_t Int64;
254
- typedef uint64_t UInt64 ;
349
+ using Int64 = int64_t ;
350
+ using UInt64 = uint64_t ;
255
351
#endif // if defined(_MSC_VER)
256
- typedef Int64 LargestInt;
257
- typedef UInt64 LargestUInt;
352
+ using LargestInt = Int64 ;
353
+ using LargestUInt = UInt64 ;
258
354
#define JSON_HAS_INT64
259
355
#endif // if defined(JSON_NO_INT64)
260
356
261
357
template <typename T>
262
- using Allocator = typename std::conditional<JSONCPP_USING_SECURE_MEMORY,
263
- SecureAllocator<T>,
264
- std::allocator<T>>::type;
358
+ using Allocator =
359
+ typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,
360
+ std::allocator<T>>::type;
265
361
using String = std::basic_string<char , std::char_traits<char >, Allocator<char >>;
266
- using IStringStream = std::basic_istringstream<String::value_type,
267
- String::traits_type,
268
- String::allocator_type>;
269
- using OStringStream = std::basic_ostringstream<String::value_type,
270
- String::traits_type,
271
- String::allocator_type>;
362
+ using IStringStream =
363
+ std::basic_istringstream<String::value_type, String::traits_type,
364
+ String::allocator_type>;
365
+ using OStringStream =
366
+ std::basic_ostringstream<String::value_type, String::traits_type,
367
+ String::allocator_type>;
272
368
using IStream = std::istream;
273
369
using OStream = std::ostream;
274
370
} // namespace Json
@@ -310,17 +406,23 @@ using JSONCPP_OSTREAM = Json::OStream;
310
406
namespace Json {
311
407
312
408
// writer.h
409
+ class StreamWriter ;
410
+ class StreamWriterBuilder ;
411
+ class Writer ;
313
412
class FastWriter ;
314
413
class StyledWriter ;
414
+ class StyledStreamWriter ;
315
415
316
416
// reader.h
317
417
class Reader ;
418
+ class CharReader ;
419
+ class CharReaderBuilder ;
318
420
319
- // features .h
421
+ // json_features .h
320
422
class Features ;
321
423
322
424
// value.h
323
- typedef unsigned int ArrayIndex ;
425
+ using ArrayIndex = unsigned int ;
324
426
class StaticString ;
325
427
class Path ;
326
428
class PathArgument ;
0 commit comments