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 | |
Baptiste Lepilleur | 45c499d | 2009-11-21 18:07:09 +0000 | [diff] [blame] | 27 | /// If defined, indicates that Json use exception to report invalid type manipulation |
| 28 | /// instead of C assert macro. |
| 29 | # define JSON_USE_EXCEPTION 1 |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 30 | |
| 31 | # ifdef JSON_IN_CPPTL |
| 32 | # include <cpptl/config.h> |
| 33 | # ifndef JSON_USE_CPPTL |
| 34 | # define JSON_USE_CPPTL 1 |
| 35 | # endif |
| 36 | # endif |
| 37 | |
| 38 | # ifdef JSON_IN_CPPTL |
| 39 | # define JSON_API CPPTL_API |
| 40 | # elif defined(JSON_DLL_BUILD) |
| 41 | # define JSON_API __declspec(dllexport) |
| 42 | # elif defined(JSON_DLL) |
| 43 | # define JSON_API __declspec(dllimport) |
| 44 | # else |
| 45 | # define JSON_API |
| 46 | # endif |
| 47 | |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 48 | // 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] | 49 | // Storages, and 64 bits integer support is disabled. |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 50 | // #define JSON_NO_INT64 1 |
| 51 | |
| 52 | #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 |
| 53 | // Microsoft Visual Studio 6 only support conversion from __int64 to double |
| 54 | // (no conversion from unsigned __int64). |
| 55 | #define JSON_USE_INT64_DOUBLE_CONVERSION 1 |
| 56 | #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 |
| 57 | |
Baptiste Lepilleur | b2e8ccc | 2011-05-01 16:27:55 +0000 | [diff] [blame] | 58 | #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 |
| 59 | /// Indicates that the following function is deprecated. |
| 60 | # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) |
| 61 | #endif |
| 62 | |
| 63 | #if !defined(JSONCPP_DEPRECATED) |
| 64 | # define JSONCPP_DEPRECATED(message) |
| 65 | #endif // if !defined(JSONCPP_DEPRECATED) |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 66 | |
| 67 | namespace Json { |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 68 | typedef int Int; |
| 69 | typedef unsigned int UInt; |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 70 | # if defined(JSON_NO_INT64) |
| 71 | typedef int LargestInt; |
| 72 | typedef unsigned int LargestUInt; |
| 73 | # undef JSON_HAS_INT64 |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 74 | # else // if defined(JSON_NO_INT64) |
| 75 | // For Microsoft Visual use specific types as long long is not supported |
| 76 | # if defined(_MSC_VER) // Microsoft Visual Studio |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 77 | typedef __int64 Int64; |
| 78 | typedef unsigned __int64 UInt64; |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 79 | # else // if defined(_MSC_VER) // Other platforms, use long long |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 80 | typedef long long int Int64; |
| 81 | typedef unsigned long long int UInt64; |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 82 | # endif // if defined(_MSC_VER) |
Baptiste Lepilleur | 842e9ac | 2010-12-27 17:45:23 +0000 | [diff] [blame] | 83 | typedef Int64 LargestInt; |
| 84 | typedef UInt64 LargestUInt; |
| 85 | # define JSON_HAS_INT64 |
Baptiste Lepilleur | 201fb2c | 2010-04-19 07:37:41 +0000 | [diff] [blame] | 86 | # endif // if defined(JSON_NO_INT64) |
| 87 | } // end namespace Json |
| 88 | |
| 89 | |
Christopher Dunn | 6d135cb | 2007-06-13 15:51:04 +0000 | [diff] [blame] | 90 | #endif // JSON_CONFIG_H_INCLUDED |