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 |
| 7 | # define JSON_CONFIG_H_INCLUDED |
| 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 |
| 14 | /// If defined, indicates that cpptl vector based map should be used instead of std::map |
| 15 | /// as Value container. |
| 16 | //# define JSON_USE_CPPTL_SMALLMAP 1 |
| 17 | /// If defined, indicates that Json specific container should be used |
| 18 | /// (hash table & simple deque container with customizable allocator). |
Baptiste Lepilleur | 5349225 | 2011-05-01 16:42:18 +0000 | [diff] [blame] | 19 | /// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332 |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 20 | //# define JSON_VALUE_USE_INTERNAL_MAP 1 |
| 21 | /// Force usage of standard new/malloc based allocator instead of memory pool based allocator. |
| 22 | /// The memory pools allocator used optimization (initializing Value and ValueInternalLink |
| 23 | /// as if it was a POD) that may cause some validation tool to report errors. |
| 24 | /// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. |
| 25 | //# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 |
| 26 | |
Aaron Jacobs | 7c507d7 | 2011-09-14 08:41:37 +0000 | [diff] [blame] | 27 | // If non-zero, the library uses exceptions to report bad input instead of C |
| 28 | // assertion macros. The default is to use exceptions. |
| 29 | # ifndef JSON_USE_EXCEPTION |
Baptiste Lepilleur | 45c499d | 2009-11-21 18:07:09 +0000 | [diff] [blame] | 30 | # define JSON_USE_EXCEPTION 1 |
Aaron Jacobs | 7c507d7 | 2011-09-14 08:41:37 +0000 | [diff] [blame] | 31 | # endif |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 32 | |
Baptiste Lepilleur | 64e40aa | 2011-05-01 20:13:40 +0000 | [diff] [blame] | 33 | /// If defined, indicates that the source file is amalgated |
| 34 | /// to prevent private header inclusion. |
| 35 | /// Remarks: it is automatically defined in the generated amalgated header. |
Baptiste Lepilleur | eadc478 | 2011-05-02 21:09:30 +0000 | [diff] [blame] | 36 | // #define JSON_IS_AMALGAMATION |
Baptiste Lepilleur | 64e40aa | 2011-05-01 20:13:40 +0000 | [diff] [blame] | 37 | |
| 38 | |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 39 | # ifdef JSON_IN_CPPTL |
| 40 | # include <cpptl/config.h> |
| 41 | # ifndef JSON_USE_CPPTL |
| 42 | # define JSON_USE_CPPTL 1 |
| 43 | # endif |
| 44 | # endif |
| 45 | |
| 46 | # ifdef JSON_IN_CPPTL |
| 47 | # define JSON_API CPPTL_API |
| 48 | # elif defined(JSON_DLL_BUILD) |
Baptiste Lepilleur | eafd702 | 2013-05-08 20:21:11 +0000 | [diff] [blame] | 49 | # if defined(_MSC_VER) |
| 50 | # define JSON_API __declspec(dllexport) |
| 51 | # define JSONCPP_DISABLE_DLL_INTERFACE_WARNING |
| 52 | # endif // if defined(_MSC_VER) |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 53 | # elif defined(JSON_DLL) |
Baptiste Lepilleur | eafd702 | 2013-05-08 20:21:11 +0000 | [diff] [blame] | 54 | # if defined(_MSC_VER) |
| 55 | # define JSON_API __declspec(dllimport) |
| 56 | # define JSONCPP_DISABLE_DLL_INTERFACE_WARNING |
| 57 | # endif // if defined(_MSC_VER) |
| 58 | # endif // ifdef JSON_IN_CPPTL |
| 59 | # if !defined(JSON_API) |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 60 | # define JSON_API |
| 61 | # endif |
| 62 | |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 63 | // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 64 | // Storages, and 64 bits integer support is disabled. |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 65 | // #define JSON_NO_INT64 1 |
| 66 | |
| 67 | #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 |
| 68 | // Microsoft Visual Studio 6 only support conversion from __int64 to double |
| 69 | // (no conversion from unsigned __int64). |
| 70 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 |
| 71 | #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 |
| 72 | |
Baptiste Lepilleur | b2e8ccc | 2011-05-01 16:27:55 +0000 | [diff] [blame] | 73 | #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 |
| 74 | /// Indicates that the following function is deprecated. |
| 75 | # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) |
| 76 | #endif |
| 77 | |
| 78 | #if !defined(JSONCPP_DEPRECATED) |
| 79 | # define JSONCPP_DEPRECATED(message) |
| 80 | #endif // if !defined(JSONCPP_DEPRECATED) |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 81 | |
| 82 | namespace Json { |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 83 | typedef int Int; |
| 84 | typedef unsigned int UInt; |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 85 | # if defined(JSON_NO_INT64) |
| 86 | typedef int LargestInt; |
| 87 | typedef unsigned int LargestUInt; |
| 88 | # undef JSON_HAS_INT64 |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 89 | # else // if defined(JSON_NO_INT64) |
| 90 | // For Microsoft Visual use specific types as long long is not supported |
| 91 | # if defined(_MSC_VER) // Microsoft Visual Studio |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 92 | typedef __int64 Int64; |
| 93 | typedef unsigned __int64 UInt64; |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 94 | # else // if defined(_MSC_VER) // Other platforms, use long long |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 95 | typedef long long int Int64; |
| 96 | typedef unsigned long long int UInt64; |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 97 | # endif // if defined(_MSC_VER) |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 98 | typedef Int64 LargestInt; |
| 99 | typedef UInt64 LargestUInt; |
| 100 | # define JSON_HAS_INT64 |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 101 | # endif // if defined(JSON_NO_INT64) |
| 102 | } // end namespace Json |
| 103 | |
| 104 | |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 105 | #endif // JSON_CONFIG_H_INCLUDED |