Baptiste Lepilleur | 7469f1d | 2010-04-20 21:35:19 +0000 | [diff] [blame] | 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 | |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 6 | #ifndef JSON_CONFIG_H_INCLUDED |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 7 | #define JSON_CONFIG_H_INCLUDED |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 8 | |
| 9 | /// If defined, indicates that json library is embedded in CppTL library. |
| 10 | //# define JSON_IN_CPPTL 1 |
| 11 | |
| 12 | /// If defined, indicates that json may leverage CppTL library |
| 13 | //# define JSON_USE_CPPTL 1 |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 14 | /// If defined, indicates that cpptl vector based map should be used instead of |
| 15 | /// std::map |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 16 | /// as Value container. |
| 17 | //# define JSON_USE_CPPTL_SMALLMAP 1 |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 18 | |
Aaron Jacobs | 7c507d7 | 2011-09-14 08:41:37 +0000 | [diff] [blame] | 19 | // If non-zero, the library uses exceptions to report bad input instead of C |
| 20 | // assertion macros. The default is to use exceptions. |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 21 | #ifndef JSON_USE_EXCEPTION |
| 22 | #define JSON_USE_EXCEPTION 1 |
| 23 | #endif |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 24 | |
Baptiste Lepilleur | 64e40aa | 2011-05-01 20:13:40 +0000 | [diff] [blame] | 25 | /// If defined, indicates that the source file is amalgated |
| 26 | /// to prevent private header inclusion. |
| 27 | /// Remarks: it is automatically defined in the generated amalgated header. |
Baptiste Lepilleur | eadc478 | 2011-05-02 21:09:30 +0000 | [diff] [blame] | 28 | // #define JSON_IS_AMALGAMATION |
Baptiste Lepilleur | 64e40aa | 2011-05-01 20:13:40 +0000 | [diff] [blame] | 29 | |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 30 | #ifdef JSON_IN_CPPTL |
| 31 | #include <cpptl/config.h> |
| 32 | #ifndef JSON_USE_CPPTL |
| 33 | #define JSON_USE_CPPTL 1 |
| 34 | #endif |
| 35 | #endif |
Baptiste Lepilleur | 64e40aa | 2011-05-01 20:13:40 +0000 | [diff] [blame] | 36 | |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 37 | #ifdef JSON_IN_CPPTL |
| 38 | #define JSON_API CPPTL_API |
| 39 | #elif defined(JSON_DLL_BUILD) |
| 40 | #if defined(_MSC_VER) |
| 41 | #define JSON_API __declspec(dllexport) |
| 42 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING |
| 43 | #endif // if defined(_MSC_VER) |
| 44 | #elif defined(JSON_DLL) |
| 45 | #if defined(_MSC_VER) |
| 46 | #define JSON_API __declspec(dllimport) |
| 47 | #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING |
| 48 | #endif // if defined(_MSC_VER) |
| 49 | #endif // ifdef JSON_IN_CPPTL |
| 50 | #if !defined(JSON_API) |
| 51 | #define JSON_API |
| 52 | #endif |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 53 | |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 54 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for |
| 55 | // integer |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 56 | // Storages, and 64 bits integer support is disabled. |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 57 | // #define JSON_NO_INT64 1 |
| 58 | |
Motti | 2b00891 | 2015-04-20 17:44:47 +0300 | [diff] [blame] | 59 | #if defined(_MSC_VER) // MSVC |
| 60 | # if _MSC_VER <= 1200 // MSVC 6 |
Christopher Dunn | a4ce282 | 2015-10-19 23:40:47 -0500 | [diff] [blame] | 61 | // Microsoft Visual Studio 6 only support conversion from __int64 to double |
| 62 | // (no conversion from unsigned __int64). |
Motti | 2b00891 | 2015-04-20 17:44:47 +0300 | [diff] [blame] | 63 | # define JSON_USE_INT64_DOUBLE_CONVERSION 1 |
Christopher Dunn | a4ce282 | 2015-10-19 23:40:47 -0500 | [diff] [blame] | 64 | // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' |
| 65 | // characters in the debug information) |
| 66 | // All projects I've ever seen with VS6 were using this globally (not bothering |
| 67 | // with pragma push/pop). |
| 68 | # pragma warning(disable : 4786) |
Motti | 2b00891 | 2015-04-20 17:44:47 +0300 | [diff] [blame] | 69 | # endif // MSVC 6 |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 70 | |
Motti | 2b00891 | 2015-04-20 17:44:47 +0300 | [diff] [blame] | 71 | # if _MSC_VER >= 1500 // MSVC 2008 |
Christopher Dunn | a4ce282 | 2015-10-19 23:40:47 -0500 | [diff] [blame] | 72 | /// Indicates that the following function is deprecated. |
Motti | 2b00891 | 2015-04-20 17:44:47 +0300 | [diff] [blame] | 73 | # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) |
| 74 | # endif |
| 75 | |
| 76 | #endif // defined(_MSC_VER) |
| 77 | |
| 78 | |
| 79 | #ifndef JSON_HAS_RVALUE_REFERENCES |
| 80 | |
| 81 | #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 |
| 82 | #define JSON_HAS_RVALUE_REFERENCES 1 |
| 83 | #endif // MSVC >= 2010 |
| 84 | |
| 85 | #ifdef __clang__ |
| 86 | #if __has_feature(cxx_rvalue_references) |
| 87 | #define JSON_HAS_RVALUE_REFERENCES 1 |
| 88 | #endif // has_feature |
| 89 | |
| 90 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) |
| 91 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) |
| 92 | #define JSON_HAS_RVALUE_REFERENCES 1 |
| 93 | #endif // GXX_EXPERIMENTAL |
| 94 | |
| 95 | #endif // __clang__ || __GNUC__ |
| 96 | |
| 97 | #endif // not defined JSON_HAS_RVALUE_REFERENCES |
| 98 | |
| 99 | #ifndef JSON_HAS_RVALUE_REFERENCES |
| 100 | #define JSON_HAS_RVALUE_REFERENCES 0 |
Dani-Hub | 5003983 | 2015-03-08 18:48:24 +0100 | [diff] [blame] | 101 | #endif |
Motti | 2b00891 | 2015-04-20 17:44:47 +0300 | [diff] [blame] | 102 | |
| 103 | #ifdef __clang__ |
| 104 | #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) |
| 105 | # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) |
| 106 | # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) |
| 107 | # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) |
| 108 | # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) |
| 109 | # endif // GNUC version |
| 110 | #endif // __clang__ || __GNUC__ |
Baptiste Lepilleur | b2e8ccc | 2011-05-01 16:27:55 +0000 | [diff] [blame] | 111 | |
| 112 | #if !defined(JSONCPP_DEPRECATED) |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 113 | #define JSONCPP_DEPRECATED(message) |
Baptiste Lepilleur | b2e8ccc | 2011-05-01 16:27:55 +0000 | [diff] [blame] | 114 | #endif // if !defined(JSONCPP_DEPRECATED) |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 115 | |
| 116 | namespace Json { |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 117 | typedef int Int; |
| 118 | typedef unsigned int UInt; |
| 119 | #if defined(JSON_NO_INT64) |
| 120 | typedef int LargestInt; |
| 121 | typedef unsigned int LargestUInt; |
| 122 | #undef JSON_HAS_INT64 |
| 123 | #else // if defined(JSON_NO_INT64) |
| 124 | // For Microsoft Visual use specific types as long long is not supported |
| 125 | #if defined(_MSC_VER) // Microsoft Visual Studio |
| 126 | typedef __int64 Int64; |
| 127 | typedef unsigned __int64 UInt64; |
| 128 | #else // if defined(_MSC_VER) // Other platforms, use long long |
| 129 | typedef long long int Int64; |
| 130 | typedef unsigned long long int UInt64; |
Aaron Jacobs | 3a0c4fc | 2014-07-01 09:20:48 +1000 | [diff] [blame] | 131 | #endif // if defined(_MSC_VER) |
Aaron Jacobs | 9fa4e84 | 2014-07-01 08:48:54 +1000 | [diff] [blame] | 132 | typedef Int64 LargestInt; |
| 133 | typedef UInt64 LargestUInt; |
| 134 | #define JSON_HAS_INT64 |
| 135 | #endif // if defined(JSON_NO_INT64) |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 136 | } // end namespace Json |
| 137 | |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 138 | #endif // JSON_CONFIG_H_INCLUDED |