JsonCpp project page JsonCpp home page

include/json/config.h
Go to the documentation of this file.
00001 // Copyright 2007-2010 Baptiste Lepilleur
00002 // Distributed under MIT license, or public domain if desired and
00003 // recognized in your jurisdiction.
00004 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
00005 
00006 #ifndef JSON_CONFIG_H_INCLUDED
00007 #define JSON_CONFIG_H_INCLUDED
00008 #include <stddef.h>
00009 #include <string> //typdef String
00010 
00012 //# define JSON_IN_CPPTL 1
00013 
00015 //#  define JSON_USE_CPPTL 1
00019 //#  define JSON_USE_CPPTL_SMALLMAP 1
00020 
00021 // If non-zero, the library uses exceptions to report bad input instead of C
00022 // assertion macros. The default is to use exceptions.
00023 #ifndef JSON_USE_EXCEPTION
00024 #define JSON_USE_EXCEPTION 1
00025 #endif
00026 
00030 // #define JSON_IS_AMALGAMATION
00031 
00032 #ifdef JSON_IN_CPPTL
00033 #include <cpptl/config.h>
00034 #ifndef JSON_USE_CPPTL
00035 #define JSON_USE_CPPTL 1
00036 #endif
00037 #endif
00038 
00039 #ifdef JSON_IN_CPPTL
00040 #define JSON_API CPPTL_API
00041 #elif defined(JSON_DLL_BUILD)
00042 #if defined(_MSC_VER) || defined(__MINGW32__)
00043 #define JSON_API __declspec(dllexport)
00044 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
00045 #endif // if defined(_MSC_VER)
00046 #elif defined(JSON_DLL)
00047 #if defined(_MSC_VER) || defined(__MINGW32__)
00048 #define JSON_API __declspec(dllimport)
00049 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
00050 #endif // if defined(_MSC_VER)
00051 #endif // ifdef JSON_IN_CPPTL
00052 #if !defined(JSON_API)
00053 #define JSON_API
00054 #endif
00055 
00056 // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
00057 // integer
00058 // Storages, and 64 bits integer support is disabled.
00059 // #define JSON_NO_INT64 1
00060 
00061 #if defined(_MSC_VER) // MSVC
00062 #  if _MSC_VER <= 1200 // MSVC 6
00063     // Microsoft Visual Studio 6 only support conversion from __int64 to double
00064     // (no conversion from unsigned __int64).
00065 #    define JSON_USE_INT64_DOUBLE_CONVERSION 1
00066     // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
00067     // characters in the debug information)
00068     // All projects I've ever seen with VS6 were using this globally (not bothering
00069     // with pragma push/pop).
00070 #    pragma warning(disable : 4786)
00071 #  endif // MSVC 6
00072 
00073 #  if _MSC_VER >= 1500 // MSVC 2008
00074 
00075 #    define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
00076 #  endif
00077 
00078 #endif // defined(_MSC_VER)
00079 
00080 #if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
00081 # define JSONCPP_OVERRIDE
00082 #else
00083 # define JSONCPP_OVERRIDE override
00084 #endif // MSVC <= 2010
00085 
00086 
00087 #ifndef JSON_HAS_RVALUE_REFERENCES
00088 
00089 #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
00090 #define JSON_HAS_RVALUE_REFERENCES 1
00091 #endif // MSVC >= 2010
00092 
00093 #ifdef __clang__
00094 #if __has_feature(cxx_rvalue_references)
00095 #define JSON_HAS_RVALUE_REFERENCES 1
00096 #endif  // has_feature
00097 
00098 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
00099 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
00100 #define JSON_HAS_RVALUE_REFERENCES 1
00101 #endif  // GXX_EXPERIMENTAL
00102 
00103 #endif // __clang__ || __GNUC__
00104 
00105 #endif // not defined JSON_HAS_RVALUE_REFERENCES
00106 
00107 #ifndef JSON_HAS_RVALUE_REFERENCES
00108 #define JSON_HAS_RVALUE_REFERENCES 0
00109 #endif
00110 
00111 #ifdef __clang__
00112 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
00113 #  if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
00114 #    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
00115 #  elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00116 #    define JSONCPP_DEPRECATED(message)  __attribute__((__deprecated__))
00117 #  endif  // GNUC version
00118 #endif // __clang__ || __GNUC__
00119 
00120 #if !defined(JSONCPP_DEPRECATED)
00121 #define JSONCPP_DEPRECATED(message)
00122 #endif // if !defined(JSONCPP_DEPRECATED)
00123 
00124 #if __GNUC__ >= 6
00125 #  define JSON_USE_INT64_DOUBLE_CONVERSION 1
00126 #endif
00127 
00128 #if !defined(JSON_IS_AMALGAMATION)
00129 
00130 # include "version.h"
00131 
00132 # if JSONCPP_USING_SECURE_MEMORY
00133 #  include "allocator.h" //typedef Allocator
00134 # endif
00135 
00136 #endif // if !defined(JSON_IS_AMALGAMATION)
00137 
00138 namespace Json {
00139 typedef int Int;
00140 typedef unsigned int UInt;
00141 #if defined(JSON_NO_INT64)
00142 typedef int LargestInt;
00143 typedef unsigned int LargestUInt;
00144 #undef JSON_HAS_INT64
00145 #else                 // if defined(JSON_NO_INT64)
00146 // For Microsoft Visual use specific types as long long is not supported
00147 #if defined(_MSC_VER) // Microsoft Visual Studio
00148 typedef __int64 Int64;
00149 typedef unsigned __int64 UInt64;
00150 #else                 // if defined(_MSC_VER) // Other platforms, use long long
00151 typedef long long int Int64;
00152 typedef unsigned long long int UInt64;
00153 #endif // if defined(_MSC_VER)
00154 typedef Int64 LargestInt;
00155 typedef UInt64 LargestUInt;
00156 #define JSON_HAS_INT64
00157 #endif // if defined(JSON_NO_INT64)
00158 #if JSONCPP_USING_SECURE_MEMORY
00159 #define JSONCPP_STRING        std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
00160 #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
00161 #define JSONCPP_OSTREAM       std::basic_ostream<char, std::char_traits<char>>
00162 #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
00163 #define JSONCPP_ISTREAM       std::istream
00164 #else
00165 #define JSONCPP_STRING        std::string
00166 #define JSONCPP_OSTRINGSTREAM std::ostringstream
00167 #define JSONCPP_OSTREAM       std::ostream
00168 #define JSONCPP_ISTRINGSTREAM std::istringstream
00169 #define JSONCPP_ISTREAM       std::istream
00170 #endif // if JSONCPP_USING_SECURE_MEMORY
00171 } // end namespace Json
00172 
00173 #endif // JSON_CONFIG_H_INCLUDED