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 // In c++11 the override keyword allows you to explicity define that a function
81 // is intended to override the base-class version. This makes the code more
82 // managable and fixes a set of common hard-to-find bugs.
83 #if __cplusplus >= 201103L
84 # define JSONCPP_OVERRIDE override
85 #elif defined(_MSC_VER) && _MSC_VER > 1600
86 # define JSONCPP_OVERRIDE override
87 #else
88 # define JSONCPP_OVERRIDE
89 #endif
90 
91 #ifndef JSON_HAS_RVALUE_REFERENCES
92 
93 #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
94 #define JSON_HAS_RVALUE_REFERENCES 1
95 #endif // MSVC >= 2010
96 
97 #ifdef __clang__
98 #if __has_feature(cxx_rvalue_references)
99 #define JSON_HAS_RVALUE_REFERENCES 1
100 #endif // has_feature
101 
102 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
103 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
104 #define JSON_HAS_RVALUE_REFERENCES 1
105 #endif // GXX_EXPERIMENTAL
106 
107 #endif // __clang__ || __GNUC__
108 
109 #endif // not defined JSON_HAS_RVALUE_REFERENCES
110 
111 #ifndef JSON_HAS_RVALUE_REFERENCES
112 #define JSON_HAS_RVALUE_REFERENCES 0
113 #endif
114 
115 #ifdef __clang__
116 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
117 # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
118 # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
119 # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
120 # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
121 # endif // GNUC version
122 #endif // __clang__ || __GNUC__
123 
124 #if !defined(JSONCPP_DEPRECATED)
125 #define JSONCPP_DEPRECATED(message)
126 #endif // if !defined(JSONCPP_DEPRECATED)
127 
128 #if __GNUC__ >= 6
129 # define JSON_USE_INT64_DOUBLE_CONVERSION 1
130 #endif
131 
132 #if !defined(JSON_IS_AMALGAMATION)
133 
134 # include "version.h"
135 
136 # if JSONCPP_USING_SECURE_MEMORY
137 # include "allocator.h" //typedef Allocator
138 # endif
139 
140 #endif // if !defined(JSON_IS_AMALGAMATION)
141 
142 namespace Json {
143 typedef int Int;
144 typedef unsigned int UInt;
145 #if defined(JSON_NO_INT64)
146 typedef int LargestInt;
147 typedef unsigned int LargestUInt;
148 #undef JSON_HAS_INT64
149 #else // if defined(JSON_NO_INT64)
150 // For Microsoft Visual use specific types as long long is not supported
151 #if defined(_MSC_VER) // Microsoft Visual Studio
152 typedef __int64 Int64;
153 typedef unsigned __int64 UInt64;
154 #else // if defined(_MSC_VER) // Other platforms, use long long
155 typedef long long int Int64;
156 typedef unsigned long long int UInt64;
157 #endif // if defined(_MSC_VER)
160 #define JSON_HAS_INT64
161 #endif // if defined(JSON_NO_INT64)
162 #if JSONCPP_USING_SECURE_MEMORY
163 #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
164 #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
165 #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
166 #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
167 #define JSONCPP_ISTREAM std::istream
168 #else
169 #define JSONCPP_STRING std::string
170 #define JSONCPP_OSTRINGSTREAM std::ostringstream
171 #define JSONCPP_OSTREAM std::ostream
172 #define JSONCPP_ISTRINGSTREAM std::istringstream
173 #define JSONCPP_ISTREAM std::istream
174 #endif // if JSONCPP_USING_SECURE_MEMORY
175 } // end namespace Json
176 
177 #endif // JSON_CONFIG_H_INCLUDED
Json::LargestUInt
UInt64 LargestUInt
Definition: config.h:159
Json::Int
int Int
Definition: config.h:143
Json::Int64
__int64 Int64
Definition: config.h:152
Json::LargestInt
Int64 LargestInt
Definition: config.h:158
Json::UInt
unsigned int UInt
Definition: config.h:144
version.h
Json::UInt64
unsigned __int64 UInt64
Definition: config.h:153
Json
JSON (JavaScript Object Notation).
Definition: allocator.h:12
allocator.h