JsonCPP update from 0.10.6 to 1.8.0

This commit is contained in:
Loic Blot 2017-05-26 17:04:10 +02:00 committed by Loïc Blot
parent bf6569b570
commit 2362d3f926
2 changed files with 1019 additions and 465 deletions

@ -77,7 +77,7 @@ license you like.
/// If defined, indicates that the source file is amalgated /// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion. /// to prevent private header inclusion.
#define JSON_IS_AMALGAMATION #define JSON_IS_AMALGAMATION
#define JSONCPP_STRING
// ////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/version.h // Beginning of content of file: include/json/version.h
// ////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////
@ -87,13 +87,20 @@ license you like.
#ifndef JSON_VERSION_H_INCLUDED #ifndef JSON_VERSION_H_INCLUDED
# define JSON_VERSION_H_INCLUDED # define JSON_VERSION_H_INCLUDED
# define JSONCPP_VERSION_STRING "0.10.6" # define JSONCPP_VERSION_STRING "1.8.0"
# define JSONCPP_VERSION_MAJOR 0 # define JSONCPP_VERSION_MAJOR 1
# define JSONCPP_VERSION_MINOR 10 # define JSONCPP_VERSION_MINOR 8
# define JSONCPP_VERSION_PATCH 6 # define JSONCPP_VERSION_PATCH 0
# define JSONCPP_VERSION_QUALIFIER # define JSONCPP_VERSION_QUALIFIER
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
#ifdef JSONCPP_USING_SECURE_MEMORY
#undef JSONCPP_USING_SECURE_MEMORY
#endif
#define JSONCPP_USING_SECURE_MEMORY 0
// If non-zero, the library zeroes any memory that it has allocated before
// it frees its memory.
#endif // JSON_VERSION_H_INCLUDED #endif // JSON_VERSION_H_INCLUDED
// ////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////
@ -116,6 +123,9 @@ license you like.
#ifndef JSON_CONFIG_H_INCLUDED #ifndef JSON_CONFIG_H_INCLUDED
#define JSON_CONFIG_H_INCLUDED #define JSON_CONFIG_H_INCLUDED
#include <stddef.h>
#include <string> //typedef String
#include <stdint.h> //typedef int64_t, uint64_t
/// If defined, indicates that json library is embedded in CppTL library. /// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1 //# define JSON_IN_CPPTL 1
@ -148,12 +158,12 @@ license you like.
#ifdef JSON_IN_CPPTL #ifdef JSON_IN_CPPTL
#define JSON_API CPPTL_API #define JSON_API CPPTL_API
#elif defined(JSON_DLL_BUILD) #elif defined(JSON_DLL_BUILD)
#if defined(_MSC_VER) #if defined(_MSC_VER) || defined(__MINGW32__)
#define JSON_API __declspec(dllexport) #define JSON_API __declspec(dllexport)
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
#endif // if defined(_MSC_VER) #endif // if defined(_MSC_VER)
#elif defined(JSON_DLL) #elif defined(JSON_DLL)
#if defined(_MSC_VER) #if defined(_MSC_VER) || defined(__MINGW32__)
#define JSON_API __declspec(dllimport) #define JSON_API __declspec(dllimport)
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
#endif // if defined(_MSC_VER) #endif // if defined(_MSC_VER)
@ -167,7 +177,8 @@ license you like.
// Storages, and 64 bits integer support is disabled. // Storages, and 64 bits integer support is disabled.
// #define JSON_NO_INT64 1 // #define JSON_NO_INT64 1
#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 #if defined(_MSC_VER) // MSVC
# if _MSC_VER <= 1200 // MSVC 6
// Microsoft Visual Studio 6 only support conversion from __int64 to double // Microsoft Visual Studio 6 only support conversion from __int64 to double
// (no conversion from unsigned __int64). // (no conversion from unsigned __int64).
# define JSON_USE_INT64_DOUBLE_CONVERSION 1 # define JSON_USE_INT64_DOUBLE_CONVERSION 1
@ -176,25 +187,83 @@ license you like.
// All projects I've ever seen with VS6 were using this globally (not bothering // All projects I've ever seen with VS6 were using this globally (not bothering
// with pragma push/pop). // with pragma push/pop).
# pragma warning(disable : 4786) # pragma warning(disable : 4786)
#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 # endif // MSVC 6
#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 # if _MSC_VER >= 1500 // MSVC 2008
/// Indicates that the following function is deprecated. /// Indicates that the following function is deprecated.
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
#elif defined(__clang__) && defined(__has_feature)
#if __has_feature(attribute_deprecated_with_message)
#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
# endif # endif
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
#endif // defined(_MSC_VER)
// In c++11 the override keyword allows you to explicity define that a function
// is intended to override the base-class version. This makes the code more
// managable and fixes a set of common hard-to-find bugs.
#if __cplusplus >= 201103L
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT noexcept
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT throw()
#elif defined(_MSC_VER) && _MSC_VER >= 1900
# define JSONCPP_OVERRIDE override
# define JSONCPP_NOEXCEPT noexcept
#else
# define JSONCPP_OVERRIDE
# define JSONCPP_NOEXCEPT throw()
#endif
#ifndef JSON_HAS_RVALUE_REFERENCES
#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
#define JSON_HAS_RVALUE_REFERENCES 1
#endif // MSVC >= 2010
#ifdef __clang__
#if __has_feature(cxx_rvalue_references)
#define JSON_HAS_RVALUE_REFERENCES 1
#endif // has_feature
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
#define JSON_HAS_RVALUE_REFERENCES 1
#endif // GXX_EXPERIMENTAL
#endif // __clang__ || __GNUC__
#endif // not defined JSON_HAS_RVALUE_REFERENCES
#ifndef JSON_HAS_RVALUE_REFERENCES
#define JSON_HAS_RVALUE_REFERENCES 0
#endif
#ifdef __clang__
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
#endif # endif // GNUC version
#endif // __clang__ || __GNUC__
#if !defined(JSONCPP_DEPRECATED) #if !defined(JSONCPP_DEPRECATED)
#define JSONCPP_DEPRECATED(message) #define JSONCPP_DEPRECATED(message)
#endif // if !defined(JSONCPP_DEPRECATED) #endif // if !defined(JSONCPP_DEPRECATED)
#if __GNUC__ >= 6
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
#endif
#if !defined(JSON_IS_AMALGAMATION)
# include "version.h"
# if JSONCPP_USING_SECURE_MEMORY
# include "allocator.h" //typedef Allocator
# endif
#endif // if !defined(JSON_IS_AMALGAMATION)
namespace Json { namespace Json {
typedef int Int; typedef int Int;
typedef unsigned int UInt; typedef unsigned int UInt;
@ -208,13 +277,26 @@ typedef unsigned int LargestUInt;
typedef __int64 Int64; typedef __int64 Int64;
typedef unsigned __int64 UInt64; typedef unsigned __int64 UInt64;
#else // if defined(_MSC_VER) // Other platforms, use long long #else // if defined(_MSC_VER) // Other platforms, use long long
typedef long long int Int64; typedef int64_t Int64;
typedef unsigned long long int UInt64; typedef uint64_t UInt64;
#endif // if defined(_MSC_VER) #endif // if defined(_MSC_VER)
typedef Int64 LargestInt; typedef Int64 LargestInt;
typedef UInt64 LargestUInt; typedef UInt64 LargestUInt;
#define JSON_HAS_INT64 #define JSON_HAS_INT64
#endif // if defined(JSON_NO_INT64) #endif // if defined(JSON_NO_INT64)
#if JSONCPP_USING_SECURE_MEMORY
#define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
#define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
#define JSONCPP_ISTREAM std::istream
#else
#define JSONCPP_STRING std::string
#define JSONCPP_OSTRINGSTREAM std::ostringstream
#define JSONCPP_OSTREAM std::ostream
#define JSONCPP_ISTRINGSTREAM std::istringstream
#define JSONCPP_ISTREAM std::istream
#endif // if JSONCPP_USING_SECURE_MEMORY
} // end namespace Json } // end namespace Json
#endif // JSON_CONFIG_H_INCLUDED #endif // JSON_CONFIG_H_INCLUDED
@ -295,6 +377,8 @@ class ValueConstIterator;
#include "forwards.h" #include "forwards.h"
#endif // if !defined(JSON_IS_AMALGAMATION) #endif // if !defined(JSON_IS_AMALGAMATION)
#pragma pack(push, 8)
namespace Json { namespace Json {
/** \brief Configuration passed to reader and writer. /** \brief Configuration passed to reader and writer.
@ -329,10 +413,18 @@ public:
/// \c true if root must be either an array or an object value. Default: \c /// \c true if root must be either an array or an object value. Default: \c
/// false. /// false.
bool strictRoot_; bool strictRoot_;
/// \c true if dropped null placeholders are allowed. Default: \c false.
bool allowDroppedNullPlaceholders_;
/// \c true if numeric object key are allowed. Default: \c false.
bool allowNumericKeys_;
}; };
} // namespace Json } // namespace Json
#pragma pack(pop)
#endif // CPPTL_JSON_FEATURES_H_INCLUDED #endif // CPPTL_JSON_FEATURES_H_INCLUDED
// ////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////
@ -372,13 +464,6 @@ public:
#include <cpptl/forwards.h> #include <cpptl/forwards.h>
#endif #endif
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
// be used by...
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma warning(push)
#pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
//Conditional NORETURN attribute on the throw functions would: //Conditional NORETURN attribute on the throw functions would:
// a) suppress false positives from static code analysis // a) suppress false positives from static code analysis
// b) possibly improve optimization opportunities. // b) possibly improve optimization opportunities.
@ -392,6 +477,15 @@ public:
# endif # endif
#endif #endif
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
// be used by...
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma warning(push)
#pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma pack(push, 8)
/** \brief JSON (JavaScript Object Notation). /** \brief JSON (JavaScript Object Notation).
*/ */
namespace Json { namespace Json {
@ -402,11 +496,11 @@ namespace Json {
*/ */
class JSON_API Exception : public std::exception { class JSON_API Exception : public std::exception {
public: public:
Exception(std::string const& msg); Exception(JSONCPP_STRING const& msg);
virtual ~Exception() throw(); ~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
virtual char const* what() const throw(); char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
protected: protected:
std::string const msg_; JSONCPP_STRING msg_;
}; };
/** Exceptions which the user cannot easily avoid. /** Exceptions which the user cannot easily avoid.
@ -417,7 +511,7 @@ protected:
*/ */
class JSON_API RuntimeError : public Exception { class JSON_API RuntimeError : public Exception {
public: public:
RuntimeError(std::string const& msg); RuntimeError(JSONCPP_STRING const& msg);
}; };
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. /** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
@ -428,13 +522,13 @@ public:
*/ */
class JSON_API LogicError : public Exception { class JSON_API LogicError : public Exception {
public: public:
LogicError(std::string const& msg); LogicError(JSONCPP_STRING const& msg);
}; };
/// used internally /// used internally
JSONCPP_NORETURN void throwRuntimeError(std::string const& msg); JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg);
/// used internally /// used internally
JSONCPP_NORETURN void throwLogicError(std::string const& msg); JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg);
/** \brief Type of the value held by a Value object. /** \brief Type of the value held by a Value object.
*/ */
@ -525,7 +619,7 @@ private:
class JSON_API Value { class JSON_API Value {
friend class ValueIteratorBase; friend class ValueIteratorBase;
public: public:
typedef std::vector<std::string> Members; typedef std::vector<JSONCPP_STRING> Members;
typedef ValueIterator iterator; typedef ValueIterator iterator;
typedef ValueConstIterator const_iterator; typedef ValueConstIterator const_iterator;
typedef Json::UInt UInt; typedef Json::UInt UInt;
@ -538,11 +632,10 @@ public:
typedef Json::LargestUInt LargestUInt; typedef Json::LargestUInt LargestUInt;
typedef Json::ArrayIndex ArrayIndex; typedef Json::ArrayIndex ArrayIndex;
static const Value& nullRef; static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value().
#if !defined(__ARMEL__) static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null
/// \deprecated This exists for binary compatibility only. Use nullRef. static Value const& nullSingleton(); ///< Prefer this to null or nullRef.
static const Value null;
#endif
/// Minimum signed integer value that can be stored in a Json::Value. /// Minimum signed integer value that can be stored in a Json::Value.
static const LargestInt minLargestInt; static const LargestInt minLargestInt;
/// Maximum signed integer value that can be stored in a Json::Value. /// Maximum signed integer value that can be stored in a Json::Value.
@ -578,6 +671,9 @@ private:
CZString(ArrayIndex index); CZString(ArrayIndex index);
CZString(char const* str, unsigned length, DuplicationPolicy allocate); CZString(char const* str, unsigned length, DuplicationPolicy allocate);
CZString(CZString const& other); CZString(CZString const& other);
#if JSON_HAS_RVALUE_REFERENCES
CZString(CZString&& other);
#endif
~CZString(); ~CZString();
CZString& operator=(CZString other); CZString& operator=(CZString other);
bool operator<(CZString const& other) const; bool operator<(CZString const& other) const;
@ -653,18 +749,22 @@ Json::Value obj_value(Json::objectValue); // {}
* \endcode * \endcode
*/ */
Value(const StaticString& value); Value(const StaticString& value);
Value(const std::string& value); ///< Copy data() til size(). Embedded zeroes too. Value(const JSONCPP_STRING& value); ///< Copy data() til size(). Embedded zeroes too.
#ifdef JSON_USE_CPPTL #ifdef JSON_USE_CPPTL
Value(const CppTL::ConstString& value); Value(const CppTL::ConstString& value);
#endif #endif
Value(bool value); Value(bool value);
/// Deep copy. /// Deep copy.
Value(const Value& other); Value(const Value& other);
#if JSON_HAS_RVALUE_REFERENCES
/// Move constructor
Value(Value&& other);
#endif
~Value(); ~Value();
/// Deep copy, then swap(other). /// Deep copy, then swap(other).
/// \note Over-write existing comments. To preserve comments, use #swapPayload(). /// \note Over-write existing comments. To preserve comments, use #swapPayload().
Value &operator=(const Value &other); Value& operator=(Value other);
/// Swap everything. /// Swap everything.
void swap(Value& other); void swap(Value& other);
/// Swap values but leave comments and source offsets in place. /// Swap values but leave comments and source offsets in place.
@ -682,7 +782,10 @@ Json::Value obj_value(Json::objectValue); // {}
int compare(const Value& other) const; int compare(const Value& other) const;
const char* asCString() const; ///< Embedded zeroes could cause you trouble! const char* asCString() const; ///< Embedded zeroes could cause you trouble!
std::string asString() const; ///< Embedded zeroes are possible. #if JSONCPP_USING_SECURE_MEMORY
unsigned getCStringLength() const; //Allows you to understand the length of the CString
#endif
JSONCPP_STRING asString() const; ///< Embedded zeroes are possible.
/** Get raw char* of string-value. /** Get raw char* of string-value.
* \return false if !string. (Seg-fault if str or end are NULL.) * \return false if !string. (Seg-fault if str or end are NULL.)
*/ */
@ -786,11 +889,11 @@ Json::Value obj_value(Json::objectValue); // {}
const Value& operator[](const char* key) const; const Value& operator[](const char* key) const;
/// Access an object value by name, create a null member if it does not exist. /// Access an object value by name, create a null member if it does not exist.
/// \param key may contain embedded nulls. /// \param key may contain embedded nulls.
Value& operator[](const std::string& key); Value& operator[](const JSONCPP_STRING& key);
/// Access an object value by name, returns null if there is no member with /// Access an object value by name, returns null if there is no member with
/// that name. /// that name.
/// \param key may contain embedded nulls. /// \param key may contain embedded nulls.
const Value& operator[](const std::string& key) const; const Value& operator[](const JSONCPP_STRING& key) const;
/** \brief Access an object value by name, create a null member if it does not /** \brief Access an object value by name, create a null member if it does not
exist. exist.
@ -821,7 +924,7 @@ Json::Value obj_value(Json::objectValue); // {}
/// Return the member named key if it exist, defaultValue otherwise. /// Return the member named key if it exist, defaultValue otherwise.
/// \note deep copy /// \note deep copy
/// \param key may contain embedded nulls. /// \param key may contain embedded nulls.
Value get(const std::string& key, const Value& defaultValue) const; Value get(const JSONCPP_STRING& key, const Value& defaultValue) const;
#ifdef JSON_USE_CPPTL #ifdef JSON_USE_CPPTL
/// Return the member named key if it exist, defaultValue otherwise. /// Return the member named key if it exist, defaultValue otherwise.
/// \note deep copy /// \note deep copy
@ -846,7 +949,7 @@ Json::Value obj_value(Json::objectValue); // {}
/// Same as removeMember(const char*) /// Same as removeMember(const char*)
/// \param key may contain embedded nulls. /// \param key may contain embedded nulls.
/// \deprecated /// \deprecated
Value removeMember(const std::string& key); Value removeMember(const JSONCPP_STRING& key);
/// Same as removeMember(const char* begin, const char* end, Value* removed), /// Same as removeMember(const char* begin, const char* end, Value* removed),
/// but 'key' is null-terminated. /// but 'key' is null-terminated.
bool removeMember(const char* key, Value* removed); bool removeMember(const char* key, Value* removed);
@ -856,8 +959,8 @@ Json::Value obj_value(Json::objectValue); // {}
\param key may contain embedded nulls. \param key may contain embedded nulls.
\return true iff removed (no exceptions) \return true iff removed (no exceptions)
*/ */
bool removeMember(std::string const& key, Value* removed); bool removeMember(JSONCPP_STRING const& key, Value* removed);
/// Same as removeMember(std::string const& key, Value* removed) /// Same as removeMember(JSONCPP_STRING const& key, Value* removed)
bool removeMember(const char* begin, const char* end, Value* removed); bool removeMember(const char* begin, const char* end, Value* removed);
/** \brief Remove the indexed array element. /** \brief Remove the indexed array element.
@ -872,8 +975,8 @@ Json::Value obj_value(Json::objectValue); // {}
bool isMember(const char* key) const; bool isMember(const char* key) const;
/// Return true if the object has a member named key. /// Return true if the object has a member named key.
/// \param key may contain embedded nulls. /// \param key may contain embedded nulls.
bool isMember(const std::string& key) const; bool isMember(const JSONCPP_STRING& key) const;
/// Same as isMember(std::string const& key)const /// Same as isMember(JSONCPP_STRING const& key)const
bool isMember(const char* begin, const char* end) const; bool isMember(const char* begin, const char* end) const;
#ifdef JSON_USE_CPPTL #ifdef JSON_USE_CPPTL
/// Return true if the object has a member named key. /// Return true if the object has a member named key.
@ -893,17 +996,17 @@ Json::Value obj_value(Json::objectValue); // {}
//# endif //# endif
/// \deprecated Always pass len. /// \deprecated Always pass len.
JSONCPP_DEPRECATED("Use setComment(std::string const&) instead.") JSONCPP_DEPRECATED("Use setComment(JSONCPP_STRING const&) instead.")
void setComment(const char* comment, CommentPlacement placement); void setComment(const char* comment, CommentPlacement placement);
/// Comments must be //... or /* ... */ /// Comments must be //... or /* ... */
void setComment(const char* comment, size_t len, CommentPlacement placement); void setComment(const char* comment, size_t len, CommentPlacement placement);
/// Comments must be //... or /* ... */ /// Comments must be //... or /* ... */
void setComment(const std::string& comment, CommentPlacement placement); void setComment(const JSONCPP_STRING& comment, CommentPlacement placement);
bool hasComment(CommentPlacement placement) const; bool hasComment(CommentPlacement placement) const;
/// Include delimiters and embedded newlines. /// Include delimiters and embedded newlines.
std::string getComment(CommentPlacement placement) const; JSONCPP_STRING getComment(CommentPlacement placement) const;
std::string toStyledString() const; JSONCPP_STRING toStyledString() const;
const_iterator begin() const; const_iterator begin() const;
const_iterator end() const; const_iterator end() const;
@ -911,6 +1014,13 @@ Json::Value obj_value(Json::objectValue); // {}
iterator begin(); iterator begin();
iterator end(); iterator end();
// Accessors for the [start, limit) range of bytes within the JSON text from
// which this value was parsed, if any.
void setOffsetStart(ptrdiff_t start);
void setOffsetLimit(ptrdiff_t limit);
ptrdiff_t getOffsetStart() const;
ptrdiff_t getOffsetLimit() const;
private: private:
void initBasic(ValueType type, bool allocated = false); void initBasic(ValueType type, bool allocated = false);
@ -947,6 +1057,11 @@ private:
unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
// If not allocated_, string_ must be null-terminated. // If not allocated_, string_ must be null-terminated.
CommentInfo* comments_; CommentInfo* comments_;
// [start, limit) byte offsets in the source JSON text from which this Value
// was extracted.
ptrdiff_t start_;
ptrdiff_t limit_;
}; };
/** \brief Experimental and untested: represents an element of the "path" to /** \brief Experimental and untested: represents an element of the "path" to
@ -959,7 +1074,7 @@ public:
PathArgument(); PathArgument();
PathArgument(ArrayIndex index); PathArgument(ArrayIndex index);
PathArgument(const char* key); PathArgument(const char* key);
PathArgument(const std::string& key); PathArgument(const JSONCPP_STRING& key);
private: private:
enum Kind { enum Kind {
@ -967,7 +1082,7 @@ private:
kindIndex, kindIndex,
kindKey kindKey
}; };
std::string key_; JSONCPP_STRING key_;
ArrayIndex index_; ArrayIndex index_;
Kind kind_; Kind kind_;
}; };
@ -985,7 +1100,7 @@ private:
*/ */
class JSON_API Path { class JSON_API Path {
public: public:
Path(const std::string& path, Path(const JSONCPP_STRING& path,
const PathArgument& a1 = PathArgument(), const PathArgument& a1 = PathArgument(),
const PathArgument& a2 = PathArgument(), const PathArgument& a2 = PathArgument(),
const PathArgument& a3 = PathArgument(), const PathArgument& a3 = PathArgument(),
@ -1002,12 +1117,12 @@ private:
typedef std::vector<const PathArgument*> InArgs; typedef std::vector<const PathArgument*> InArgs;
typedef std::vector<PathArgument> Args; typedef std::vector<PathArgument> Args;
void makePath(const std::string& path, const InArgs& in); void makePath(const JSONCPP_STRING& path, const InArgs& in);
void addPathInArg(const std::string& path, void addPathInArg(const JSONCPP_STRING& path,
const InArgs& in, const InArgs& in,
InArgs::const_iterator& itInArg, InArgs::const_iterator& itInArg,
PathArgument::Kind kind); PathArgument::Kind kind);
void invalidPath(const std::string& path, int location); void invalidPath(const JSONCPP_STRING& path, int location);
Args args_; Args args_;
}; };
@ -1040,7 +1155,7 @@ public:
/// Return the member name of the referenced Value, or "" if it is not an /// Return the member name of the referenced Value, or "" if it is not an
/// objectValue. /// objectValue.
/// \note Avoid `c_str()` on result, as embedded zeroes are possible. /// \note Avoid `c_str()` on result, as embedded zeroes are possible.
std::string name() const; JSONCPP_STRING name() const;
/// Return the member name of the referenced Value. "" if it is not an /// Return the member name of the referenced Value. "" if it is not an
/// objectValue. /// objectValue.
@ -1092,6 +1207,7 @@ public:
typedef ValueConstIterator SelfType; typedef ValueConstIterator SelfType;
ValueConstIterator(); ValueConstIterator();
ValueConstIterator(ValueIterator const& other);
private: private:
/*! \internal Use by Value to create an iterator. /*! \internal Use by Value to create an iterator.
@ -1141,7 +1257,7 @@ public:
typedef ValueIterator SelfType; typedef ValueIterator SelfType;
ValueIterator(); ValueIterator();
ValueIterator(const ValueConstIterator& other); explicit ValueIterator(const ValueConstIterator& other);
ValueIterator(const ValueIterator& other); ValueIterator(const ValueIterator& other);
private: private:
@ -1187,6 +1303,7 @@ template<>
inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); } inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
} }
#pragma pack(pop)
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma warning(pop) #pragma warning(pop)
@ -1232,6 +1349,8 @@ inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
#pragma warning(disable : 4251) #pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma pack(push, 8)
namespace Json { namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
@ -1244,6 +1363,18 @@ public:
typedef char Char; typedef char Char;
typedef const Char* Location; typedef const Char* Location;
/** \brief An error tagged with where in the JSON text it was encountered.
*
* The offsets give the [start, limit) range of bytes within the text. Note
* that this is bytes, not codepoints.
*
*/
struct StructuredError {
ptrdiff_t offset_start;
ptrdiff_t offset_limit;
JSONCPP_STRING message;
};
/** \brief Constructs a Reader allowing all features /** \brief Constructs a Reader allowing all features
* for parsing. * for parsing.
*/ */
@ -1296,7 +1427,7 @@ public:
/// \brief Parse from input stream. /// \brief Parse from input stream.
/// \see Json::operator>>(std::istream&, Json::Value&). /// \see Json::operator>>(std::istream&, Json::Value&).
bool parse(std::istream& is, Value& root, bool collectComments = true); bool parse(JSONCPP_ISTREAM& is, Value& root, bool collectComments = true);
/** \brief Returns a user friendly string that list errors in the parsed /** \brief Returns a user friendly string that list errors in the parsed
* document. * document.
@ -1308,7 +1439,7 @@ public:
* \deprecated Use getFormattedErrorMessages() instead (typo fix). * \deprecated Use getFormattedErrorMessages() instead (typo fix).
*/ */
JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.") JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
std::string getFormatedErrorMessages() const; JSONCPP_STRING getFormatedErrorMessages() const;
/** \brief Returns a user friendly string that list errors in the parsed /** \brief Returns a user friendly string that list errors in the parsed
* document. * document.
@ -1318,7 +1449,39 @@ public:
* occurred * occurred
* during parsing. * during parsing.
*/ */
std::string getFormattedErrorMessages() const; JSONCPP_STRING getFormattedErrorMessages() const;
/** \brief Returns a vector of structured erros encounted while parsing.
* \return A (possibly empty) vector of StructuredError objects. Currently
* only one error can be returned, but the caller should tolerate
* multiple
* errors. This can occur if the parser recovers from a non-fatal
* parse error and then encounters additional errors.
*/
std::vector<StructuredError> getStructuredErrors() const;
/** \brief Add a semantic error message.
* \param value JSON Value location associated with the error
* \param message The error message.
* \return \c true if the error was successfully added, \c false if the
* Value offset exceeds the document size.
*/
bool pushError(const Value& value, const JSONCPP_STRING& message);
/** \brief Add a semantic error message with extra context.
* \param value JSON Value location associated with the error
* \param message The error message.
* \param extra Additional JSON Value location to contextualize the error
* \return \c true if the error was successfully added, \c false if either
* Value offset exceeds the document size.
*/
bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
/** \brief Return whether there are any errors.
* \return \c true if there are no errors to report \c false if
* errors have occurred.
*/
bool good() const;
private: private:
enum TokenType { enum TokenType {
@ -1348,7 +1511,7 @@ private:
class ErrorInfo { class ErrorInfo {
public: public:
Token token_; Token token_;
std::string message_; JSONCPP_STRING message_;
Location extra_; Location extra_;
}; };
@ -1368,7 +1531,7 @@ private:
bool decodeNumber(Token& token); bool decodeNumber(Token& token);
bool decodeNumber(Token& token, Value& decoded); bool decodeNumber(Token& token, Value& decoded);
bool decodeString(Token& token); bool decodeString(Token& token);
bool decodeString(Token& token, std::string& decoded); bool decodeString(Token& token, JSONCPP_STRING& decoded);
bool decodeDouble(Token& token); bool decodeDouble(Token& token);
bool decodeDouble(Token& token, Value& decoded); bool decodeDouble(Token& token, Value& decoded);
bool decodeUnicodeCodePoint(Token& token, bool decodeUnicodeCodePoint(Token& token,
@ -1379,9 +1542,9 @@ private:
Location& current, Location& current,
Location end, Location end,
unsigned int& unicode); unsigned int& unicode);
bool addError(const std::string& message, Token& token, Location extra = 0); bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
bool recoverFromError(TokenType skipUntilToken); bool recoverFromError(TokenType skipUntilToken);
bool addErrorAndRecover(const std::string& message, bool addErrorAndRecover(const JSONCPP_STRING& message,
Token& token, Token& token,
TokenType skipUntilToken); TokenType skipUntilToken);
void skipUntilSpace(); void skipUntilSpace();
@ -1389,20 +1552,20 @@ private:
Char getNextChar(); Char getNextChar();
void void
getLocationLineAndColumn(Location location, int& line, int& column) const; getLocationLineAndColumn(Location location, int& line, int& column) const;
std::string getLocationLineAndColumn(Location location) const; JSONCPP_STRING getLocationLineAndColumn(Location location) const;
void addComment(Location begin, Location end, CommentPlacement placement); void addComment(Location begin, Location end, CommentPlacement placement);
void skipCommentTokens(Token& token); void skipCommentTokens(Token& token);
typedef std::stack<Value*> Nodes; typedef std::stack<Value*> Nodes;
Nodes nodes_; Nodes nodes_;
Errors errors_; Errors errors_;
std::string document_; JSONCPP_STRING document_;
Location begin_; Location begin_;
Location end_; Location end_;
Location current_; Location current_;
Location lastValueEnd_; Location lastValueEnd_;
Value* lastValue_; Value* lastValue_;
std::string commentsBefore_; JSONCPP_STRING commentsBefore_;
Features features_; Features features_;
bool collectComments_; bool collectComments_;
}; // Reader }; // Reader
@ -1431,9 +1594,9 @@ public:
*/ */
virtual bool parse( virtual bool parse(
char const* beginDoc, char const* endDoc, char const* beginDoc, char const* endDoc,
Value* root, std::string* errs) = 0; Value* root, JSONCPP_STRING* errs) = 0;
class Factory { class JSON_API Factory {
public: public:
virtual ~Factory() {} virtual ~Factory() {}
/** \brief Allocate a CharReader via operator new(). /** \brief Allocate a CharReader via operator new().
@ -1451,7 +1614,7 @@ Usage:
CharReaderBuilder builder; CharReaderBuilder builder;
builder["collectComments"] = false; builder["collectComments"] = false;
Value value; Value value;
std::string errs; JSONCPP_STRING errs;
bool ok = parseFromStream(builder, std::cin, &value, &errs); bool ok = parseFromStream(builder, std::cin, &value, &errs);
\endcode \endcode
*/ */
@ -1498,9 +1661,9 @@ public:
Json::Value settings_; Json::Value settings_;
CharReaderBuilder(); CharReaderBuilder();
virtual ~CharReaderBuilder(); ~CharReaderBuilder() JSONCPP_OVERRIDE;
virtual CharReader* newCharReader() const; CharReader* newCharReader() const JSONCPP_OVERRIDE;
/** \return true if 'settings' are legal and consistent; /** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'. * otherwise, indicate bad settings via 'invalid'.
@ -1509,7 +1672,7 @@ public:
/** A simple way to update a specific setting. /** A simple way to update a specific setting.
*/ */
Value& operator[](std::string key); Value& operator[](JSONCPP_STRING key);
/** Called by ctor, but you can use this to reset settings_. /** Called by ctor, but you can use this to reset settings_.
* \pre 'settings' != NULL (but Json::null is fine) * \pre 'settings' != NULL (but Json::null is fine)
@ -1531,7 +1694,7 @@ public:
*/ */
bool JSON_API parseFromStream( bool JSON_API parseFromStream(
CharReader::Factory const&, CharReader::Factory const&,
std::istream&, JSONCPP_ISTREAM&,
Value* root, std::string* errs); Value* root, std::string* errs);
/** \brief Read from 'sin' into 'root'. /** \brief Read from 'sin' into 'root'.
@ -1558,10 +1721,12 @@ bool JSON_API parseFromStream(
\throw std::exception on parse error. \throw std::exception on parse error.
\see Json::operator<<() \see Json::operator<<()
*/ */
JSON_API std::istream& operator>>(std::istream&, Value&); JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
} // namespace Json } // namespace Json
#pragma pack(pop)
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma warning(pop) #pragma warning(pop)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
@ -1603,6 +1768,8 @@ JSON_API std::istream& operator>>(std::istream&, Value&);
#pragma warning(disable : 4251) #pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma pack(push, 8)
namespace Json { namespace Json {
class Value; class Value;
@ -1622,7 +1789,7 @@ Usage:
*/ */
class JSON_API StreamWriter { class JSON_API StreamWriter {
protected: protected:
std::ostream* sout_; // not owned; will not delete JSONCPP_OSTREAM* sout_; // not owned; will not delete
public: public:
StreamWriter(); StreamWriter();
virtual ~StreamWriter(); virtual ~StreamWriter();
@ -1632,7 +1799,7 @@ public:
\return zero on success (For now, we always return zero, so check the stream instead.) \return zero on success (For now, we always return zero, so check the stream instead.)
\throw std::exception possibly, depending on configuration \throw std::exception possibly, depending on configuration
*/ */
virtual int write(Value const& root, std::ostream* sout) = 0; virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0;
/** \brief A simple abstract factory. /** \brief A simple abstract factory.
*/ */
@ -1649,7 +1816,7 @@ public:
/** \brief Write into stringstream, then return string, for convenience. /** \brief Write into stringstream, then return string, for convenience.
* A StreamWriter will be created from the factory, used, and then deleted. * A StreamWriter will be created from the factory, used, and then deleted.
*/ */
std::string JSON_API writeString(StreamWriter::Factory const& factory, Value const& root); JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, Value const& root);
/** \brief Build a StreamWriter implementation. /** \brief Build a StreamWriter implementation.
@ -1695,12 +1862,12 @@ public:
Json::Value settings_; Json::Value settings_;
StreamWriterBuilder(); StreamWriterBuilder();
virtual ~StreamWriterBuilder(); ~StreamWriterBuilder() JSONCPP_OVERRIDE;
/** /**
* \throw std::exception if something goes wrong (e.g. invalid settings) * \throw std::exception if something goes wrong (e.g. invalid settings)
*/ */
virtual StreamWriter* newStreamWriter() const; StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
/** \return true if 'settings' are legal and consistent; /** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'. * otherwise, indicate bad settings via 'invalid'.
@ -1708,7 +1875,7 @@ public:
bool validate(Json::Value* invalid) const; bool validate(Json::Value* invalid) const;
/** A simple way to update a specific setting. /** A simple way to update a specific setting.
*/ */
Value& operator[](std::string key); Value& operator[](JSONCPP_STRING key);
/** Called by ctor, but you can use this to reset settings_. /** Called by ctor, but you can use this to reset settings_.
* \pre 'settings' != NULL (but Json::null is fine) * \pre 'settings' != NULL (but Json::null is fine)
@ -1725,7 +1892,7 @@ class JSON_API Writer {
public: public:
virtual ~Writer(); virtual ~Writer();
virtual std::string write(const Value& root) = 0; virtual JSONCPP_STRING write(const Value& root) = 0;
}; };
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
@ -1741,18 +1908,29 @@ class JSON_API FastWriter : public Writer {
public: public:
FastWriter(); FastWriter();
virtual ~FastWriter() {} ~FastWriter() JSONCPP_OVERRIDE {}
void enableYAMLCompatibility(); void enableYAMLCompatibility();
/** \brief Drop the "null" string from the writer's output for nullValues.
* Strictly speaking, this is not valid JSON. But when the output is being
* fed to a browser's Javascript, it makes for smaller output and the
* browser can handle the output just fine.
*/
void dropNullPlaceholders();
void omitEndingLineFeed();
public: // overridden from Writer public: // overridden from Writer
virtual std::string write(const Value& root); JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
private: private:
void writeValue(const Value& value); void writeValue(const Value& value);
std::string document_; JSONCPP_STRING document_;
bool yamlCompatiblityEnabled_; bool yamlCompatiblityEnabled_;
bool dropNullPlaceholders_;
bool omitEndingLineFeed_;
}; };
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
@ -1782,36 +1960,36 @@ private:
class JSON_API StyledWriter : public Writer { class JSON_API StyledWriter : public Writer {
public: public:
StyledWriter(); StyledWriter();
virtual ~StyledWriter() {} ~StyledWriter() JSONCPP_OVERRIDE {}
public: // overridden from Writer public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format. /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize. * \param root Value to serialize.
* \return String containing the JSON document that represents the root value. * \return String containing the JSON document that represents the root value.
*/ */
virtual std::string write(const Value& root); JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
private: private:
void writeValue(const Value& value); void writeValue(const Value& value);
void writeArrayValue(const Value& value); void writeArrayValue(const Value& value);
bool isMultineArray(const Value& value); bool isMultineArray(const Value& value);
void pushValue(const std::string& value); void pushValue(const JSONCPP_STRING& value);
void writeIndent(); void writeIndent();
void writeWithIndent(const std::string& value); void writeWithIndent(const JSONCPP_STRING& value);
void indent(); void indent();
void unindent(); void unindent();
void writeCommentBeforeValue(const Value& root); void writeCommentBeforeValue(const Value& root);
void writeCommentAfterValueOnSameLine(const Value& root); void writeCommentAfterValueOnSameLine(const Value& root);
bool hasCommentForValue(const Value& value); bool hasCommentForValue(const Value& value);
static std::string normalizeEOL(const std::string& text); static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
typedef std::vector<std::string> ChildValues; typedef std::vector<JSONCPP_STRING> ChildValues;
ChildValues childValues_; ChildValues childValues_;
std::string document_; JSONCPP_STRING document_;
std::string indentString_; JSONCPP_STRING indentString_;
int rightMargin_; unsigned int rightMargin_;
int indentSize_; unsigned int indentSize_;
bool addChildValues_; bool addChildValues_;
}; };
@ -1843,7 +2021,7 @@ private:
*/ */
class JSON_API StyledStreamWriter { class JSON_API StyledStreamWriter {
public: public:
StyledStreamWriter(std::string indentation = "\t"); StyledStreamWriter(JSONCPP_STRING indentation = "\t");
~StyledStreamWriter() {} ~StyledStreamWriter() {}
public: public:
@ -1853,49 +2031,51 @@ public:
* \note There is no point in deriving from Writer, since write() should not * \note There is no point in deriving from Writer, since write() should not
* return a value. * return a value.
*/ */
void write(std::ostream& out, const Value& root); void write(JSONCPP_OSTREAM& out, const Value& root);
private: private:
void writeValue(const Value& value); void writeValue(const Value& value);
void writeArrayValue(const Value& value); void writeArrayValue(const Value& value);
bool isMultineArray(const Value& value); bool isMultineArray(const Value& value);
void pushValue(const std::string& value); void pushValue(const JSONCPP_STRING& value);
void writeIndent(); void writeIndent();
void writeWithIndent(const std::string& value); void writeWithIndent(const JSONCPP_STRING& value);
void indent(); void indent();
void unindent(); void unindent();
void writeCommentBeforeValue(const Value& root); void writeCommentBeforeValue(const Value& root);
void writeCommentAfterValueOnSameLine(const Value& root); void writeCommentAfterValueOnSameLine(const Value& root);
bool hasCommentForValue(const Value& value); bool hasCommentForValue(const Value& value);
static std::string normalizeEOL(const std::string& text); static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
typedef std::vector<std::string> ChildValues; typedef std::vector<JSONCPP_STRING> ChildValues;
ChildValues childValues_; ChildValues childValues_;
std::ostream* document_; JSONCPP_OSTREAM* document_;
std::string indentString_; JSONCPP_STRING indentString_;
int rightMargin_; unsigned int rightMargin_;
std::string indentation_; JSONCPP_STRING indentation_;
bool addChildValues_ : 1; bool addChildValues_ : 1;
bool indented_ : 1; bool indented_ : 1;
}; };
#if defined(JSON_HAS_INT64) #if defined(JSON_HAS_INT64)
std::string JSON_API valueToString(Int value); JSONCPP_STRING JSON_API valueToString(Int value);
std::string JSON_API valueToString(UInt value); JSONCPP_STRING JSON_API valueToString(UInt value);
#endif // if defined(JSON_HAS_INT64) #endif // if defined(JSON_HAS_INT64)
std::string JSON_API valueToString(LargestInt value); JSONCPP_STRING JSON_API valueToString(LargestInt value);
std::string JSON_API valueToString(LargestUInt value); JSONCPP_STRING JSON_API valueToString(LargestUInt value);
std::string JSON_API valueToString(double value); JSONCPP_STRING JSON_API valueToString(double value);
std::string JSON_API valueToString(bool value); JSONCPP_STRING JSON_API valueToString(bool value);
std::string JSON_API valueToQuotedString(const char* value); JSONCPP_STRING JSON_API valueToQuotedString(const char* value);
/// \brief Output using the StyledStreamWriter. /// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>() /// \see Json::operator>>()
JSON_API std::ostream& operator<<(std::ostream&, const Value& root); JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
} // namespace Json } // namespace Json
#pragma pack(pop)
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
#pragma warning(pop) #pragma warning(pop)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
@ -1942,7 +2122,7 @@ JSON_API std::ostream& operator<<(std::ostream&, const Value& root);
# define JSON_FAIL_MESSAGE(message) \ # define JSON_FAIL_MESSAGE(message) \
{ \ { \
std::ostringstream oss; oss << message; \ JSONCPP_OSTRINGSTREAM oss; oss << message; \
Json::throwLogicError(oss.str()); \ Json::throwLogicError(oss.str()); \
abort(); \ abort(); \
} }
@ -1955,7 +2135,7 @@ JSON_API std::ostream& operator<<(std::ostream&, const Value& root);
// release builds we abort, for a core-dump or debugger. // release builds we abort, for a core-dump or debugger.
# define JSON_FAIL_MESSAGE(message) \ # define JSON_FAIL_MESSAGE(message) \
{ \ { \
std::ostringstream oss; oss << message; \ JSONCPP_OSTRINGSTREAM oss; oss << message; \
assert(false && oss.str().c_str()); \ assert(false && oss.str().c_str()); \
abort(); \ abort(); \
} }

File diff suppressed because it is too large Load Diff