1 /// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/).
2 /// It is intended to be used with #include "json/json-forwards.h"
3 /// This header provides forward declaration for all JsonCpp types.
5 // //////////////////////////////////////////////////////////////////////
6 // Beginning of content of file: LICENSE
7 // //////////////////////////////////////////////////////////////////////
10 The JsonCpp library's source code, including accompanying documentation,
11 tests and demonstration applications, are licensed under the following
14 Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
15 jurisdictions which recognize such a disclaimer. In such jurisdictions,
16 this software is released into the Public Domain.
18 In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
19 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
20 The JsonCpp Authors, and is released under the terms of the MIT License (see below).
22 In jurisdictions which recognize Public Domain property, the user of this
23 software may choose to accept it either as 1) Public Domain, 2) under the
24 conditions of the MIT License (see below), or 3) under the terms of dual
25 Public Domain/MIT License conditions described here, as they choose.
27 The MIT License is about as close to Public Domain as a license can get, and is
28 described in clear, concise terms at:
30 http://en.wikipedia.org/wiki/MIT_License
32 The full text of the MIT License follows:
34 ========================================================================
35 Copyright (c) 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
37 Permission is hereby granted, free of charge, to any person
38 obtaining a copy of this software and associated documentation
39 files (the "Software"), to deal in the Software without
40 restriction, including without limitation the rights to use, copy,
41 modify, merge, publish, distribute, sublicense, and/or sell copies
42 of the Software, and to permit persons to whom the Software is
43 furnished to do so, subject to the following conditions:
45 The above copyright notice and this permission notice shall be
46 included in all copies or substantial portions of the Software.
48 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
49 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
50 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
51 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
52 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
53 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
54 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56 ========================================================================
59 The MIT license is compatible with both the GPL and commercial
60 software, affording one all of the rights of Public Domain with the
61 minor nuisance of being required to keep the above copyright notice
62 and license text in the source code. Note also that by accepting the
63 Public Domain "license" you can re-license your copy using whatever
68 // //////////////////////////////////////////////////////////////////////
69 // End of content of file: LICENSE
70 // //////////////////////////////////////////////////////////////////////
76 #ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED
77 # define JSON_FORWARD_AMALGAMATED_H_INCLUDED
78 /// If defined, indicates that the source file is amalgamated
79 /// to prevent private header inclusion.
80 #define JSON_IS_AMALGAMATION
82 // //////////////////////////////////////////////////////////////////////
83 // Beginning of content of file: include/json/version.h
84 // //////////////////////////////////////////////////////////////////////
86 #ifndef JSON_VERSION_H_INCLUDED
87 #define JSON_VERSION_H_INCLUDED
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
93 // 2. /include/json/version.h
95 // IMPORTANT: also update the SOVERSION!!
97 #define JSONCPP_VERSION_STRING "1.9.4"
98 #define JSONCPP_VERSION_MAJOR 1
99 #define JSONCPP_VERSION_MINOR 9
100 #define JSONCPP_VERSION_PATCH 3
101 #define JSONCPP_VERSION_QUALIFIER
102 #define JSONCPP_VERSION_HEXA \
103 ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
104 (JSONCPP_VERSION_PATCH << 8))
106 #ifdef JSONCPP_USING_SECURE_MEMORY
107 #undef JSONCPP_USING_SECURE_MEMORY
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.
113 #endif // JSON_VERSION_H_INCLUDED
115 // //////////////////////////////////////////////////////////////////////
116 // End of content of file: include/json/version.h
117 // //////////////////////////////////////////////////////////////////////
124 // //////////////////////////////////////////////////////////////////////
125 // Beginning of content of file: include/json/allocator.h
126 // //////////////////////////////////////////////////////////////////////
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
133 #ifndef JSON_ALLOCATOR_H_INCLUDED
134 #define JSON_ALLOCATOR_H_INCLUDED
139 #pragma pack(push, 8)
142 template <typename T> class SecureAllocator {
145 using value_type = 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;
154 * Allocate memory for N items using the standard allocator.
156 pointer allocate(size_type n) {
157 // allocate using "global operator new"
158 return static_cast<pointer>(::operator new(n * sizeof(T)));
162 * Release memory which was allocated for N items at pointer P.
164 * The memory block is filled with zeroes before being released.
165 * The pointer argument is tagged as "volatile" to prevent the
166 * compiler optimizing out this critical step.
168 void deallocate(volatile pointer p, size_type n) {
169 std::memset(p, 0, n * sizeof(T));
170 // free using "global operator delete"
171 ::operator delete(p);
175 * Construct an item in-place at pointer P.
177 template <typename... Args> void construct(pointer p, Args&&... args) {
178 // construct using "placement new" and "perfect forwarding"
179 ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
182 size_type max_size() const { return size_t(-1) / sizeof(T); }
184 pointer address(reference x) const { return std::addressof(x); }
186 const_pointer address(const_reference x) const { return std::addressof(x); }
189 * Destroy an item in-place at pointer P.
191 void destroy(pointer p) {
192 // destroy using "explicit destructor"
198 template <typename U> SecureAllocator(const SecureAllocator<U>&) {}
199 template <typename U> struct rebind { using other = SecureAllocator<U>; };
202 template <typename T, typename U>
203 bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
207 template <typename T, typename U>
208 bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
216 #endif // JSON_ALLOCATOR_H_INCLUDED
218 // //////////////////////////////////////////////////////////////////////
219 // End of content of file: include/json/allocator.h
220 // //////////////////////////////////////////////////////////////////////
227 // //////////////////////////////////////////////////////////////////////
228 // Beginning of content of file: include/json/config.h
229 // //////////////////////////////////////////////////////////////////////
231 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
232 // Distributed under MIT license, or public domain if desired and
233 // recognized in your jurisdiction.
234 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
236 #ifndef JSON_CONFIG_H_INCLUDED
237 #define JSON_CONFIG_H_INCLUDED
245 #include <type_traits>
247 // If non-zero, the library uses exceptions to report bad input instead of C
248 // assertion macros. The default is to use exceptions.
249 #ifndef JSON_USE_EXCEPTION
250 #define JSON_USE_EXCEPTION 1
253 // Temporary, tracked for removal with issue #982.
254 #ifndef JSON_USE_NULLREF
255 #define JSON_USE_NULLREF 1
258 /// If defined, indicates that the source file is amalgamated
259 /// to prevent private header inclusion.
260 /// Remarks: it is automatically defined in the generated amalgamated header.
261 // #define JSON_IS_AMALGAMATION
263 // Export macros for DLL visibility
264 #if defined(JSON_DLL_BUILD)
265 #if defined(_MSC_VER) || defined(__MINGW32__)
266 #define JSON_API __declspec(dllexport)
267 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
268 #elif defined(__GNUC__) || defined(__clang__)
269 #define JSON_API __attribute__((visibility("default")))
270 #endif // if defined(_MSC_VER)
272 #elif defined(JSON_DLL)
273 #if defined(_MSC_VER) || defined(__MINGW32__)
274 #define JSON_API __declspec(dllimport)
275 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
276 #endif // if defined(_MSC_VER)
277 #endif // ifdef JSON_DLL_BUILD
279 #if !defined(JSON_API)
283 #if defined(_MSC_VER) && _MSC_VER < 1800
285 "ERROR: Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"
288 #if defined(_MSC_VER) && _MSC_VER < 1900
290 // https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
291 extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
292 const char* format, ...);
293 #define jsoncpp_snprintf msvc_pre1900_c99_snprintf
295 #define jsoncpp_snprintf std::snprintf
298 // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
300 // Storages, and 64 bits integer support is disabled.
301 // #define JSON_NO_INT64 1
303 // JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
304 // C++11 should be used directly in JSONCPP.
305 #define JSONCPP_OVERRIDE override
308 #if __has_extension(attribute_deprecated_with_message)
309 #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
311 #elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc)
312 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
313 #define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
314 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
315 #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
316 #endif // GNUC version
317 #elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates
319 #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
320 #endif // __clang__ || __GNUC__ || _MSC_VER
322 #if !defined(JSONCPP_DEPRECATED)
323 #define JSONCPP_DEPRECATED(message)
324 #endif // if !defined(JSONCPP_DEPRECATED)
326 #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
327 #define JSON_USE_INT64_DOUBLE_CONVERSION 1
330 #if !defined(JSON_IS_AMALGAMATION)
332 #include "allocator.h"
335 #endif // if !defined(JSON_IS_AMALGAMATION)
339 using UInt = unsigned int;
340 #if defined(JSON_NO_INT64)
341 using LargestInt = int;
342 using LargestUInt = unsigned int;
343 #undef JSON_HAS_INT64
344 #else // if defined(JSON_NO_INT64)
345 // For Microsoft Visual use specific types as long long is not supported
346 #if defined(_MSC_VER) // Microsoft Visual Studio
347 using Int64 = __int64;
348 using UInt64 = unsigned __int64;
349 #else // if defined(_MSC_VER) // Other platforms, use long long
350 using Int64 = int64_t;
351 using UInt64 = uint64_t;
352 #endif // if defined(_MSC_VER)
353 using LargestInt = Int64;
354 using LargestUInt = UInt64;
355 #define JSON_HAS_INT64
356 #endif // if defined(JSON_NO_INT64)
358 template <typename T>
360 typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,
361 std::allocator<T>>::type;
362 using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
363 using IStringStream =
364 std::basic_istringstream<String::value_type, String::traits_type,
365 String::allocator_type>;
366 using OStringStream =
367 std::basic_ostringstream<String::value_type, String::traits_type,
368 String::allocator_type>;
369 using IStream = std::istream;
370 using OStream = std::ostream;
373 // Legacy names (formerly macros).
374 using JSONCPP_STRING = Json::String;
375 using JSONCPP_ISTRINGSTREAM = Json::IStringStream;
376 using JSONCPP_OSTRINGSTREAM = Json::OStringStream;
377 using JSONCPP_ISTREAM = Json::IStream;
378 using JSONCPP_OSTREAM = Json::OStream;
380 #endif // JSON_CONFIG_H_INCLUDED
382 // //////////////////////////////////////////////////////////////////////
383 // End of content of file: include/json/config.h
384 // //////////////////////////////////////////////////////////////////////
391 // //////////////////////////////////////////////////////////////////////
392 // Beginning of content of file: include/json/forwards.h
393 // //////////////////////////////////////////////////////////////////////
395 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
396 // Distributed under MIT license, or public domain if desired and
397 // recognized in your jurisdiction.
398 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
400 #ifndef JSON_FORWARDS_H_INCLUDED
401 #define JSON_FORWARDS_H_INCLUDED
403 #if !defined(JSON_IS_AMALGAMATION)
405 #endif // if !defined(JSON_IS_AMALGAMATION)
411 class StreamWriterBuilder;
415 class StyledStreamWriter;
420 class CharReaderBuilder;
426 using ArrayIndex = unsigned int;
431 class ValueIteratorBase;
433 class ValueConstIterator;
437 #endif // JSON_FORWARDS_H_INCLUDED
439 // //////////////////////////////////////////////////////////////////////
440 // End of content of file: include/json/forwards.h
441 // //////////////////////////////////////////////////////////////////////
447 #endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED