json test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config.h Source File

config.h

00001 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
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> //typedef String
00010 #include <stdint.h> //typedef int64_t, uint64_t
00011 
00012 /// If defined, indicates that json library is embedded in CppTL library.
00013 //# define JSON_IN_CPPTL 1
00014 
00015 /// If defined, indicates that json may leverage CppTL library
00016 //#  define JSON_USE_CPPTL 1
00017 /// If defined, indicates that cpptl vector based map should be used instead of
00018 /// std::map
00019 /// as Value container.
00020 //#  define JSON_USE_CPPTL_SMALLMAP 1
00021 
00022 // If non-zero, the library uses exceptions to report bad input instead of C
00023 // assertion macros. The default is to use exceptions.
00024 #ifndef JSON_USE_EXCEPTION
00025 #define JSON_USE_EXCEPTION 1
00026 #endif
00027 
00028 /// If defined, indicates that the source file is amalgamated
00029 /// to prevent private header inclusion.
00030 /// Remarks: it is automatically defined in the generated amalgamated header.
00031 // #define JSON_IS_AMALGAMATION
00032 
00033 #ifdef JSON_IN_CPPTL
00034 #include <cpptl/config.h>
00035 #ifndef JSON_USE_CPPTL
00036 #define JSON_USE_CPPTL 1
00037 #endif
00038 #endif
00039 
00040 #ifdef JSON_IN_CPPTL
00041 #define JSON_API CPPTL_API
00042 #elif defined(JSON_DLL_BUILD)
00043 #if defined(_MSC_VER) || defined(__MINGW32__)
00044 #define JSON_API __declspec(dllexport)
00045 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
00046 #endif // if defined(_MSC_VER)
00047 #elif defined(JSON_DLL)
00048 #if defined(_MSC_VER) || defined(__MINGW32__)
00049 #define JSON_API __declspec(dllimport)
00050 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
00051 #endif // if defined(_MSC_VER)
00052 #endif // ifdef JSON_IN_CPPTL
00053 #if !defined(JSON_API)
00054 #define JSON_API
00055 #endif
00056 
00057 // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
00058 // integer
00059 // Storages, and 64 bits integer support is disabled.
00060 // #define JSON_NO_INT64 1
00061 
00062 #if defined(_MSC_VER) // MSVC
00063 #  if _MSC_VER <= 1200 // MSVC 6
00064     // Microsoft Visual Studio 6 only support conversion from __int64 to double
00065     // (no conversion from unsigned __int64).
00066 #    define JSON_USE_INT64_DOUBLE_CONVERSION 1
00067     // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
00068     // characters in the debug information)
00069     // All projects I've ever seen with VS6 were using this globally (not bothering
00070     // with pragma push/pop).
00071 #    pragma warning(disable : 4786)
00072 #  endif // MSVC 6
00073 
00074 #  if _MSC_VER >= 1500 // MSVC 2008
00075     /// Indicates that the following function is deprecated.
00076 #    define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
00077 #  endif
00078 
00079 #endif // defined(_MSC_VER)
00080 
00081 // In c++11 the override keyword allows you to explicitly define that a function
00082 // is intended to override the base-class version.  This makes the code more
00083 // managable and fixes a set of common hard-to-find bugs.
00084 #if __cplusplus >= 201103L
00085 # define JSONCPP_OVERRIDE override
00086 # define JSONCPP_NOEXCEPT noexcept
00087 #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
00088 # define JSONCPP_OVERRIDE override
00089 # define JSONCPP_NOEXCEPT throw()
00090 #elif defined(_MSC_VER) && _MSC_VER >= 1900
00091 # define JSONCPP_OVERRIDE override
00092 # define JSONCPP_NOEXCEPT noexcept
00093 #else
00094 # define JSONCPP_OVERRIDE
00095 # define JSONCPP_NOEXCEPT throw()
00096 #endif
00097 
00098 #ifndef JSON_HAS_RVALUE_REFERENCES
00099 
00100 #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
00101 #define JSON_HAS_RVALUE_REFERENCES 1
00102 #endif // MSVC >= 2010
00103 
00104 #ifdef __clang__
00105 #if __has_feature(cxx_rvalue_references)
00106 #define JSON_HAS_RVALUE_REFERENCES 1
00107 #endif  // has_feature
00108 
00109 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
00110 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
00111 #define JSON_HAS_RVALUE_REFERENCES 1
00112 #endif  // GXX_EXPERIMENTAL
00113 
00114 #endif // __clang__ || __GNUC__
00115 
00116 #endif // not defined JSON_HAS_RVALUE_REFERENCES
00117 
00118 #ifndef JSON_HAS_RVALUE_REFERENCES
00119 #define JSON_HAS_RVALUE_REFERENCES 0
00120 #endif
00121 
00122 #ifdef __clang__
00123 #  if __has_extension(attribute_deprecated_with_message)
00124 #    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
00125 #  endif
00126 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
00127 #  if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
00128 #    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
00129 #  elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00130 #    define JSONCPP_DEPRECATED(message)  __attribute__((__deprecated__))
00131 #  endif  // GNUC version
00132 #endif // __clang__ || __GNUC__
00133 
00134 #if !defined(JSONCPP_DEPRECATED)
00135 #define JSONCPP_DEPRECATED(message)
00136 #endif // if !defined(JSONCPP_DEPRECATED)
00137 
00138 #if __GNUC__ >= 6
00139 #  define JSON_USE_INT64_DOUBLE_CONVERSION 1
00140 #endif
00141 
00142 #if !defined(JSON_IS_AMALGAMATION)
00143 
00144 # include "version.h"
00145 
00146 # if JSONCPP_USING_SECURE_MEMORY
00147 #  include "allocator.h" //typedef Allocator
00148 # endif
00149 
00150 #endif // if !defined(JSON_IS_AMALGAMATION)
00151 
00152 namespace Json {
00153 typedef int Int;
00154 typedef unsigned int UInt;
00155 #if defined(JSON_NO_INT64)
00156 typedef int LargestInt;
00157 typedef unsigned int LargestUInt;
00158 #undef JSON_HAS_INT64
00159 #else                 // if defined(JSON_NO_INT64)
00160 // For Microsoft Visual use specific types as long long is not supported
00161 #if defined(_MSC_VER) // Microsoft Visual Studio
00162 typedef __int64 Int64;
00163 typedef unsigned __int64 UInt64;
00164 #else                 // if defined(_MSC_VER) // Other platforms, use long long
00165 typedef int64_t Int64;
00166 typedef uint64_t UInt64;
00167 #endif // if defined(_MSC_VER)
00168 typedef Int64 LargestInt;
00169 typedef UInt64 LargestUInt;
00170 #define JSON_HAS_INT64
00171 #endif // if defined(JSON_NO_INT64)
00172 #if JSONCPP_USING_SECURE_MEMORY
00173 #define JSONCPP_STRING        std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
00174 #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
00175 #define JSONCPP_OSTREAM       std::basic_ostream<char, std::char_traits<char>>
00176 #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
00177 #define JSONCPP_ISTREAM       std::istream
00178 #else
00179 #define JSONCPP_STRING        std::string
00180 #define JSONCPP_OSTRINGSTREAM std::ostringstream
00181 #define JSONCPP_OSTREAM       std::ostream
00182 #define JSONCPP_ISTRINGSTREAM std::istringstream
00183 #define JSONCPP_ISTREAM       std::istream
00184 #endif // if JSONCPP_USING_SECURE_MEMORY
00185 } // end namespace Json
00186 
00187 #endif // JSON_CONFIG_H_INCLUDED