![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
json test
jsoncpp/include/json/config.h@0:2ee762ea11b3, 2018-01-26 (annotated)
- Committer:
- tgw
- Date:
- Fri Jan 26 06:05:31 2018 +0000
- Revision:
- 0:2ee762ea11b3
json
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tgw | 0:2ee762ea11b3 | 1 | // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors |
tgw | 0:2ee762ea11b3 | 2 | // Distributed under MIT license, or public domain if desired and |
tgw | 0:2ee762ea11b3 | 3 | // recognized in your jurisdiction. |
tgw | 0:2ee762ea11b3 | 4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE |
tgw | 0:2ee762ea11b3 | 5 | |
tgw | 0:2ee762ea11b3 | 6 | #ifndef JSON_CONFIG_H_INCLUDED |
tgw | 0:2ee762ea11b3 | 7 | #define JSON_CONFIG_H_INCLUDED |
tgw | 0:2ee762ea11b3 | 8 | #include <stddef.h> |
tgw | 0:2ee762ea11b3 | 9 | #include <string> //typedef String |
tgw | 0:2ee762ea11b3 | 10 | #include <stdint.h> //typedef int64_t, uint64_t |
tgw | 0:2ee762ea11b3 | 11 | |
tgw | 0:2ee762ea11b3 | 12 | /// If defined, indicates that json library is embedded in CppTL library. |
tgw | 0:2ee762ea11b3 | 13 | //# define JSON_IN_CPPTL 1 |
tgw | 0:2ee762ea11b3 | 14 | |
tgw | 0:2ee762ea11b3 | 15 | /// If defined, indicates that json may leverage CppTL library |
tgw | 0:2ee762ea11b3 | 16 | //# define JSON_USE_CPPTL 1 |
tgw | 0:2ee762ea11b3 | 17 | /// If defined, indicates that cpptl vector based map should be used instead of |
tgw | 0:2ee762ea11b3 | 18 | /// std::map |
tgw | 0:2ee762ea11b3 | 19 | /// as Value container. |
tgw | 0:2ee762ea11b3 | 20 | //# define JSON_USE_CPPTL_SMALLMAP 1 |
tgw | 0:2ee762ea11b3 | 21 | |
tgw | 0:2ee762ea11b3 | 22 | // If non-zero, the library uses exceptions to report bad input instead of C |
tgw | 0:2ee762ea11b3 | 23 | // assertion macros. The default is to use exceptions. |
tgw | 0:2ee762ea11b3 | 24 | #ifndef JSON_USE_EXCEPTION |
tgw | 0:2ee762ea11b3 | 25 | #define JSON_USE_EXCEPTION 1 |
tgw | 0:2ee762ea11b3 | 26 | #endif |
tgw | 0:2ee762ea11b3 | 27 | |
tgw | 0:2ee762ea11b3 | 28 | /// If defined, indicates that the source file is amalgamated |
tgw | 0:2ee762ea11b3 | 29 | /// to prevent private header inclusion. |
tgw | 0:2ee762ea11b3 | 30 | /// Remarks: it is automatically defined in the generated amalgamated header. |
tgw | 0:2ee762ea11b3 | 31 | // #define JSON_IS_AMALGAMATION |
tgw | 0:2ee762ea11b3 | 32 | |
tgw | 0:2ee762ea11b3 | 33 | #ifdef JSON_IN_CPPTL |
tgw | 0:2ee762ea11b3 | 34 | #include <cpptl/config.h> |
tgw | 0:2ee762ea11b3 | 35 | #ifndef JSON_USE_CPPTL |
tgw | 0:2ee762ea11b3 | 36 | #define JSON_USE_CPPTL 1 |
tgw | 0:2ee762ea11b3 | 37 | #endif |
tgw | 0:2ee762ea11b3 | 38 | #endif |
tgw | 0:2ee762ea11b3 | 39 | |
tgw | 0:2ee762ea11b3 | 40 | #ifdef JSON_IN_CPPTL |
tgw | 0:2ee762ea11b3 | 41 | #define JSON_API CPPTL_API |
tgw | 0:2ee762ea11b3 | 42 | #elif defined(JSON_DLL_BUILD) |
tgw | 0:2ee762ea11b3 | 43 | #if defined(_MSC_VER) || defined(__MINGW32__) |
tgw | 0:2ee762ea11b3 | 44 | #define JSON_API __declspec(dllexport) |
tgw | 0:2ee762ea11b3 | 45 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING |
tgw | 0:2ee762ea11b3 | 46 | #endif // if defined(_MSC_VER) |
tgw | 0:2ee762ea11b3 | 47 | #elif defined(JSON_DLL) |
tgw | 0:2ee762ea11b3 | 48 | #if defined(_MSC_VER) || defined(__MINGW32__) |
tgw | 0:2ee762ea11b3 | 49 | #define JSON_API __declspec(dllimport) |
tgw | 0:2ee762ea11b3 | 50 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING |
tgw | 0:2ee762ea11b3 | 51 | #endif // if defined(_MSC_VER) |
tgw | 0:2ee762ea11b3 | 52 | #endif // ifdef JSON_IN_CPPTL |
tgw | 0:2ee762ea11b3 | 53 | #if !defined(JSON_API) |
tgw | 0:2ee762ea11b3 | 54 | #define JSON_API |
tgw | 0:2ee762ea11b3 | 55 | #endif |
tgw | 0:2ee762ea11b3 | 56 | |
tgw | 0:2ee762ea11b3 | 57 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for |
tgw | 0:2ee762ea11b3 | 58 | // integer |
tgw | 0:2ee762ea11b3 | 59 | // Storages, and 64 bits integer support is disabled. |
tgw | 0:2ee762ea11b3 | 60 | // #define JSON_NO_INT64 1 |
tgw | 0:2ee762ea11b3 | 61 | |
tgw | 0:2ee762ea11b3 | 62 | #if defined(_MSC_VER) // MSVC |
tgw | 0:2ee762ea11b3 | 63 | # if _MSC_VER <= 1200 // MSVC 6 |
tgw | 0:2ee762ea11b3 | 64 | // Microsoft Visual Studio 6 only support conversion from __int64 to double |
tgw | 0:2ee762ea11b3 | 65 | // (no conversion from unsigned __int64). |
tgw | 0:2ee762ea11b3 | 66 | # define JSON_USE_INT64_DOUBLE_CONVERSION 1 |
tgw | 0:2ee762ea11b3 | 67 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' |
tgw | 0:2ee762ea11b3 | 68 | // characters in the debug information) |
tgw | 0:2ee762ea11b3 | 69 | // All projects I've ever seen with VS6 were using this globally (not bothering |
tgw | 0:2ee762ea11b3 | 70 | // with pragma push/pop). |
tgw | 0:2ee762ea11b3 | 71 | # pragma warning(disable : 4786) |
tgw | 0:2ee762ea11b3 | 72 | # endif // MSVC 6 |
tgw | 0:2ee762ea11b3 | 73 | |
tgw | 0:2ee762ea11b3 | 74 | # if _MSC_VER >= 1500 // MSVC 2008 |
tgw | 0:2ee762ea11b3 | 75 | /// Indicates that the following function is deprecated. |
tgw | 0:2ee762ea11b3 | 76 | # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) |
tgw | 0:2ee762ea11b3 | 77 | # endif |
tgw | 0:2ee762ea11b3 | 78 | |
tgw | 0:2ee762ea11b3 | 79 | #endif // defined(_MSC_VER) |
tgw | 0:2ee762ea11b3 | 80 | |
tgw | 0:2ee762ea11b3 | 81 | // In c++11 the override keyword allows you to explicitly define that a function |
tgw | 0:2ee762ea11b3 | 82 | // is intended to override the base-class version. This makes the code more |
tgw | 0:2ee762ea11b3 | 83 | // managable and fixes a set of common hard-to-find bugs. |
tgw | 0:2ee762ea11b3 | 84 | #if __cplusplus >= 201103L |
tgw | 0:2ee762ea11b3 | 85 | # define JSONCPP_OVERRIDE override |
tgw | 0:2ee762ea11b3 | 86 | # define JSONCPP_NOEXCEPT noexcept |
tgw | 0:2ee762ea11b3 | 87 | #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 |
tgw | 0:2ee762ea11b3 | 88 | # define JSONCPP_OVERRIDE override |
tgw | 0:2ee762ea11b3 | 89 | # define JSONCPP_NOEXCEPT throw() |
tgw | 0:2ee762ea11b3 | 90 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 |
tgw | 0:2ee762ea11b3 | 91 | # define JSONCPP_OVERRIDE override |
tgw | 0:2ee762ea11b3 | 92 | # define JSONCPP_NOEXCEPT noexcept |
tgw | 0:2ee762ea11b3 | 93 | #else |
tgw | 0:2ee762ea11b3 | 94 | # define JSONCPP_OVERRIDE |
tgw | 0:2ee762ea11b3 | 95 | # define JSONCPP_NOEXCEPT throw() |
tgw | 0:2ee762ea11b3 | 96 | #endif |
tgw | 0:2ee762ea11b3 | 97 | |
tgw | 0:2ee762ea11b3 | 98 | #ifndef JSON_HAS_RVALUE_REFERENCES |
tgw | 0:2ee762ea11b3 | 99 | |
tgw | 0:2ee762ea11b3 | 100 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 |
tgw | 0:2ee762ea11b3 | 101 | #define JSON_HAS_RVALUE_REFERENCES 1 |
tgw | 0:2ee762ea11b3 | 102 | #endif // MSVC >= 2010 |
tgw | 0:2ee762ea11b3 | 103 | |
tgw | 0:2ee762ea11b3 | 104 | #ifdef __clang__ |
tgw | 0:2ee762ea11b3 | 105 | #if __has_feature(cxx_rvalue_references) |
tgw | 0:2ee762ea11b3 | 106 | #define JSON_HAS_RVALUE_REFERENCES 1 |
tgw | 0:2ee762ea11b3 | 107 | #endif // has_feature |
tgw | 0:2ee762ea11b3 | 108 | |
tgw | 0:2ee762ea11b3 | 109 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) |
tgw | 0:2ee762ea11b3 | 110 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) |
tgw | 0:2ee762ea11b3 | 111 | #define JSON_HAS_RVALUE_REFERENCES 1 |
tgw | 0:2ee762ea11b3 | 112 | #endif // GXX_EXPERIMENTAL |
tgw | 0:2ee762ea11b3 | 113 | |
tgw | 0:2ee762ea11b3 | 114 | #endif // __clang__ || __GNUC__ |
tgw | 0:2ee762ea11b3 | 115 | |
tgw | 0:2ee762ea11b3 | 116 | #endif // not defined JSON_HAS_RVALUE_REFERENCES |
tgw | 0:2ee762ea11b3 | 117 | |
tgw | 0:2ee762ea11b3 | 118 | #ifndef JSON_HAS_RVALUE_REFERENCES |
tgw | 0:2ee762ea11b3 | 119 | #define JSON_HAS_RVALUE_REFERENCES 0 |
tgw | 0:2ee762ea11b3 | 120 | #endif |
tgw | 0:2ee762ea11b3 | 121 | |
tgw | 0:2ee762ea11b3 | 122 | #ifdef __clang__ |
tgw | 0:2ee762ea11b3 | 123 | # if __has_extension(attribute_deprecated_with_message) |
tgw | 0:2ee762ea11b3 | 124 | # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) |
tgw | 0:2ee762ea11b3 | 125 | # endif |
tgw | 0:2ee762ea11b3 | 126 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) |
tgw | 0:2ee762ea11b3 | 127 | # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) |
tgw | 0:2ee762ea11b3 | 128 | # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) |
tgw | 0:2ee762ea11b3 | 129 | # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) |
tgw | 0:2ee762ea11b3 | 130 | # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) |
tgw | 0:2ee762ea11b3 | 131 | # endif // GNUC version |
tgw | 0:2ee762ea11b3 | 132 | #endif // __clang__ || __GNUC__ |
tgw | 0:2ee762ea11b3 | 133 | |
tgw | 0:2ee762ea11b3 | 134 | #if !defined(JSONCPP_DEPRECATED) |
tgw | 0:2ee762ea11b3 | 135 | #define JSONCPP_DEPRECATED(message) |
tgw | 0:2ee762ea11b3 | 136 | #endif // if !defined(JSONCPP_DEPRECATED) |
tgw | 0:2ee762ea11b3 | 137 | |
tgw | 0:2ee762ea11b3 | 138 | #if __GNUC__ >= 6 |
tgw | 0:2ee762ea11b3 | 139 | # define JSON_USE_INT64_DOUBLE_CONVERSION 1 |
tgw | 0:2ee762ea11b3 | 140 | #endif |
tgw | 0:2ee762ea11b3 | 141 | |
tgw | 0:2ee762ea11b3 | 142 | #if !defined(JSON_IS_AMALGAMATION) |
tgw | 0:2ee762ea11b3 | 143 | |
tgw | 0:2ee762ea11b3 | 144 | # include "version.h" |
tgw | 0:2ee762ea11b3 | 145 | |
tgw | 0:2ee762ea11b3 | 146 | # if JSONCPP_USING_SECURE_MEMORY |
tgw | 0:2ee762ea11b3 | 147 | # include "allocator.h" //typedef Allocator |
tgw | 0:2ee762ea11b3 | 148 | # endif |
tgw | 0:2ee762ea11b3 | 149 | |
tgw | 0:2ee762ea11b3 | 150 | #endif // if !defined(JSON_IS_AMALGAMATION) |
tgw | 0:2ee762ea11b3 | 151 | |
tgw | 0:2ee762ea11b3 | 152 | namespace Json { |
tgw | 0:2ee762ea11b3 | 153 | typedef int Int; |
tgw | 0:2ee762ea11b3 | 154 | typedef unsigned int UInt; |
tgw | 0:2ee762ea11b3 | 155 | #if defined(JSON_NO_INT64) |
tgw | 0:2ee762ea11b3 | 156 | typedef int LargestInt; |
tgw | 0:2ee762ea11b3 | 157 | typedef unsigned int LargestUInt; |
tgw | 0:2ee762ea11b3 | 158 | #undef JSON_HAS_INT64 |
tgw | 0:2ee762ea11b3 | 159 | #else // if defined(JSON_NO_INT64) |
tgw | 0:2ee762ea11b3 | 160 | // For Microsoft Visual use specific types as long long is not supported |
tgw | 0:2ee762ea11b3 | 161 | #if defined(_MSC_VER) // Microsoft Visual Studio |
tgw | 0:2ee762ea11b3 | 162 | typedef __int64 Int64; |
tgw | 0:2ee762ea11b3 | 163 | typedef unsigned __int64 UInt64; |
tgw | 0:2ee762ea11b3 | 164 | #else // if defined(_MSC_VER) // Other platforms, use long long |
tgw | 0:2ee762ea11b3 | 165 | typedef int64_t Int64; |
tgw | 0:2ee762ea11b3 | 166 | typedef uint64_t UInt64; |
tgw | 0:2ee762ea11b3 | 167 | #endif // if defined(_MSC_VER) |
tgw | 0:2ee762ea11b3 | 168 | typedef Int64 LargestInt; |
tgw | 0:2ee762ea11b3 | 169 | typedef UInt64 LargestUInt; |
tgw | 0:2ee762ea11b3 | 170 | #define JSON_HAS_INT64 |
tgw | 0:2ee762ea11b3 | 171 | #endif // if defined(JSON_NO_INT64) |
tgw | 0:2ee762ea11b3 | 172 | #if JSONCPP_USING_SECURE_MEMORY |
tgw | 0:2ee762ea11b3 | 173 | #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> > |
tgw | 0:2ee762ea11b3 | 174 | #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> > |
tgw | 0:2ee762ea11b3 | 175 | #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>> |
tgw | 0:2ee762ea11b3 | 176 | #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> > |
tgw | 0:2ee762ea11b3 | 177 | #define JSONCPP_ISTREAM std::istream |
tgw | 0:2ee762ea11b3 | 178 | #else |
tgw | 0:2ee762ea11b3 | 179 | #define JSONCPP_STRING std::string |
tgw | 0:2ee762ea11b3 | 180 | #define JSONCPP_OSTRINGSTREAM std::ostringstream |
tgw | 0:2ee762ea11b3 | 181 | #define JSONCPP_OSTREAM std::ostream |
tgw | 0:2ee762ea11b3 | 182 | #define JSONCPP_ISTRINGSTREAM std::istringstream |
tgw | 0:2ee762ea11b3 | 183 | #define JSONCPP_ISTREAM std::istream |
tgw | 0:2ee762ea11b3 | 184 | #endif // if JSONCPP_USING_SECURE_MEMORY |
tgw | 0:2ee762ea11b3 | 185 | } // end namespace Json |
tgw | 0:2ee762ea11b3 | 186 | |
tgw | 0:2ee762ea11b3 | 187 | #endif // JSON_CONFIG_H_INCLUDED |