75 #ifndef JSON_AMALGATED_H_INCLUDED
76 # define JSON_AMALGATED_H_INCLUDED
77 #define JSON_IS_AMALGAMATION
87 #ifndef JSON_VERSION_H_INCLUDED
88 # define JSON_VERSION_H_INCLUDED
90 # define JSONCPP_VERSION_STRING "1.6.5"
91 # define JSONCPP_VERSION_MAJOR 1
92 # define JSONCPP_VERSION_MINOR 6
93 # define JSONCPP_VERSION_PATCH 5
94 # define JSONCPP_VERSION_QUALIFIER
95 # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
97 #endif // JSON_VERSION_H_INCLUDED
117 #ifndef JSON_CONFIG_H_INCLUDED
118 #define JSON_CONFIG_H_INCLUDED
132 #ifndef JSON_USE_EXCEPTION
133 #define JSON_USE_EXCEPTION 1
142 #include <cpptl/config.h>
143 #ifndef JSON_USE_CPPTL
144 #define JSON_USE_CPPTL 1
149 #define JSON_API CPPTL_API
150 #elif defined(JSON_DLL_BUILD)
151 #if defined(_MSC_VER)
152 #define JSON_API __declspec(dllexport)
153 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
154 #endif // if defined(_MSC_VER)
155 #elif defined(JSON_DLL)
156 #if defined(_MSC_VER)
157 #define JSON_API __declspec(dllimport)
158 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
159 #endif // if defined(_MSC_VER)
160 #endif // ifdef JSON_IN_CPPTL
161 #if !defined(JSON_API)
170 #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
173 #define JSON_USE_INT64_DOUBLE_CONVERSION 1
178 #pragma warning(disable : 4786)
179 #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
181 #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
182 #define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
184 #elif defined(__clang__) && defined(__has_feature)
185 #if __has_feature(attribute_deprecated_with_message)
186 #define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
188 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
189 #define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
190 #elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
191 #define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
194 #if !defined(JSONCPP_DEPRECATED)
195 #define JSONCPP_DEPRECATED(message)
196 #endif // if !defined(JSONCPP_DEPRECATED)
200 typedef unsigned int UInt;
201 #if defined(JSON_NO_INT64)
202 typedef int LargestInt;
203 typedef unsigned int LargestUInt;
204 #undef JSON_HAS_INT64
205 #else // if defined(JSON_NO_INT64)
207 #if defined(_MSC_VER) // Microsoft Visual Studio
208 typedef __int64 Int64;
209 typedef unsigned __int64 UInt64;
210 #else // if defined(_MSC_VER) // Other platforms, use long long
211 typedef long long int Int64;
212 typedef unsigned long long int UInt64;
213 #endif // if defined(_MSC_VER)
214 typedef Int64 LargestInt;
215 typedef UInt64 LargestUInt;
216 #define JSON_HAS_INT64
217 #endif // if defined(JSON_NO_INT64)
220 #endif // JSON_CONFIG_H_INCLUDED
240 #ifndef JSON_FORWARDS_H_INCLUDED
241 #define JSON_FORWARDS_H_INCLUDED
243 #if !defined(JSON_IS_AMALGAMATION)
245 #endif // if !defined(JSON_IS_AMALGAMATION)
260 typedef unsigned int ArrayIndex;
265 class ValueIteratorBase;
267 class ValueConstIterator;
271 #endif // JSON_FORWARDS_H_INCLUDED
291 #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
292 #define CPPTL_JSON_FEATURES_H_INCLUDED
294 #if !defined(JSON_IS_AMALGAMATION)
295 #include "forwards.h"
296 #endif // if !defined(JSON_IS_AMALGAMATION)
304 class JSON_API Features {
312 static Features all();
320 static Features strictMode();
334 bool allowDroppedNullPlaceholders_;
337 bool allowNumericKeys_;
342 #endif // CPPTL_JSON_FEATURES_H_INCLUDED
362 #ifndef CPPTL_JSON_H_INCLUDED
363 #define CPPTL_JSON_H_INCLUDED
365 #if !defined(JSON_IS_AMALGAMATION)
366 #include "forwards.h"
367 #endif // if !defined(JSON_IS_AMALGAMATION)
372 #ifndef JSON_USE_CPPTL_SMALLMAP
375 #include <cpptl/smallmap.h>
377 #ifdef JSON_USE_CPPTL
378 #include <cpptl/forwards.h>
383 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
384 #pragma warning(push)
385 #pragma warning(disable : 4251)
386 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
396 class JSON_API Exception :
public std::exception {
398 Exception(std::string
const& msg);
399 virtual ~Exception() throw();
400 virtual
char const* what() const throw();
402 std::
string const msg_;
411 class JSON_API RuntimeError : public Exception {
413 RuntimeError(std::string
const& msg);
422 class JSON_API LogicError :
public Exception {
424 LogicError(std::string
const& msg);
472 class JSON_API StaticString {
474 explicit StaticString(
const char* czstring) : c_str_(czstring) {}
476 operator const char*()
const {
return c_str_; }
478 const char* c_str()
const {
return c_str_; }
518 class JSON_API Value {
519 friend class ValueIteratorBase;
521 typedef std::vector<std::string> Members;
522 typedef ValueIterator iterator;
523 typedef ValueConstIterator const_iterator;
524 typedef Json::UInt UInt;
525 typedef Json::Int Int;
526 #if defined(JSON_HAS_INT64)
527 typedef Json::UInt64 UInt64;
528 typedef Json::Int64 Int64;
529 #endif // defined(JSON_HAS_INT64)
530 typedef Json::LargestInt LargestInt;
531 typedef Json::LargestUInt LargestUInt;
532 typedef Json::ArrayIndex ArrayIndex;
534 static const Value& null;
535 static const Value& nullRef;
536 static const LargestInt minLargestInt;
539 static const LargestInt maxLargestInt;
541 static const LargestUInt maxLargestUInt;
544 static const Int minInt;
546 static const Int maxInt;
548 static const UInt maxUInt;
550 #if defined(JSON_HAS_INT64)
551 static const Int64 minInt64;
554 static const Int64 maxInt64;
556 static const UInt64 maxUInt64;
557 #endif // defined(JSON_HAS_INT64)
560 #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
563 enum DuplicationPolicy {
568 CZString(ArrayIndex index);
569 CZString(
char const* str,
unsigned length, DuplicationPolicy allocate);
570 CZString(CZString
const& other);
572 CZString& operator=(CZString other);
573 bool operator<(CZString
const& other)
const;
574 bool operator==(CZString
const& other)
const;
575 ArrayIndex index()
const;
577 char const* data()
const;
578 unsigned length()
const;
579 bool isStaticString()
const;
582 void swap(CZString& other);
584 struct StringStorage {
586 unsigned length_: 30;
592 StringStorage storage_;
597 #ifndef JSON_USE_CPPTL_SMALLMAP
598 typedef std::map<CZString, Value> ObjectValues;
600 typedef CppTL::SmallMap<CZString, Value> ObjectValues;
601 #endif // ifndef JSON_USE_CPPTL_SMALLMAP
602 #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
623 #if defined(JSON_HAS_INT64)
626 #endif // if defined(JSON_HAS_INT64)
628 Value(
const char* value);
629 Value(
const char* begin,
const char* end);
645 Value(
const StaticString& value);
646 Value(
const std::string& value);
647 #ifdef JSON_USE_CPPTL
648 Value(
const CppTL::ConstString& value);
652 Value(
const Value& other);
657 Value& operator=(Value other);
659 void swap(Value& other);
661 void swapPayload(Value& other);
666 bool operator<(
const Value& other)
const;
667 bool operator<=(
const Value& other)
const;
668 bool operator>=(
const Value& other)
const;
669 bool operator>(
const Value& other)
const;
670 bool operator==(
const Value& other)
const;
671 bool operator!=(
const Value& other)
const;
672 int compare(
const Value& other)
const;
674 const char* asCString()
const;
675 std::string asString()
const;
680 char const** begin,
char const** end)
const;
681 #ifdef JSON_USE_CPPTL
682 CppTL::ConstString asConstString()
const;
686 #if defined(JSON_HAS_INT64)
687 Int64 asInt64()
const;
688 UInt64 asUInt64()
const;
689 #endif // if defined(JSON_HAS_INT64)
690 LargestInt asLargestInt()
const;
691 LargestUInt asLargestUInt()
const;
692 float asFloat()
const;
693 double asDouble()
const;
699 bool isInt64()
const;
701 bool isUInt64()
const;
702 bool isIntegral()
const;
703 bool isDouble()
const;
704 bool isNumeric()
const;
705 bool isString()
const;
706 bool isArray()
const;
707 bool isObject()
const;
709 bool isConvertibleTo(
ValueType other)
const;
712 ArrayIndex size()
const;
719 bool operator!()
const;
731 void resize(ArrayIndex size);
739 Value& operator[](ArrayIndex index);
747 Value& operator[](
int index);
752 const Value& operator[](ArrayIndex index)
const;
757 const Value& operator[](
int index)
const;
762 Value
get(ArrayIndex index,
const Value& defaultValue)
const;
764 bool isValidIndex(ArrayIndex index)
const;
768 Value& append(
const Value& value);
773 Value& operator[](
const char* key);
776 const Value& operator[](
const char* key)
const;
779 Value& operator[](
const std::string& key);
783 const Value& operator[](
const std::string& key)
const;
796 Value& operator[](
const StaticString& key);
797 #ifdef JSON_USE_CPPTL
798 Value& operator[](
const CppTL::ConstString& key);
802 const Value& operator[](
const CppTL::ConstString& key)
const;
804 Value
get(
const char* key,
const Value& defaultValue)
const;
810 Value
get(
const char* begin,
const char* end,
const Value& defaultValue)
const;
814 Value
get(
const std::string& key,
const Value& defaultValue)
const;
815 #ifdef JSON_USE_CPPTL
816 Value
get(
const CppTL::ConstString& key,
const Value& defaultValue)
const;
820 Value
const* find(
char const* begin,
char const* end)
const;
827 Value
const* demand(
char const* begin,
char const* end);
835 Value removeMember(
const char* key);
839 Value removeMember(
const std::string& key);
842 bool removeMember(
const char* key, Value* removed);
849 bool removeMember(std::string
const& key, Value* removed);
851 bool removeMember(
const char* begin,
const char* end, Value* removed);
858 bool removeIndex(ArrayIndex i, Value* removed);
862 bool isMember(
const char* key)
const;
865 bool isMember(
const std::string& key)
const;
867 bool isMember(
const char* begin,
const char* end)
const;
868 #ifdef JSON_USE_CPPTL
869 bool isMember(
const CppTL::ConstString& key)
const;
878 Members getMemberNames()
const;
886 JSONCPP_DEPRECATED(
"Use setComment(std::string const&) instead.")
889 void setComment(const
char* comment,
size_t len,
CommentPlacement placement);
896 std::
string toStyledString() const;
898 const_iterator begin() const;
899 const_iterator end() const;
906 void setOffsetStart(
size_t start);
907 void setOffsetLimit(
size_t limit);
908 size_t getOffsetStart() const;
909 size_t getOffsetLimit() const;
912 void initBasic(
ValueType type,
bool allocated = false);
914 Value& resolveReference(const
char* key);
915 Value& resolveReference(const
char* key, const
char* end);
921 void setComment(
const char* text,
size_t len);
944 unsigned int allocated_ : 1;
946 CommentInfo* comments_;
957 class JSON_API PathArgument {
962 PathArgument(ArrayIndex index);
963 PathArgument(
const char* key);
964 PathArgument(
const std::string& key);
988 class JSON_API Path {
990 Path(
const std::string& path,
991 const PathArgument& a1 = PathArgument(),
992 const PathArgument& a2 = PathArgument(),
993 const PathArgument& a3 = PathArgument(),
994 const PathArgument& a4 = PathArgument(),
995 const PathArgument& a5 = PathArgument());
997 const Value& resolve(
const Value& root)
const;
998 Value resolve(
const Value& root,
const Value& defaultValue)
const;
1001 Value& make(Value& root)
const;
1004 typedef std::vector<const PathArgument*> InArgs;
1005 typedef std::vector<PathArgument> Args;
1007 void makePath(
const std::string& path,
const InArgs& in);
1008 void addPathInArg(
const std::string& path,
1010 InArgs::const_iterator& itInArg,
1011 PathArgument::Kind kind);
1012 void invalidPath(
const std::string& path,
int location);
1020 class JSON_API ValueIteratorBase {
1022 typedef std::bidirectional_iterator_tag iterator_category;
1023 typedef unsigned int size_t;
1024 typedef int difference_type;
1025 typedef ValueIteratorBase SelfType;
1027 bool operator==(
const SelfType& other)
const {
return isEqual(other); }
1029 bool operator!=(
const SelfType& other)
const {
return !isEqual(other); }
1031 difference_type operator-(
const SelfType& other)
const {
1032 return other.computeDistance(*
this);
1045 std::string name()
const;
1050 JSONCPP_DEPRECATED(
"Use `key = name();` instead.")
1051 char const* memberName() const;
1055 char const* memberName(
char const** end) const;
1058 Value& deref() const;
1064 difference_type computeDistance(const SelfType& other) const;
1066 bool isEqual(const SelfType& other) const;
1068 void copy(const SelfType& other);
1071 Value::ObjectValues::iterator current_;
1078 ValueIteratorBase();
1079 explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
1085 class JSON_API ValueConstIterator : public ValueIteratorBase {
1089 typedef const Value value_type;
1092 typedef const Value& reference;
1093 typedef const Value* pointer;
1094 typedef ValueConstIterator SelfType;
1096 ValueConstIterator();
1101 explicit ValueConstIterator(
const Value::ObjectValues::iterator& current);
1103 SelfType& operator=(
const ValueIteratorBase& other);
1105 SelfType operator++(
int) {
1106 SelfType temp(*
this);
1111 SelfType operator--(
int) {
1112 SelfType temp(*
this);
1117 SelfType& operator--() {
1122 SelfType& operator++() {
1127 reference operator*()
const {
return deref(); }
1129 pointer operator->()
const {
return &deref(); }
1134 class JSON_API ValueIterator :
public ValueIteratorBase {
1138 typedef Value value_type;
1139 typedef unsigned int size_t;
1140 typedef int difference_type;
1141 typedef Value& reference;
1142 typedef Value* pointer;
1143 typedef ValueIterator SelfType;
1146 ValueIterator(
const ValueConstIterator& other);
1147 ValueIterator(
const ValueIterator& other);
1152 explicit ValueIterator(
const Value::ObjectValues::iterator& current);
1154 SelfType& operator=(
const SelfType& other);
1156 SelfType operator++(
int) {
1157 SelfType temp(*
this);
1162 SelfType operator--(
int) {
1163 SelfType temp(*
this);
1168 SelfType& operator--() {
1173 SelfType& operator++() {
1178 reference operator*()
const {
return deref(); }
1180 pointer operator->()
const {
return &deref(); }
1193 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1194 #pragma warning(pop)
1195 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1197 #endif // CPPTL_JSON_H_INCLUDED
1217 #ifndef CPPTL_JSON_READER_H_INCLUDED
1218 #define CPPTL_JSON_READER_H_INCLUDED
1220 #if !defined(JSON_IS_AMALGAMATION)
1221 #include "features.h"
1223 #endif // if !defined(JSON_IS_AMALGAMATION)
1232 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1233 #pragma warning(push)
1234 #pragma warning(disable : 4251)
1235 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1244 class JSON_API Reader {
1247 typedef const Char* Location;
1255 struct StructuredError {
1256 size_t offset_start;
1257 size_t offset_limit;
1258 std::string message;
1269 Reader(
const Features& features);
1286 parse(
const std::string& document, Value& root,
bool collectComments =
true);
1306 bool parse(
const char* beginDoc,
1309 bool collectComments =
true);
1313 bool parse(std::istream& is, Value& root,
bool collectComments =
true);
1324 JSONCPP_DEPRECATED(
"Use getFormattedErrorMessages() instead.")
1325 std::
string getFormatedErrorMessages() const;
1335 std::
string getFormattedErrorMessages() const;
1344 std::vector<StructuredError> getStructuredErrors() const;
1352 bool pushError(const Value& value, const
std::
string& message);
1361 bool pushError(const Value& value, const
std::
string& message, const Value& extra);
1371 tokenEndOfStream = 0,
1381 tokenArraySeparator,
1382 tokenMemberSeparator,
1397 std::string message_;
1401 typedef std::deque<ErrorInfo> Errors;
1403 bool readToken(Token& token);
1405 bool match(Location pattern,
int patternLength);
1407 bool readCStyleComment();
1408 bool readCppStyleComment();
1412 bool readObject(Token& token);
1413 bool readArray(Token& token);
1414 bool decodeNumber(Token& token);
1415 bool decodeNumber(Token& token, Value& decoded);
1416 bool decodeString(Token& token);
1417 bool decodeString(Token& token, std::string& decoded);
1418 bool decodeDouble(Token& token);
1419 bool decodeDouble(Token& token, Value& decoded);
1420 bool decodeUnicodeCodePoint(Token& token,
1423 unsigned int& unicode);
1424 bool decodeUnicodeEscapeSequence(Token& token,
1427 unsigned int& unicode);
1428 bool addError(
const std::string& message, Token& token, Location extra = 0);
1429 bool recoverFromError(TokenType skipUntilToken);
1430 bool addErrorAndRecover(
const std::string& message,
1432 TokenType skipUntilToken);
1433 void skipUntilSpace();
1434 Value& currentValue();
1437 getLocationLineAndColumn(Location location,
int& line,
int& column)
const;
1438 std::string getLocationLineAndColumn(Location location)
const;
1440 void skipCommentTokens(Token& token);
1442 typedef std::stack<Value*> Nodes;
1445 std::string document_;
1449 Location lastValueEnd_;
1451 std::string commentsBefore_;
1453 bool collectComments_;
1458 class JSON_API CharReader {
1460 virtual ~CharReader() {}
1479 char const* beginDoc,
char const* endDoc,
1480 Value* root, std::string* errs) = 0;
1484 virtual ~Factory() {}
1488 virtual CharReader* newCharReader()
const = 0;
1504 class JSON_API CharReaderBuilder :
public CharReader::Factory {
1543 CharReaderBuilder();
1544 virtual ~CharReaderBuilder();
1546 virtual CharReader* newCharReader()
const;
1555 Value& operator[](std::string key);
1576 CharReader::Factory
const&,
1578 Value* root, std::string* errs);
1604 JSON_API std::istream&
operator>>(std::istream&, Value&);
1608 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1609 #pragma warning(pop)
1610 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1612 #endif // CPPTL_JSON_READER_H_INCLUDED
1632 #ifndef JSON_WRITER_H_INCLUDED
1633 #define JSON_WRITER_H_INCLUDED
1635 #if !defined(JSON_IS_AMALGAMATION)
1637 #endif // if !defined(JSON_IS_AMALGAMATION)
1644 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1645 #pragma warning(push)
1646 #pragma warning(disable : 4251)
1647 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1666 class JSON_API StreamWriter {
1668 std::ostream* sout_;
1671 virtual ~StreamWriter();
1678 virtual int write(Value
const& root, std::ostream* sout) = 0;
1682 class JSON_API Factory {
1688 virtual StreamWriter* newStreamWriter()
const = 0;
1695 std::string JSON_API
writeString(StreamWriter::Factory
const& factory, Value
const& root);
1713 class JSON_API StreamWriterBuilder :
public StreamWriter::Factory {
1736 StreamWriterBuilder();
1737 virtual ~StreamWriterBuilder();
1742 virtual StreamWriter* newStreamWriter()
const;
1750 Value& operator[](std::string key);
1763 class JSON_API Writer {
1767 virtual std::string write(
const Value& root) = 0;
1779 class JSON_API FastWriter :
public Writer {
1783 virtual ~FastWriter() {}
1785 void enableYAMLCompatibility();
1792 void dropNullPlaceholders();
1794 void omitEndingLineFeed();
1797 virtual std::string write(
const Value& root);
1800 void writeValue(
const Value& value);
1802 std::string document_;
1803 bool yamlCompatiblityEnabled_;
1804 bool dropNullPlaceholders_;
1805 bool omitEndingLineFeed_;
1832 class JSON_API StyledWriter :
public Writer {
1835 virtual ~StyledWriter() {}
1842 virtual std::string write(
const Value& root);
1845 void writeValue(
const Value& value);
1846 void writeArrayValue(
const Value& value);
1847 bool isMultineArray(
const Value& value);
1848 void pushValue(
const std::string& value);
1850 void writeWithIndent(
const std::string& value);
1853 void writeCommentBeforeValue(
const Value& root);
1854 void writeCommentAfterValueOnSameLine(
const Value& root);
1855 bool hasCommentForValue(
const Value& value);
1856 static std::string normalizeEOL(
const std::string& text);
1858 typedef std::vector<std::string> ChildValues;
1860 ChildValues childValues_;
1861 std::string document_;
1862 std::string indentString_;
1865 bool addChildValues_;
1894 class JSON_API StyledStreamWriter {
1896 StyledStreamWriter(std::string indentation =
"\t");
1897 ~StyledStreamWriter() {}
1906 void write(std::ostream& out,
const Value& root);
1909 void writeValue(
const Value& value);
1910 void writeArrayValue(
const Value& value);
1911 bool isMultineArray(
const Value& value);
1912 void pushValue(
const std::string& value);
1914 void writeWithIndent(
const std::string& value);
1917 void writeCommentBeforeValue(
const Value& root);
1918 void writeCommentAfterValueOnSameLine(
const Value& root);
1919 bool hasCommentForValue(
const Value& value);
1920 static std::string normalizeEOL(
const std::string& text);
1922 typedef std::vector<std::string> ChildValues;
1924 ChildValues childValues_;
1925 std::ostream* document_;
1926 std::string indentString_;
1928 std::string indentation_;
1929 bool addChildValues_ : 1;
1933 #if defined(JSON_HAS_INT64)
1934 std::string JSON_API valueToString(Int value);
1935 std::string JSON_API valueToString(UInt value);
1936 #endif // if defined(JSON_HAS_INT64)
1937 std::string JSON_API valueToString(LargestInt value);
1938 std::string JSON_API valueToString(LargestUInt value);
1939 std::string JSON_API valueToString(
double value);
1940 std::string JSON_API valueToString(
bool value);
1941 std::string JSON_API valueToQuotedString(
const char* value);
1945 JSON_API std::ostream&
operator<<(std::ostream&,
const Value& root);
1949 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1950 #pragma warning(pop)
1951 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1953 #endif // JSON_WRITER_H_INCLUDED
1973 #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
1974 #define CPPTL_JSON_ASSERTIONS_H_INCLUDED
1979 #if !defined(JSON_IS_AMALGAMATION)
1981 #endif // if !defined(JSON_IS_AMALGAMATION)
1987 #if JSON_USE_EXCEPTION
1990 # define JSON_ASSERT(condition) \
1991 {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
1993 # define JSON_FAIL_MESSAGE(message) \
1995 std::ostringstream oss; oss << message; \
1996 Json::throwLogicError(oss.str()); \
2000 #else // JSON_USE_EXCEPTION
2002 # define JSON_ASSERT(condition) assert(condition)
2006 # define JSON_FAIL_MESSAGE(message) \
2008 std::ostringstream oss; oss << message; \
2009 assert(false && oss.str().c_str()); \
2016 #define JSON_ASSERT_MESSAGE(condition, message) \
2017 if (!(condition)) { \
2018 JSON_FAIL_MESSAGE(message); \
2021 #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
2031 #endif //ifndef JSON_AMALGATED_H_INCLUDED
UTF-8 string value.
Definition: json.h:439
JSON_API std::ostream & operator<<(std::ostream &, const Value &root)
Output using the StyledStreamWriter.
'null' value
Definition: json.h:435
a comment just after a value on the same line
Definition: json.h:447
bool JSON_API parseFromStream(CharReader::Factory const &, std::istream &, Value *root, std::string *errs)
Definition: jsoncpp.cc:2138
void throwLogicError(std::string const &msg)
used internally
Definition: jsoncpp.cc:2530
array value (ordered list)
Definition: json.h:441
JSON_API std::istream & operator>>(std::istream &, Value &)
Read from 'sin' into 'root'.
Definition: jsoncpp.cc:2152
object value (collection of name/value pairs).
Definition: json.h:442
CommentPlacement
Definition: json.h:445
bool value
Definition: json.h:440
a comment placed on the line before a value
Definition: json.h:446
JSON (JavaScript Object Notation).
Definition: json-forwards.h:172
void swap(Value &other)
Swap everything.
Definition: jsoncpp.cc:2823
unsigned integer value
Definition: json.h:437
double value
Definition: json.h:438
void throwRuntimeError(std::string const &msg)
used internally
Definition: jsoncpp.cc:2526
Represents a JSON value.
Definition: json.h:518
signed integer value
Definition: json.h:436
root value)
Definition: json.h:450
ValueType
Type of the value held by a Value object.
Definition: json.h:434
std::string JSON_API writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience. A StreamWriter will be created from the...
Definition: jsoncpp.cc:5066