JsonCpp project page JsonCpp home page

config.h
Go to the documentation of this file.
1 // Copyright 2007-2010 Baptiste Lepilleur
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 JSON_CONFIG_H_INCLUDED
7 #define JSON_CONFIG_H_INCLUDED
8 #include <stddef.h>
9 #include <string> //typdef String
10 
12 //# define JSON_IN_CPPTL 1
13 
15 //# define JSON_USE_CPPTL 1
19 //# define JSON_USE_CPPTL_SMALLMAP 1
20 
21 // If non-zero, the library uses exceptions to report bad input instead of C
22 // assertion macros. The default is to use exceptions.
23 #ifndef JSON_USE_EXCEPTION
24 #define JSON_USE_EXCEPTION 1
25 #endif
26 
30 // #define JSON_IS_AMALGAMATION
31 
32 #ifdef JSON_IN_CPPTL
33 #include <cpptl/config.h>
34 #ifndef JSON_USE_CPPTL
35 #define JSON_USE_CPPTL 1
36 #endif
37 #endif
38 
39 #ifdef JSON_IN_CPPTL
40 #define JSON_API CPPTL_API
41 #elif defined(JSON_DLL_BUILD)
42 #if defined(_MSC_VER) || defined(__MINGW32__)
43 #define JSON_API __declspec(dllexport)
44 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
45 #endif // if defined(_MSC_VER)
46 #elif defined(JSON_DLL)
47 #if defined(_MSC_VER) || defined(__MINGW32__)
48 #define JSON_API __declspec(dllimport)
49 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
50 #endif // if defined(_MSC_VER)
51 #endif // ifdef JSON_IN_CPPTL
52 #if !defined(JSON_API)
53 #define JSON_API
54 #endif
55 
56 // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
57 // integer
58 // Storages, and 64 bits integer support is disabled.
59 // #define JSON_NO_INT64 1
60 
61 #if defined(_MSC_VER) // MSVC
62 # if _MSC_VER <= 1200 // MSVC 6
63  // Microsoft Visual Studio 6 only support conversion from __int64 to double
64  // (no conversion from unsigned __int64).
65 # define JSON_USE_INT64_DOUBLE_CONVERSION 1
66  // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
67  // characters in the debug information)
68  // All projects I've ever seen with VS6 were using this globally (not bothering
69  // with pragma push/pop).
70 # pragma warning(disable : 4786)
71 # endif // MSVC 6
72 
73 # if _MSC_VER >= 1500 // MSVC 2008
74 # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
76 # endif
77 
78 #endif // defined(_MSC_VER)
79 
80 #if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
81 # define JSONCPP_OVERRIDE
82 #else
83 # define JSONCPP_OVERRIDE override
84 #endif // MSVC <= 2010
85 
86 
87 #ifndef JSON_HAS_RVALUE_REFERENCES
88 
89 #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
90 #define JSON_HAS_RVALUE_REFERENCES 1
91 #endif // MSVC >= 2010
92 
93 #ifdef __clang__
94 #if __has_feature(cxx_rvalue_references)
95 #define JSON_HAS_RVALUE_REFERENCES 1
96 #endif // has_feature
97 
98 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
99 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
100 #define JSON_HAS_RVALUE_REFERENCES 1
101 #endif // GXX_EXPERIMENTAL
102 
103 #endif // __clang__ || __GNUC__
104 
105 #endif // not defined JSON_HAS_RVALUE_REFERENCES
106 
107 #ifndef JSON_HAS_RVALUE_REFERENCES
108 #define JSON_HAS_RVALUE_REFERENCES 0
109 #endif
110 
111 #ifdef __clang__
112 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
113 # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
114 # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
115 # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
116 # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
117 # endif // GNUC version
118 #endif // __clang__ || __GNUC__
119 
120 #if !defined(JSONCPP_DEPRECATED)
121 #define JSONCPP_DEPRECATED(message)
122 #endif // if !defined(JSONCPP_DEPRECATED)
123 
124 #if __GNUC__ >= 6
125 # define JSON_USE_INT64_DOUBLE_CONVERSION 1
126 #endif
127 
128 #if !defined(JSON_IS_AMALGAMATION)
129 
130 # include "version.h"
131 
132 # if JSONCPP_USING_SECURE_MEMORY
133 # include "allocator.h" //typedef Allocator
134 # endif
135 
136 #endif // if !defined(JSON_IS_AMALGAMATION)
137 
138 namespace Json {
139 typedef int Int;
140 typedef unsigned int UInt;
141 #if defined(JSON_NO_INT64)
142 typedef int LargestInt;
143 typedef unsigned int LargestUInt;
144 #undef JSON_HAS_INT64
145 #else // if defined(JSON_NO_INT64)
146 // For Microsoft Visual use specific types as long long is not supported
147 #if defined(_MSC_VER) // Microsoft Visual Studio
148 typedef __int64 Int64;
149 typedef unsigned __int64 UInt64;
150 #else // if defined(_MSC_VER) // Other platforms, use long long
151 typedef long long int Int64;
152 typedef unsigned long long int UInt64;
153 #endif // if defined(_MSC_VER)
154 typedef Int64 LargestInt;
155 typedef UInt64 LargestUInt;
156 #define JSON_HAS_INT64
157 #endif // if defined(JSON_NO_INT64)
158 #if JSONCPP_USING_SECURE_MEMORY
159 #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
160 #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
161 #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
162 #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
163 #define JSONCPP_ISTREAM std::istream
164 #else
165 #define JSONCPP_STRING std::string
166 #define JSONCPP_OSTRINGSTREAM std::ostringstream
167 #define JSONCPP_OSTREAM std::ostream
168 #define JSONCPP_ISTRINGSTREAM std::istringstream
169 #define JSONCPP_ISTREAM std::istream
170 #endif // if JSONCPP_USING_SECURE_MEMORY
171 } // end namespace Json
172 
173 #endif // JSON_CONFIG_H_INCLUDED
Int64 LargestInt
Definition: config.h:154
unsigned __int64 UInt64
Definition: config.h:149
UInt64 LargestUInt
Definition: config.h:155
JSON (JavaScript Object Notation).
Definition: allocator.h:12
unsigned int UInt
Definition: config.h:140
__int64 Int64
Definition: config.h:148
int Int
Definition: config.h:139