blob: 810a56bd1cd3ab0f2398a5686026fd9275e4b186 [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
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 Lepilleur53492252011-05-01 16:42:18 +000019/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
Christopher Dunn6d135cb2007-06-13 15:51:04 +000020//# 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 Jacobs7c507d72011-09-14 08:41:37 +000027// 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 Lepilleur45c499d2009-11-21 18:07:09 +000030# define JSON_USE_EXCEPTION 1
Aaron Jacobs7c507d72011-09-14 08:41:37 +000031# endif
Christopher Dunn6d135cb2007-06-13 15:51:04 +000032
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000033/// 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 Lepilleureadc4782011-05-02 21:09:30 +000036// #define JSON_IS_AMALGAMATION
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000037
38
Christopher Dunn6d135cb2007-06-13 15:51:04 +000039# 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 Lepilleureafd7022013-05-08 20:21:11 +000049# if defined(_MSC_VER)
50# define JSON_API __declspec(dllexport)
51# define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
52# endif // if defined(_MSC_VER)
Christopher Dunn6d135cb2007-06-13 15:51:04 +000053# elif defined(JSON_DLL)
Baptiste Lepilleureafd7022013-05-08 20:21:11 +000054# 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 Dunn6d135cb2007-06-13 15:51:04 +000060# define JSON_API
61# endif
62
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000063// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +000064// Storages, and 64 bits integer support is disabled.
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000065// #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
Baptiste Lepilleur7b62cea2013-05-09 16:24:13 +000071// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' characters in the debug information)
72// All projects I've ever seen with VS6 were using this globally (not bothering with pragma push/pop).
73#pragma warning(disable : 4786)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000074#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
75
Baptiste Lepilleurb2e8ccc2011-05-01 16:27:55 +000076#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
77/// Indicates that the following function is deprecated.
78# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
79#endif
80
81#if !defined(JSONCPP_DEPRECATED)
82# define JSONCPP_DEPRECATED(message)
83#endif // if !defined(JSONCPP_DEPRECATED)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000084
85namespace Json {
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000086 typedef int Int;
87 typedef unsigned int UInt;
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +000088# if defined(JSON_NO_INT64)
89 typedef int LargestInt;
90 typedef unsigned int LargestUInt;
91# undef JSON_HAS_INT64
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000092# else // if defined(JSON_NO_INT64)
93 // For Microsoft Visual use specific types as long long is not supported
94# if defined(_MSC_VER) // Microsoft Visual Studio
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +000095 typedef __int64 Int64;
96 typedef unsigned __int64 UInt64;
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000097# else // if defined(_MSC_VER) // Other platforms, use long long
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +000098 typedef long long int Int64;
99 typedef unsigned long long int UInt64;
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +0000100# endif // if defined(_MSC_VER)
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +0000101 typedef Int64 LargestInt;
102 typedef UInt64 LargestUInt;
103# define JSON_HAS_INT64
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +0000104# endif // if defined(JSON_NO_INT64)
105} // end namespace Json
106
107
Christopher Dunn6d135cb2007-06-13 15:51:04 +0000108#endif // JSON_CONFIG_H_INCLUDED