Path: blob/master/Utilities/cmjsoncpp/include/json/config.h
3156 views
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors1// Distributed under MIT license, or public domain if desired and2// recognized in your jurisdiction.3// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE45#ifndef JSON_CONFIG_H_INCLUDED6#define JSON_CONFIG_H_INCLUDED78#if defined(_MSC_VER)9# pragma warning(push,1)10#endif1112#include <cstddef>13#include <cstdint>14#include <istream>15#include <memory>16#include <ostream>17#include <sstream>18#include <string>19#include <type_traits>2021// If non-zero, the library uses exceptions to report bad input instead of C22// assertion macros. The default is to use exceptions.23#ifndef JSON_USE_EXCEPTION24#define JSON_USE_EXCEPTION 125#endif2627// Temporary, tracked for removal with issue #982.28#ifndef JSON_USE_NULLREF29#define JSON_USE_NULLREF 130#endif3132/// If defined, indicates that the source file is amalgamated33/// to prevent private header inclusion.34/// Remarks: it is automatically defined in the generated amalgamated header.35// #define JSON_IS_AMALGAMATION3637// Export macros for DLL visibility38#if defined(JSON_DLL_BUILD)39#if defined(_MSC_VER) || defined(__MINGW32__)40#define JSON_API __declspec(dllexport)41#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING42#elif defined(__GNUC__) || defined(__clang__)43#define JSON_API __attribute__((visibility("default")))44#endif // if defined(_MSC_VER)4546#elif defined(JSON_DLL)47#if defined(_MSC_VER) || defined(__MINGW32__)48#define JSON_API __declspec(dllimport)49#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING50#endif // if defined(_MSC_VER)51#endif // ifdef JSON_DLL_BUILD5253#if !defined(JSON_API)54#define JSON_API55#endif5657#if defined(_MSC_VER) && _MSC_VER < 180058#error \59"ERROR: Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"60#endif6162#if defined(_MSC_VER) && _MSC_VER < 190063// As recommended at64// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-201065extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,66const char* format, ...);67#define jsoncpp_snprintf msvc_pre1900_c99_snprintf68#else69#define jsoncpp_snprintf std::snprintf70#endif7172// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for73// integer74// Storages, and 64 bits integer support is disabled.75// #define JSON_NO_INT64 17677// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.78// C++11 should be used directly in JSONCPP.79#define JSONCPP_OVERRIDE override8081#ifdef __clang__82#if __has_extension(attribute_deprecated_with_message)83#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))84#endif85#elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc)86#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))87#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))88#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))89#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))90#endif // GNUC version91#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates92// MSVC)93#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))94#endif // __clang__ || __GNUC__ || _MSC_VER9596#undef JSONCPP_DEPRECATED // no deprecations in CMake copy97#if !defined(JSONCPP_DEPRECATED)98#define JSONCPP_DEPRECATED(message)99#endif // if !defined(JSONCPP_DEPRECATED)100101#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))102#define JSON_USE_INT64_DOUBLE_CONVERSION 1103#endif104105#if !defined(JSON_IS_AMALGAMATION)106107#include "allocator.h"108#include "version.h"109110#endif // if !defined(JSON_IS_AMALGAMATION)111112namespace Json {113using Int = int;114using UInt = unsigned int;115#if defined(JSON_NO_INT64)116using LargestInt = int;117using LargestUInt = unsigned int;118#undef JSON_HAS_INT64119#else // if defined(JSON_NO_INT64)120// For Microsoft Visual use specific types as long long is not supported121#if defined(_MSC_VER) // Microsoft Visual Studio122using Int64 = __int64;123using UInt64 = unsigned __int64;124#else // if defined(_MSC_VER) // Other platforms, use long long125using Int64 = int64_t;126using UInt64 = uint64_t;127#endif // if defined(_MSC_VER)128using LargestInt = Int64;129using LargestUInt = UInt64;130#define JSON_HAS_INT64131#endif // if defined(JSON_NO_INT64)132133template <typename T>134using Allocator =135typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,136std::allocator<T>>::type;137using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;138using IStringStream =139std::basic_istringstream<String::value_type, String::traits_type,140String::allocator_type>;141using OStringStream =142std::basic_ostringstream<String::value_type, String::traits_type,143String::allocator_type>;144using IStream = std::istream;145using OStream = std::ostream;146} // namespace Json147148// Legacy names (formerly macros).149using JSONCPP_STRING = Json::String;150using JSONCPP_ISTRINGSTREAM = Json::IStringStream;151using JSONCPP_OSTRINGSTREAM = Json::OStringStream;152using JSONCPP_ISTREAM = Json::IStream;153using JSONCPP_OSTREAM = Json::OStream;154155#endif // JSON_CONFIG_H_INCLUDED156157158