NIM PC Cross Platform SDK
config.h
1// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2// Distributed under MIT license, or public domain if desired and
3// recognized in your jurisdiction.
4// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
6#ifndef NIM_CPP_WRAPPER_UTIL_JSON_CONFIG_H_INCLUDED
7#define NIM_CPP_WRAPPER_UTIL_JSON_CONFIG_H_INCLUDED
8#include <cstddef>
9#include <cstdint>
10#include <istream>
11#include <memory>
12#include <ostream>
13#include <sstream>
14#include <string>
15#include <type_traits>
16
17// If non-zero, the library uses exceptions to report bad input instead of C
18// assertion macros. The default is to use exceptions.
19#ifndef JSON_USE_EXCEPTION
20#define JSON_USE_EXCEPTION 1
21#endif
22
23// Temporary, tracked for removal with issue #982.
24#ifndef JSON_USE_NULLREF
25#define JSON_USE_NULLREF 1
26#endif
27
31// #define JSON_IS_AMALGAMATION
32
33// Export macros for DLL visibility
34#if defined(JSON_DLL_BUILD)
35#if defined(_MSC_VER) || defined(__MINGW32__)
36#define JSON_API __declspec(dllexport)
37#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
38#elif defined(__GNUC__) || defined(__clang__)
39#define JSON_API __attribute__((visibility("default")))
40#endif // if defined(_MSC_VER)
41
42#elif defined(JSON_DLL)
43#if defined(_MSC_VER) || defined(__MINGW32__)
44#define JSON_API __declspec(dllimport)
45#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
46#endif // if defined(_MSC_VER)
47#endif // ifdef JSON_DLL_BUILD
48
49#if !defined(JSON_API)
50#define JSON_API
51#endif
52
53#if defined(_MSC_VER) && _MSC_VER < 1800
54#error "ERROR: Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"
55#endif
56
57#if defined(_MSC_VER) && _MSC_VER < 1900
58// As recommended at
59// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
60extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
61#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
62#else
63#define jsoncpp_snprintf std::snprintf
64#endif
65
66// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
67// integer
68// Storages, and 64 bits integer support is disabled.
69// #define JSON_NO_INT64 1
70
71// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
72// C++11 should be used directly in JSONCPP.
73#define JSONCPP_OVERRIDE override
74
75#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
76#define JSON_USE_INT64_DOUBLE_CONVERSION 1
77#endif
78
79#if !defined(JSON_IS_AMALGAMATION)
80
81#include "allocator.h"
82#define JSONCPP_USING_SECURE_MEMORY 0
83
84#endif // if !defined(JSON_IS_AMALGAMATION)
85
86namespace nim_cpp_wrapper_util {
87namespace Json {
88using Int = int;
89using UInt = unsigned int;
90#if defined(JSON_NO_INT64)
91using LargestInt = int;
92using LargestUInt = unsigned int;
93#undef JSON_HAS_INT64
94#else // if defined(JSON_NO_INT64)
95// For Microsoft Visual use specific types as long long is not supported
96#if defined(_MSC_VER) // Microsoft Visual Studio
97using Int64 = __int64;
98using UInt64 = unsigned __int64;
99#else // if defined(_MSC_VER) // Other platforms, use long long
100using Int64 = int64_t;
101using UInt64 = uint64_t;
102#endif // if defined(_MSC_VER)
103using LargestInt = Int64;
104using LargestUInt = UInt64;
105#define JSON_HAS_INT64
106#endif // if defined(JSON_NO_INT64)
107
108template <typename T>
109using Allocator = typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>, std::allocator<T>>::type;
110using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
111using IStringStream = std::basic_istringstream<String::value_type, String::traits_type, String::allocator_type>;
112using OStringStream = std::basic_ostringstream<String::value_type, String::traits_type, String::allocator_type>;
113using IStream = std::istream;
114using OStream = std::ostream;
115} // namespace Json
116} // namespace nim_cpp_wrapper_util
117
118// Legacy names (formerly macros).
119using JSONCPP_STRING = nim_cpp_wrapper_util::Json::String;
120using JSONCPP_ISTRINGSTREAM = nim_cpp_wrapper_util::Json::IStringStream;
121using JSONCPP_OSTRINGSTREAM = nim_cpp_wrapper_util::Json::OStringStream;
122using JSONCPP_ISTREAM = nim_cpp_wrapper_util::Json::IStream;
123using JSONCPP_OSTREAM = nim_cpp_wrapper_util::Json::OStream;
124
125#endif // JSON_CONFIG_H_INCLUDED
JSON (JavaScript Object Notation).
Definition: allocator.h:14