blob: afd3a45607cfaab2c7086256344824d9ab4b8189 [file] [log] [blame]
Baptiste Lepilleur7469f1d2010-04-20 21:35:19 +00001// 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 Dunn6d135cb2007-06-13 15:51:04 +00006#ifndef JSON_CONFIG_H_INCLUDED
Aaron Jacobs9fa4e842014-07-01 08:48:54 +10007#define JSON_CONFIG_H_INCLUDED
Christopher Dunn6d135cb2007-06-13 15:51:04 +00008
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 Jacobs9fa4e842014-07-01 08:48:54 +100014/// If defined, indicates that cpptl vector based map should be used instead of
15/// std::map
Christopher Dunn6d135cb2007-06-13 15:51:04 +000016/// as Value container.
17//# define JSON_USE_CPPTL_SMALLMAP 1
18/// If defined, indicates that Json specific container should be used
19/// (hash table & simple deque container with customizable allocator).
Baptiste Lepilleur53492252011-05-01 16:42:18 +000020/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
Christopher Dunn6d135cb2007-06-13 15:51:04 +000021//# define JSON_VALUE_USE_INTERNAL_MAP 1
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100022/// Force usage of standard new/malloc based allocator instead of memory pool
23/// based allocator.
24/// The memory pools allocator used optimization (initializing Value and
25/// ValueInternalLink
Christopher Dunn6d135cb2007-06-13 15:51:04 +000026/// as if it was a POD) that may cause some validation tool to report errors.
27/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
28//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
29
Aaron Jacobs7c507d72011-09-14 08:41:37 +000030// If non-zero, the library uses exceptions to report bad input instead of C
31// assertion macros. The default is to use exceptions.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100032#ifndef JSON_USE_EXCEPTION
33#define JSON_USE_EXCEPTION 1
34#endif
Christopher Dunn6d135cb2007-06-13 15:51:04 +000035
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000036/// If defined, indicates that the source file is amalgated
37/// to prevent private header inclusion.
38/// Remarks: it is automatically defined in the generated amalgated header.
Baptiste Lepilleureadc4782011-05-02 21:09:30 +000039// #define JSON_IS_AMALGAMATION
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000040
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100041#ifdef JSON_IN_CPPTL
42#include <cpptl/config.h>
43#ifndef JSON_USE_CPPTL
44#define JSON_USE_CPPTL 1
45#endif
46#endif
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000047
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100048#ifdef JSON_IN_CPPTL
49#define JSON_API CPPTL_API
50#elif defined(JSON_DLL_BUILD)
51#if defined(_MSC_VER)
52#define JSON_API __declspec(dllexport)
53#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
54#endif // if defined(_MSC_VER)
55#elif defined(JSON_DLL)
56#if defined(_MSC_VER)
57#define JSON_API __declspec(dllimport)
58#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
59#endif // if defined(_MSC_VER)
60#endif // ifdef JSON_IN_CPPTL
61#if !defined(JSON_API)
62#define JSON_API
63#endif
Christopher Dunn6d135cb2007-06-13 15:51:04 +000064
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100065// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
66// integer
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +000067// Storages, and 64 bits integer support is disabled.
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000068// #define JSON_NO_INT64 1
69
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100070#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000071// Microsoft Visual Studio 6 only support conversion from __int64 to double
72// (no conversion from unsigned __int64).
73#define JSON_USE_INT64_DOUBLE_CONVERSION 1
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100074// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
75// characters in the debug information)
76// All projects I've ever seen with VS6 were using this globally (not bothering
77// with pragma push/pop).
Baptiste Lepilleur7b62cea2013-05-09 16:24:13 +000078#pragma warning(disable : 4786)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000079#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
80
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100081#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
Baptiste Lepilleurb2e8ccc2011-05-01 16:27:55 +000082/// Indicates that the following function is deprecated.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100083#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
Baptiste Lepilleurb2e8ccc2011-05-01 16:27:55 +000084#endif
85
86#if !defined(JSONCPP_DEPRECATED)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100087#define JSONCPP_DEPRECATED(message)
Baptiste Lepilleurb2e8ccc2011-05-01 16:27:55 +000088#endif // if !defined(JSONCPP_DEPRECATED)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000089
90namespace Json {
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100091typedef int Int;
92typedef unsigned int UInt;
93#if defined(JSON_NO_INT64)
94typedef int LargestInt;
95typedef unsigned int LargestUInt;
96#undef JSON_HAS_INT64
97#else // if defined(JSON_NO_INT64)
98// For Microsoft Visual use specific types as long long is not supported
99#if defined(_MSC_VER) // Microsoft Visual Studio
100typedef __int64 Int64;
101typedef unsigned __int64 UInt64;
102#else // if defined(_MSC_VER) // Other platforms, use long long
103typedef long long int Int64;
104typedef unsigned long long int UInt64;
Aaron Jacobs3a0c4fc2014-07-01 09:20:48 +1000105#endif // if defined(_MSC_VER)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000106typedef Int64 LargestInt;
107typedef UInt64 LargestUInt;
108#define JSON_HAS_INT64
109#endif // if defined(JSON_NO_INT64)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +0000110} // end namespace Json
111
Christopher Dunn6d135cb2007-06-13 15:51:04 +0000112#endif // JSON_CONFIG_H_INCLUDED