blob: 51027dd8fc6a40dfe7a2a6138df942d8f073cb4d [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 Dunn779d8a32016-02-06 09:49:29 -06008#include <stddef.h>
Christopher Dunn6d135cb2007-06-13 15:51:04 +00009
10/// If defined, indicates that json library is embedded in CppTL library.
11//# define JSON_IN_CPPTL 1
12
13/// If defined, indicates that json may leverage CppTL library
14//# define JSON_USE_CPPTL 1
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100015/// If defined, indicates that cpptl vector based map should be used instead of
16/// std::map
Christopher Dunn6d135cb2007-06-13 15:51:04 +000017/// as Value container.
18//# define JSON_USE_CPPTL_SMALLMAP 1
Christopher Dunn6d135cb2007-06-13 15:51:04 +000019
Aaron Jacobs7c507d72011-09-14 08:41:37 +000020// If non-zero, the library uses exceptions to report bad input instead of C
21// assertion macros. The default is to use exceptions.
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100022#ifndef JSON_USE_EXCEPTION
23#define JSON_USE_EXCEPTION 1
24#endif
Christopher Dunn6d135cb2007-06-13 15:51:04 +000025
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000026/// If defined, indicates that the source file is amalgated
27/// to prevent private header inclusion.
28/// Remarks: it is automatically defined in the generated amalgated header.
Baptiste Lepilleureadc4782011-05-02 21:09:30 +000029// #define JSON_IS_AMALGAMATION
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000030
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100031#ifdef JSON_IN_CPPTL
32#include <cpptl/config.h>
33#ifndef JSON_USE_CPPTL
34#define JSON_USE_CPPTL 1
35#endif
36#endif
Baptiste Lepilleur64e40aa2011-05-01 20:13:40 +000037
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100038#ifdef JSON_IN_CPPTL
39#define JSON_API CPPTL_API
40#elif defined(JSON_DLL_BUILD)
41#if defined(_MSC_VER)
42#define JSON_API __declspec(dllexport)
43#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
44#endif // if defined(_MSC_VER)
45#elif defined(JSON_DLL)
46#if defined(_MSC_VER)
47#define JSON_API __declspec(dllimport)
48#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
49#endif // if defined(_MSC_VER)
50#endif // ifdef JSON_IN_CPPTL
51#if !defined(JSON_API)
52#define JSON_API
53#endif
Christopher Dunn6d135cb2007-06-13 15:51:04 +000054
Aaron Jacobs9fa4e842014-07-01 08:48:54 +100055// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
56// integer
Baptiste Lepilleur842e9ac2010-12-27 17:45:23 +000057// Storages, and 64 bits integer support is disabled.
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000058// #define JSON_NO_INT64 1
59
Motti2b008912015-04-20 17:44:47 +030060#if defined(_MSC_VER) // MSVC
61# if _MSC_VER <= 1200 // MSVC 6
Christopher Dunna4ce2822015-10-19 23:40:47 -050062 // Microsoft Visual Studio 6 only support conversion from __int64 to double
63 // (no conversion from unsigned __int64).
Motti2b008912015-04-20 17:44:47 +030064# define JSON_USE_INT64_DOUBLE_CONVERSION 1
Christopher Dunna4ce2822015-10-19 23:40:47 -050065 // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
66 // characters in the debug information)
67 // All projects I've ever seen with VS6 were using this globally (not bothering
68 // with pragma push/pop).
69# pragma warning(disable : 4786)
Motti2b008912015-04-20 17:44:47 +030070# endif // MSVC 6
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +000071
Motti2b008912015-04-20 17:44:47 +030072# if _MSC_VER >= 1500 // MSVC 2008
Christopher Dunna4ce2822015-10-19 23:40:47 -050073 /// Indicates that the following function is deprecated.
Motti2b008912015-04-20 17:44:47 +030074# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
75# endif
76
77#endif // defined(_MSC_VER)
78
79
80#ifndef JSON_HAS_RVALUE_REFERENCES
81
82#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
83#define JSON_HAS_RVALUE_REFERENCES 1
84#endif // MSVC >= 2010
85
86#ifdef __clang__
87#if __has_feature(cxx_rvalue_references)
88#define JSON_HAS_RVALUE_REFERENCES 1
89#endif // has_feature
90
91#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
92#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
93#define JSON_HAS_RVALUE_REFERENCES 1
94#endif // GXX_EXPERIMENTAL
95
96#endif // __clang__ || __GNUC__
97
98#endif // not defined JSON_HAS_RVALUE_REFERENCES
99
100#ifndef JSON_HAS_RVALUE_REFERENCES
101#define JSON_HAS_RVALUE_REFERENCES 0
Dani-Hub50039832015-03-08 18:48:24 +0100102#endif
Motti2b008912015-04-20 17:44:47 +0300103
104#ifdef __clang__
105#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
106# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
107# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
108# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
109# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
110# endif // GNUC version
111#endif // __clang__ || __GNUC__
Baptiste Lepilleurb2e8ccc2011-05-01 16:27:55 +0000112
113#if !defined(JSONCPP_DEPRECATED)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000114#define JSONCPP_DEPRECATED(message)
Baptiste Lepilleurb2e8ccc2011-05-01 16:27:55 +0000115#endif // if !defined(JSONCPP_DEPRECATED)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +0000116
Christopher Dunn95f120f2016-02-07 11:09:41 -0600117#if __GNUC__ >= 6
118# define JSON_USE_INT64_DOUBLE_CONVERSION 1
119#endif
120
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +0000121namespace Json {
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000122typedef int Int;
123typedef unsigned int UInt;
124#if defined(JSON_NO_INT64)
125typedef int LargestInt;
126typedef unsigned int LargestUInt;
127#undef JSON_HAS_INT64
128#else // if defined(JSON_NO_INT64)
129// For Microsoft Visual use specific types as long long is not supported
130#if defined(_MSC_VER) // Microsoft Visual Studio
131typedef __int64 Int64;
132typedef unsigned __int64 UInt64;
133#else // if defined(_MSC_VER) // Other platforms, use long long
134typedef long long int Int64;
135typedef unsigned long long int UInt64;
Aaron Jacobs3a0c4fc2014-07-01 09:20:48 +1000136#endif // if defined(_MSC_VER)
Aaron Jacobs9fa4e842014-07-01 08:48:54 +1000137typedef Int64 LargestInt;
138typedef UInt64 LargestUInt;
139#define JSON_HAS_INT64
140#endif // if defined(JSON_NO_INT64)
Baptiste Lepilleur201fb2c2010-04-19 07:37:41 +0000141} // end namespace Json
142
Christopher Dunn6d135cb2007-06-13 15:51:04 +0000143#endif // JSON_CONFIG_H_INCLUDED