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.8.3" 91 # define JSONCPP_VERSION_MAJOR 1 92 # define JSONCPP_VERSION_MINOR 8 93 # define JSONCPP_VERSION_PATCH 3 94 # define JSONCPP_VERSION_QUALIFIER 95 # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) 97 #ifdef JSONCPP_USING_SECURE_MEMORY 98 #undef JSONCPP_USING_SECURE_MEMORY 100 #define JSONCPP_USING_SECURE_MEMORY 0 104 #endif // JSON_VERSION_H_INCLUDED 112 #define JSONCPP_NO_LOCALE_SUPPORT 124 #ifndef JSON_CONFIG_H_INCLUDED 125 #define JSON_CONFIG_H_INCLUDED 142 #ifndef JSON_USE_EXCEPTION 143 #define JSON_USE_EXCEPTION 1 152 #include <cpptl/config.h> 153 #ifndef JSON_USE_CPPTL 154 #define JSON_USE_CPPTL 1 159 #define JSON_API CPPTL_API 160 #elif defined(JSON_DLL_BUILD) 161 #if defined(_MSC_VER) || defined(__MINGW32__) 162 #define JSON_API __declspec(dllexport) 163 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 164 #endif // if defined(_MSC_VER) 165 #elif defined(JSON_DLL) 166 #if defined(_MSC_VER) || defined(__MINGW32__) 167 #define JSON_API __declspec(dllimport) 168 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING 169 #endif // if defined(_MSC_VER) 170 #endif // ifdef JSON_IN_CPPTL 171 #if !defined(JSON_API) 180 #if defined(_MSC_VER) // MSVC 181 # if _MSC_VER <= 1200 // MSVC 6 184 # define JSON_USE_INT64_DOUBLE_CONVERSION 1 189 # pragma warning(disable : 4786) 192 # if _MSC_VER >= 1500 // MSVC 2008 193 # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) 197 #endif // defined(_MSC_VER) 202 #if __cplusplus >= 201103L 203 # define JSONCPP_OVERRIDE override 204 # define JSONCPP_NOEXCEPT noexcept 205 #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900 206 # define JSONCPP_OVERRIDE override 207 # define JSONCPP_NOEXCEPT throw() 208 #elif defined(_MSC_VER) && _MSC_VER >= 1900 209 # define JSONCPP_OVERRIDE override 210 # define JSONCPP_NOEXCEPT noexcept 212 # define JSONCPP_OVERRIDE 213 # define JSONCPP_NOEXCEPT throw() 216 #ifndef JSON_HAS_RVALUE_REFERENCES 218 #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 219 #define JSON_HAS_RVALUE_REFERENCES 1 220 #endif // MSVC >= 2010 223 #if __has_feature(cxx_rvalue_references) 224 #define JSON_HAS_RVALUE_REFERENCES 1 225 #endif // has_feature 227 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 228 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) 229 #define JSON_HAS_RVALUE_REFERENCES 1 230 #endif // GXX_EXPERIMENTAL 232 #endif // __clang__ || __GNUC__ 234 #endif // not defined JSON_HAS_RVALUE_REFERENCES 236 #ifndef JSON_HAS_RVALUE_REFERENCES 237 #define JSON_HAS_RVALUE_REFERENCES 0 241 # if __has_extension(attribute_deprecated_with_message) 242 # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) 244 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) 245 # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) 246 # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) 247 # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) 248 # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) 249 # endif // GNUC version 250 #endif // __clang__ || __GNUC__ 252 #if !defined(JSONCPP_DEPRECATED) 253 #define JSONCPP_DEPRECATED(message) 254 #endif // if !defined(JSONCPP_DEPRECATED) 257 # define JSON_USE_INT64_DOUBLE_CONVERSION 1 260 #if !defined(JSON_IS_AMALGAMATION) 262 # include "version.h" 264 # if JSONCPP_USING_SECURE_MEMORY 265 # include "allocator.h" 268 #endif // if !defined(JSON_IS_AMALGAMATION) 273 typedef unsigned int UInt;
274 #if defined(JSON_NO_INT64) 275 typedef int LargestInt;
276 typedef unsigned int LargestUInt;
277 #undef JSON_HAS_INT64 278 #else // if defined(JSON_NO_INT64) 280 #if defined(_MSC_VER) // Microsoft Visual Studio 281 typedef __int64 Int64;
282 typedef unsigned __int64 UInt64;
283 #else // if defined(_MSC_VER) // Other platforms, use long long 284 typedef int64_t Int64;
285 typedef uint64_t UInt64;
286 #endif // if defined(_MSC_VER) 287 typedef Int64 LargestInt;
288 typedef UInt64 LargestUInt;
289 #define JSON_HAS_INT64 290 #endif // if defined(JSON_NO_INT64) 291 #if JSONCPP_USING_SECURE_MEMORY 292 #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> > 293 #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> > 294 #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>> 295 #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> > 296 #define JSONCPP_ISTREAM std::istream 298 #define JSONCPP_STRING std::string 299 #define JSONCPP_OSTRINGSTREAM std::ostringstream 300 #define JSONCPP_OSTREAM std::ostream 301 #define JSONCPP_ISTRINGSTREAM std::istringstream 302 #define JSONCPP_ISTREAM std::istream 303 #endif // if JSONCPP_USING_SECURE_MEMORY 306 #endif // JSON_CONFIG_H_INCLUDED 326 #ifndef JSON_FORWARDS_H_INCLUDED 327 #define JSON_FORWARDS_H_INCLUDED 329 #if !defined(JSON_IS_AMALGAMATION) 331 #endif // if !defined(JSON_IS_AMALGAMATION) 347 typedef unsigned int ArrayIndex;
352 class ValueIteratorBase;
354 class ValueConstIterator;
358 #endif // JSON_FORWARDS_H_INCLUDED 378 #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 379 #define CPPTL_JSON_FEATURES_H_INCLUDED 381 #if !defined(JSON_IS_AMALGAMATION) 382 #include "forwards.h" 383 #endif // if !defined(JSON_IS_AMALGAMATION) 385 #pragma pack(push, 8) 435 #endif // CPPTL_JSON_FEATURES_H_INCLUDED 455 #ifndef CPPTL_JSON_H_INCLUDED 456 #define CPPTL_JSON_H_INCLUDED 458 #if !defined(JSON_IS_AMALGAMATION) 459 #include "forwards.h" 460 #endif // if !defined(JSON_IS_AMALGAMATION) 465 #ifndef JSON_USE_CPPTL_SMALLMAP 468 #include <cpptl/smallmap.h> 470 #ifdef JSON_USE_CPPTL 471 #include <cpptl/forwards.h> 477 #if !defined(JSONCPP_NORETURN) 478 # if defined(_MSC_VER) 479 # define JSONCPP_NORETURN __declspec(noreturn) 480 # elif defined(__GNUC__) 481 # define JSONCPP_NORETURN __attribute__ ((__noreturn__)) 483 # define JSONCPP_NORETURN 489 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 490 #pragma warning(push) 491 #pragma warning(disable : 4251) 492 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 494 #pragma pack(push, 8) 509 ~
Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
510 char const* what()
const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
589 explicit StaticString(
const char* czstring) : c_str_(czstring) {}
591 operator const char* ()
const {
return c_str_; }
593 const char* c_str()
const {
return c_str_; }
637 typedef std::vector<JSONCPP_STRING> Members;
640 typedef Json::UInt UInt;
641 typedef Json::Int Int;
642 #if defined(JSON_HAS_INT64) 643 typedef Json::UInt64 UInt64;
644 typedef Json::Int64 Int64;
645 #endif // defined(JSON_HAS_INT64) 646 typedef Json::LargestInt LargestInt;
647 typedef Json::LargestUInt LargestUInt;
648 typedef Json::ArrayIndex ArrayIndex;
652 static Value const& nullSingleton();
668 #if defined(JSON_HAS_INT64) 669 static const Int64 minInt64;
675 #endif // defined(JSON_HAS_INT64) 678 #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION 682 enum DuplicationPolicy
688 CZString(ArrayIndex index);
689 CZString(
char const* str,
unsigned length, DuplicationPolicy allocate);
690 CZString(CZString
const& other);
691 #if JSON_HAS_RVALUE_REFERENCES 692 CZString(CZString&& other);
695 CZString& operator=(
const CZString& other);
697 #if JSON_HAS_RVALUE_REFERENCES 698 CZString& operator=(CZString&& other);
701 bool operator<(CZString
const& other)
const;
702 bool operator==(CZString
const& other)
const;
703 ArrayIndex index()
const;
705 char const* data()
const;
706 unsigned length()
const;
707 bool isStaticString()
const;
710 void swap(CZString& other);
715 unsigned length_: 30;
722 StringStorage storage_;
727 #ifndef JSON_USE_CPPTL_SMALLMAP 728 typedef std::map<CZString, Value> ObjectValues;
730 typedef CppTL::SmallMap<CZString, Value> ObjectValues;
731 #endif // ifndef JSON_USE_CPPTL_SMALLMAP 732 #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION 753 #if defined(JSON_HAS_INT64) 756 #endif // if defined(JSON_HAS_INT64) 758 Value(
const char* value);
759 Value(
const char* begin,
const char* end);
776 Value(
const JSONCPP_STRING& value);
777 #ifdef JSON_USE_CPPTL 778 Value(
const CppTL::ConstString& value);
783 #if JSON_HAS_RVALUE_REFERENCES 794 void swap(
Value& other);
796 void swapPayload(
Value& other);
799 void copy(
const Value& other);
801 void copyPayload(
const Value& other);
806 bool operator<(
const Value& other)
const;
807 bool operator<=(
const Value& other)
const;
808 bool operator>=(
const Value& other)
const;
809 bool operator>(
const Value& other)
const;
810 bool operator==(
const Value& other)
const;
811 bool operator!=(
const Value& other)
const;
812 int compare(
const Value& other)
const;
814 const char* asCString()
const;
815 #if JSONCPP_USING_SECURE_MEMORY 816 unsigned getCStringLength()
const;
818 JSONCPP_STRING asString()
const;
823 char const** begin,
char const** end)
const;
824 #ifdef JSON_USE_CPPTL 825 CppTL::ConstString asConstString()
const;
829 #if defined(JSON_HAS_INT64) 830 Int64 asInt64()
const;
831 UInt64 asUInt64()
const;
832 #endif // if defined(JSON_HAS_INT64) 833 LargestInt asLargestInt()
const;
834 LargestUInt asLargestUInt()
const;
835 float asFloat()
const;
836 double asDouble()
const;
842 bool isInt64()
const;
844 bool isUInt64()
const;
845 bool isIntegral()
const;
846 bool isDouble()
const;
847 bool isNumeric()
const;
848 bool isString()
const;
849 bool isArray()
const;
850 bool isObject()
const;
852 bool isConvertibleTo(
ValueType other)
const;
855 ArrayIndex size()
const;
862 bool operator!()
const;
874 void resize(ArrayIndex size);
882 Value& operator[](ArrayIndex index);
890 Value& operator[](
int index);
895 const Value& operator[](ArrayIndex index)
const;
900 const Value& operator[](
int index)
const;
905 Value get(ArrayIndex index,
const Value& defaultValue)
const;
907 bool isValidIndex(ArrayIndex index)
const;
913 #if JSON_HAS_RVALUE_REFERENCES 920 Value& operator[](
const char* key);
923 const Value& operator[](
const char* key)
const;
926 Value& operator[](
const JSONCPP_STRING& key);
930 const Value& operator[](
const JSONCPP_STRING& key)
const;
944 #ifdef JSON_USE_CPPTL 945 Value& operator[](
const CppTL::ConstString& key);
949 const Value& operator[](
const CppTL::ConstString& key)
const;
951 Value get(
const char* key,
const Value& defaultValue)
const;
957 Value get(
const char* begin,
const char* end,
const Value& defaultValue)
const;
961 Value get(
const JSONCPP_STRING& key,
const Value& defaultValue)
const;
962 #ifdef JSON_USE_CPPTL 963 Value get(
const CppTL::ConstString& key,
const Value& defaultValue)
const;
967 Value const* find(
char const* begin,
char const* end)
const;
974 Value const* demand(
char const* begin,
char const* end);
982 JSONCPP_DEPRECATED(
"")
983 Value removeMember(const
char* key);
987 JSONCPP_DEPRECATED("")
988 Value removeMember(const JSONCPP_STRING& key);
991 bool removeMember(const
char* key,
Value* removed);
998 bool removeMember(JSONCPP_STRING const& key,
Value* removed);
1000 bool removeMember(const
char* begin, const
char* end,
Value* removed);
1007 bool removeIndex(ArrayIndex i,
Value* removed);
1011 bool isMember(const
char* key) const;
1014 bool isMember(const JSONCPP_STRING& key) const;
1016 bool isMember(const
char* begin, const
char* end) const;
1017 #ifdef JSON_USE_CPPTL 1018 bool isMember(
const CppTL::ConstString& key)
const;
1027 Members getMemberNames()
const;
1035 JSONCPP_DEPRECATED(
"Use setComment(JSONCPP_STRING const&) instead.")
1038 void setComment(const
char* comment,
size_t len,
CommentPlacement placement);
1040 void setComment(const JSONCPP_STRING& comment,
CommentPlacement placement);
1045 JSONCPP_STRING toStyledString() const;
1047 const_iterator begin() const;
1048 const_iterator end() const;
1055 void setOffsetStart(ptrdiff_t start);
1056 void setOffsetLimit(ptrdiff_t limit);
1057 ptrdiff_t getOffsetStart() const;
1058 ptrdiff_t getOffsetLimit() const;
1061 void initBasic(
ValueType type,
bool allocated = false);
1063 Value& resolveReference(const
char* key);
1064 Value& resolveReference(const
char* key, const
char* end);
1071 void setComment(
const char* text,
size_t len);
1095 unsigned int allocated_ : 1;
1097 CommentInfo* comments_;
1125 JSONCPP_STRING key_;
1144 Path(
const JSONCPP_STRING& path,
1151 const Value& resolve(
const Value& root)
const;
1158 typedef std::vector<const PathArgument*> InArgs;
1159 typedef std::vector<PathArgument> Args;
1161 void makePath(
const JSONCPP_STRING& path,
const InArgs& in);
1162 void addPathInArg(
const JSONCPP_STRING& path,
1164 InArgs::const_iterator& itInArg,
1165 PathArgument::Kind kind);
1166 void invalidPath(
const JSONCPP_STRING& path,
int location);
1177 typedef std::bidirectional_iterator_tag iterator_category;
1178 typedef unsigned int size_t;
1179 typedef int difference_type;
1182 bool operator==(
const SelfType& other)
const {
return isEqual(other); }
1184 bool operator!=(
const SelfType& other)
const {
return !isEqual(other); }
1186 difference_type operator-(
const SelfType& other)
const 1188 return other.computeDistance(*
this);
1201 JSONCPP_STRING name()
const;
1206 JSONCPP_DEPRECATED(
"Use `key = name();` instead.")
1207 char const* memberName()
const;
1211 char const* memberName(
char const** end)
const;
1214 Value& deref()
const;
1220 difference_type computeDistance(
const SelfType& other)
const;
1222 bool isEqual(
const SelfType& other)
const;
1227 Value::ObjectValues::iterator current_;
1289 reference operator*()
const {
return deref(); }
1291 pointer operator->()
const {
return &deref(); }
1302 typedef unsigned int size_t;
1303 typedef int difference_type;
1315 explicit ValueIterator(
const Value::ObjectValues::iterator& current);
1345 reference operator*()
const {
return deref(); }
1347 pointer operator->()
const {
return &deref(); }
1362 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1363 #pragma warning(pop) 1364 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1366 #endif // CPPTL_JSON_H_INCLUDED 1386 #ifndef CPPTL_JSON_READER_H_INCLUDED 1387 #define CPPTL_JSON_READER_H_INCLUDED 1389 #if !defined(JSON_IS_AMALGAMATION) 1390 #include "features.h" 1392 #endif // if !defined(JSON_IS_AMALGAMATION) 1401 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1402 #pragma warning(push) 1403 #pragma warning(disable : 4251) 1404 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1406 #pragma pack(push, 8) 1420 typedef const Char* Location;
1430 ptrdiff_t offset_start;
1431 ptrdiff_t offset_limit;
1432 JSONCPP_STRING message;
1460 parse(
const std::string& document,
Value& root,
bool collectComments =
true);
1480 bool parse(
const char* beginDoc,
1483 bool collectComments =
true);
1487 bool parse(JSONCPP_ISTREAM& is,
Value& root,
bool collectComments =
true);
1498 JSONCPP_DEPRECATED(
"Use getFormattedErrorMessages() instead.")
1499 JSONCPP_STRING getFormatedErrorMessages() const;
1509 JSONCPP_STRING getFormattedErrorMessages() const;
1526 bool pushError(const
Value& value, const JSONCPP_STRING& message);
1535 bool pushError(const
Value& value, const JSONCPP_STRING& message, const
Value& extra);
1546 tokenEndOfStream = 0,
1556 tokenArraySeparator,
1557 tokenMemberSeparator,
1574 JSONCPP_STRING message_;
1578 typedef std::deque<ErrorInfo> Errors;
1580 bool readToken(Token& token);
1582 bool match(Location pattern,
int patternLength);
1584 bool readCStyleComment();
1585 bool readCppStyleComment();
1589 bool readObject(Token& token);
1590 bool readArray(Token& token);
1591 bool decodeNumber(Token& token);
1592 bool decodeNumber(Token& token, Value& decoded);
1593 bool decodeString(Token& token);
1594 bool decodeString(Token& token, JSONCPP_STRING& decoded);
1595 bool decodeDouble(Token& token);
1596 bool decodeDouble(Token& token, Value& decoded);
1597 bool decodeUnicodeCodePoint(Token& token,
1600 unsigned int& unicode);
1601 bool decodeUnicodeEscapeSequence(Token& token,
1604 unsigned int& unicode);
1605 bool addError(
const JSONCPP_STRING& message, Token& token, Location extra = 0);
1606 bool recoverFromError(TokenType skipUntilToken);
1607 bool addErrorAndRecover(
const JSONCPP_STRING& message,
1609 TokenType skipUntilToken);
1610 void skipUntilSpace();
1611 Value& currentValue();
1614 getLocationLineAndColumn(Location location,
int& line,
int& column)
const;
1615 JSONCPP_STRING getLocationLineAndColumn(Location location)
const;
1617 void skipCommentTokens(Token& token);
1619 static bool containsNewLine(Location begin, Location end);
1620 static JSONCPP_STRING normalizeEOL(Location begin, Location end);
1622 typedef std::stack<Value*> Nodes;
1625 JSONCPP_STRING document_;
1629 Location lastValueEnd_;
1631 JSONCPP_STRING commentsBefore_;
1633 bool collectComments_;
1660 char const* beginDoc,
char const* endDoc,
1661 Value* root, JSONCPP_STRING* errs) = 0;
1670 virtual CharReader* newCharReader()
const = 0;
1732 CharReader* newCharReader() const JSONCPP_OVERRIDE;
1737 bool validate(
Json::
Value* invalid) const;
1741 Value& operator[](JSONCPP_STRING key);
1748 static
void setDefaults(
Json::
Value* settings);
1754 static
void strictMode(
Json::
Value* settings);
1790 JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&,
Value&);
1796 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1797 #pragma warning(pop) 1798 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1800 #endif // CPPTL_JSON_READER_H_INCLUDED 1820 #ifndef JSON_WRITER_H_INCLUDED 1821 #define JSON_WRITER_H_INCLUDED 1823 #if !defined(JSON_IS_AMALGAMATION) 1825 #endif // if !defined(JSON_IS_AMALGAMATION) 1832 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1833 #pragma warning(push) 1834 #pragma warning(disable : 4251) 1835 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 1837 #pragma pack(push, 8) 1860 JSONCPP_OSTREAM* sout_;
1870 virtual int write(
Value const& root, JSONCPP_OSTREAM* sout) = 0;
1940 StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
1945 bool validate(
Json::
Value* invalid) const;
1948 Value& operator[](JSONCPP_STRING key);
1955 static
void setDefaults(
Json::
Value* settings);
1966 virtual JSONCPP_STRING write(
const Value& root) = 0;
1985 void enableYAMLCompatibility();
1992 void dropNullPlaceholders();
1994 void omitEndingLineFeed();
1997 JSONCPP_STRING write(
const Value& root) JSONCPP_OVERRIDE;
2000 void writeValue(
const Value& value);
2002 JSONCPP_STRING document_;
2003 bool yamlCompatiblityEnabled_;
2004 bool dropNullPlaceholders_;
2005 bool omitEndingLineFeed_;
2043 JSONCPP_STRING write(
const Value& root) JSONCPP_OVERRIDE;
2046 void writeValue(
const Value& value);
2047 void writeArrayValue(
const Value& value);
2048 bool isMultineArray(
const Value& value);
2049 void pushValue(
const JSONCPP_STRING& value);
2051 void writeWithIndent(
const JSONCPP_STRING& value);
2054 void writeCommentBeforeValue(
const Value& root);
2055 void writeCommentAfterValueOnSameLine(
const Value& root);
2056 bool hasCommentForValue(
const Value& value);
2057 static JSONCPP_STRING normalizeEOL(
const JSONCPP_STRING& text);
2059 typedef std::vector<JSONCPP_STRING> ChildValues;
2061 ChildValues childValues_;
2062 JSONCPP_STRING document_;
2063 JSONCPP_STRING indentString_;
2064 unsigned int rightMargin_;
2065 unsigned int indentSize_;
2066 bool addChildValues_;
2110 void write(JSONCPP_OSTREAM& out,
const Value& root);
2113 void writeValue(
const Value& value);
2114 void writeArrayValue(
const Value& value);
2115 bool isMultineArray(
const Value& value);
2116 void pushValue(
const JSONCPP_STRING& value);
2118 void writeWithIndent(
const JSONCPP_STRING& value);
2121 void writeCommentBeforeValue(
const Value& root);
2122 void writeCommentAfterValueOnSameLine(
const Value& root);
2123 bool hasCommentForValue(
const Value& value);
2124 static JSONCPP_STRING normalizeEOL(
const JSONCPP_STRING& text);
2126 typedef std::vector<JSONCPP_STRING> ChildValues;
2128 ChildValues childValues_;
2129 JSONCPP_OSTREAM* document_;
2130 JSONCPP_STRING indentString_;
2131 unsigned int rightMargin_;
2132 JSONCPP_STRING indentation_;
2133 bool addChildValues_ : 1;
2137 #if defined(JSON_HAS_INT64) 2138 JSONCPP_STRING JSON_API valueToString(Int value);
2139 JSONCPP_STRING JSON_API valueToString(UInt value);
2140 #endif // if defined(JSON_HAS_INT64) 2141 JSONCPP_STRING JSON_API valueToString(LargestInt value);
2142 JSONCPP_STRING JSON_API valueToString(LargestUInt value);
2143 JSONCPP_STRING JSON_API valueToString(
double value);
2144 JSONCPP_STRING JSON_API valueToString(
bool value);
2145 JSONCPP_STRING JSON_API valueToQuotedString(
const char* value);
2149 JSON_API JSONCPP_OSTREAM&
operator<<(JSONCPP_OSTREAM&,
const Value& root);
2155 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 2156 #pragma warning(pop) 2157 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 2159 #endif // JSON_WRITER_H_INCLUDED 2179 #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED 2180 #define CPPTL_JSON_ASSERTIONS_H_INCLUDED 2185 #if !defined(JSON_IS_AMALGAMATION) 2187 #endif // if !defined(JSON_IS_AMALGAMATION) 2193 #if JSON_USE_EXCEPTION 2196 # define JSON_ASSERT(condition) \ 2197 {if (!(condition)) {Json::throwLogicError( "assert json failed" );}} 2199 # define JSON_FAIL_MESSAGE(message) \ 2201 JSONCPP_OSTRINGSTREAM oss; oss << message; \ 2202 Json::throwLogicError(oss.str()); \ 2206 #else // JSON_USE_EXCEPTION 2208 # define JSON_ASSERT(condition) assert(condition) 2212 # define JSON_FAIL_MESSAGE(message) \ 2214 JSONCPP_OSTRINGSTREAM oss; oss << message; \ 2215 assert(false && oss.str().c_str()); \ 2222 #define JSON_ASSERT_MESSAGE(condition, message) \ 2223 if (!(condition)) { \ 2224 JSON_FAIL_MESSAGE(message); \ 2227 #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED 2237 #endif //ifndef JSON_AMALGATED_H_INCLUDED Outputs a Value in JSON format without formatting (not human friendly).
Definition: json.h:1978
A simple abstract factory.
Definition: json.h:1874
Writes a Value in JSON format in a human friendly way.
Definition: json.h:2032
static const Value & null
We regret this reference to a global instance; prefer the simpler Value().
Definition: json.h:650
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
Definition: json.h:672
base class for Value iterators.
Definition: json.h:1174
array value (ordered list)
Definition: json.h:554
static const Value & nullRef
just a kludge for binary-compatibility; same as null
Definition: json.h:651
JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const &msg)
used internally
unsigned integer value
Definition: json.h:550
Json::Value settings_
Definition: json.h:1727
root value)
Definition: json.h:564
object value (collection of name/value pairs).
Definition: json.h:555
bool JSON_API parseFromStream(CharReader::Factory const &, JSONCPP_ISTREAM &, Value *root, std::string *errs)
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value.
Definition: json.h:664
Lightweight wrapper to tag static string.
Definition: json.h:586
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
Definition: json.h:666
An error tagged with where in the JSON text it was encountered.
Definition: json.h:1428
const iterator for object and array value.
Definition: json.h:1241
Experimental and untested: represents an element of the "path" to access a node.
Definition: json.h:1108
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value.
Definition: json.h:655
'null' value
Definition: json.h:548
bool allowComments_
true if comments are allowed. Default: true.
Definition: json.h:418
CommentPlacement
Definition: json.h:558
JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const &msg)
used internally
bool allowNumericKeys_
true if numeric object key are allowed. Default: false.
Definition: json.h:428
JSON (JavaScript Object Notation).
Definition: json-forwards.h:237
bool allowDroppedNullPlaceholders_
true if dropped null placeholders are allowed. Default: false.
Definition: json.h:425
void swap(Value &other)
Swap everything.
Experimental and untested: represents a "path" to access a node.
Definition: json.h:1141
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
Definition: json.h:674
double value
Definition: json.h:551
JSONCPP_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...
Json::Value settings_
Definition: json.h:1932
Abstract class for writers.
Definition: json.h:1961
Represents a JSON value.
Definition: json.h:633
JSON_API JSONCPP_OSTREAM & operator<<(JSONCPP_OSTREAM &, const Value &root)
Output using the StyledStreamWriter.
static const Int minInt
Minimum signed int value that can be stored in a Json::Value.
Definition: json.h:662
Unserialize a JSON document into a Value.
Definition: json.h:1416
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
Definition: json.h:2094
Iterator for object and array value.
Definition: json.h:1296
ValueType
Type of the value held by a Value object.
Definition: json.h:546
bool strictRoot_
Definition: json.h:422
bool value
Definition: json.h:553
signed integer value
Definition: json.h:549
Build a CharReader implementation.
Definition: json.h:1686
Configuration passed to reader and writer. This configuration object can be used to force the Reader ...
Definition: json.h:394
a comment placed on the line before a value
Definition: json.h:560
UTF-8 string value.
Definition: json.h:552
a comment just after a value on the same line
Definition: json.h:561
Build a StreamWriter implementation.
Definition: json.h:1906
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value.
Definition: json.h:657
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value.
Definition: json.h:659