78 #ifndef JSON_IS_AMALGAMATION
79 #error "Compile with -I PATH_TO_JSON_DIRECTORY"
92 #ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
93 #define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
111 result[0] =
static_cast<char>(cp);
112 }
else if (cp <= 0x7FF) {
114 result[1] =
static_cast<char>(0x80 | (0x3f & cp));
115 result[0] =
static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
116 }
else if (cp <= 0xFFFF) {
118 result[2] =
static_cast<char>(0x80 | (0x3f & cp));
119 result[1] = 0x80 |
static_cast<char>((0x3f & (cp >> 6)));
120 result[0] = 0xE0 |
static_cast<char>((0xf & (cp >> 12)));
121 }
else if (cp <= 0x10FFFF) {
123 result[3] =
static_cast<char>(0x80 | (0x3f & cp));
124 result[2] =
static_cast<char>(0x80 | (0x3f & (cp >> 6)));
125 result[1] =
static_cast<char>(0x80 | (0x3f & (cp >> 12)));
126 result[0] =
static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
152 *--current = char(value % 10) +
'0';
154 }
while (value != 0);
163 while (begin < end) {
173 #endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
193 #if !defined(JSON_IS_AMALGAMATION)
194 #include <json/assertions.h>
195 #include <json/reader.h>
196 #include <json/value.h>
197 #include "json_tool.h"
198 #endif // if !defined(JSON_IS_AMALGAMATION)
208 #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
209 #define snprintf _snprintf
212 #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
214 #pragma warning(disable : 4996)
222 #if __cplusplus >= 201103L
232 : allowComments_(true), strictRoot_(false),
233 allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
250 for (; begin < end; ++begin)
251 if (*begin ==
'\n' || *begin ==
'\r')
260 : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
261 lastValue_(), commentsBefore_(), features_(
Features::all()),
262 collectComments_() {}
265 : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
266 lastValue_(), commentsBefore_(), features_(features), collectComments_() {
273 const char* end = begin +
document_.length();
274 return parse(begin, end, root, collectComments);
286 std::getline(sin, doc, (
char)EOF);
287 return parse(doc, root, collectComments);
293 bool collectComments) {
295 collectComments =
false;
324 "A valid JSON document must be either an array or an object value.",
342 bool successful =
true;
349 switch (token.
type_) {
404 return addError(
"Syntax error: value, object or array expected.", token);
468 ok =
match(
"rue", 3);
472 ok =
match(
"alse", 4);
476 ok =
match(
"ull", 3);
500 if (c ==
' ' || c ==
'\t' || c ==
'\r' || c ==
'\n')
510 int index = patternLength;
512 if (
current_[index] != pattern[index])
521 bool successful =
false;
542 std::string normalized;
543 normalized.reserve(end - begin);
545 while (current != end) {
548 if (current != end && *current ==
'\n')
563 const std::string& normalized =
normalizeEOL(begin, end);
601 while (c >=
'0' && c <=
'9')
606 while (c >=
'0' && c <=
'9')
610 if (c ==
'e' || c ==
'E') {
612 if (c ==
'+' || c ==
'-')
614 while (c >=
'0' && c <=
'9')
638 bool initialTokenOk =
true;
675 "Missing ',' or '}' in object declaration", comma,
tokenObjectEnd);
677 bool finalizeTokenOk =
true;
715 if (!ok || badTokenType) {
717 "Missing ',' or ']' in array declaration", token,
tokenArrayEnd);
740 bool isNegative = *current ==
'-';
747 Value::LargestUInt threshold = maxIntegerValue / 10;
748 Value::LargestUInt value = 0;
749 while (current < token.
end_) {
751 if (c < '0' || c >
'9')
754 if (value >= threshold) {
759 if (value > threshold || current != token.
end_ ||
760 digit > maxIntegerValue % 10) {
764 value = value * 10 + digit;
787 const int bufferSize = 32;
793 return addError(
"Unable to parse token length", token);
801 char format[] =
"%lf";
803 if (length <= bufferSize) {
804 Char buffer[bufferSize + 1];
805 memcpy(buffer, token.
start_, length);
807 count = sscanf(buffer, format, &value);
810 count = sscanf(buffer.c_str(), format, &value);
815 "' is not a number.",
822 std::string decoded_string;
825 Value decoded(decoded_string);
833 decoded.reserve(token.
end_ - token.
start_ - 2);
836 while (current != end) {
840 else if (c ==
'\\') {
842 return addError(
"Empty escape sequence in string", token, current);
843 Char escape = *current++;
870 unsigned int unicode;
876 return addError(
"Bad escape sequence in string", token, current);
888 unsigned int& unicode) {
892 if (unicode >= 0xD800 && unicode <= 0xDBFF) {
894 if (end - current < 6)
896 "additional six characters expected to parse unicode surrogate pair.",
899 unsigned int surrogatePair;
900 if (*(current++) ==
'\\' && *(current++) ==
'u') {
902 unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
906 return addError(
"expecting another \\u token to begin the second half of "
907 "a unicode surrogate pair",
917 unsigned int& unicode) {
918 if (end - current < 4)
920 "Bad unicode escape sequence in string: four digits expected.",
924 for (
int index = 0; index < 4; ++index) {
927 if (c >=
'0' && c <=
'9')
929 else if (c >=
'a' && c <=
'f')
930 unicode += c -
'a' + 10;
931 else if (c >=
'A' && c <=
'F')
932 unicode += c -
'A' + 10;
935 "Bad unicode escape sequence in string: hexadecimal digit expected.",
953 int errorCount = int(
errors_.size());
986 while (current < location && current !=
end_) {
989 if (*current ==
'\n')
991 lastLineStart = current;
993 }
else if (c ==
'\n') {
994 lastLineStart = current;
999 column = int(location - lastLineStart) + 1;
1006 char buffer[18 + 16 + 16 + 1];
1007 #if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
1009 _snprintf(buffer,
sizeof(buffer),
"Line %d, Column %d", line, column);
1011 sprintf_s(buffer,
sizeof(buffer),
"Line %d, Column %d", line, column);
1014 snprintf(buffer,
sizeof(buffer),
"Line %d, Column %d", line, column);
1025 std::string formattedMessage;
1026 for (Errors::const_iterator itError =
errors_.begin();
1032 formattedMessage +=
" " + error.
message_ +
"\n";
1037 return formattedMessage;
1041 std::vector<Reader::StructuredError> allErrors;
1042 for (Errors::const_iterator itError =
errors_.begin();
1050 allErrors.push_back(structured);
1113 : allowComments_(true), strictRoot_(false)
1114 , allowDroppedNullPlaceholders_(false), allowNumericKeys_(false)
1115 , allowSingleQuotes_(false)
1116 , failIfExtra_(false)
1137 bool parse(
const char* beginDoc,
1140 bool collectComments =
true);
1205 unsigned int& unicode);
1209 unsigned int& unicode);
1243 : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
1244 lastValue_(), commentsBefore_(), features_(features), collectComments_() {
1250 bool collectComments) {
1252 collectComments =
false;
1273 addError(
"Extra non-whitespace after JSON value.", token);
1285 token.
end_ = endDoc;
1287 "A valid JSON document must be either an array or an object value.",
1300 bool successful =
true;
1307 switch (token.
type_) {
1362 return addError(
"Syntax error: value, object or array expected.", token);
1432 ok =
match(
"rue", 3);
1436 ok =
match(
"alse", 4);
1440 ok =
match(
"ull", 3);
1464 if (c ==
' ' || c ==
'\t' || c ==
'\r' || c ==
'\n')
1474 int index = patternLength;
1476 if (
current_[index] != pattern[index])
1485 bool successful =
false;
1508 const std::string& normalized =
normalizeEOL(begin, end);
1546 while (c >=
'0' && c <=
'9')
1551 while (c >=
'0' && c <=
'9')
1555 if (c ==
'e' || c ==
'E') {
1557 if (c ==
'+' || c ==
'-')
1559 while (c >=
'0' && c <=
'9')
1595 bool initialTokenOk =
true;
1598 if (!initialTokenOk)
1622 std::string msg =
"Duplicate key: '" + name +
"'";
1638 "Missing ',' or '}' in object declaration", comma,
tokenObjectEnd);
1640 bool finalizeTokenOk =
true;
1678 if (!ok || badTokenType) {
1680 "Missing ',' or ']' in array declaration", token,
tokenArrayEnd);
1703 bool isNegative = *current ==
'-';
1710 Value::LargestUInt threshold = maxIntegerValue / 10;
1711 Value::LargestUInt value = 0;
1712 while (current < token.
end_) {
1713 Char c = *current++;
1714 if (c < '0' || c >
'9')
1717 if (value >= threshold) {
1722 if (value > threshold || current != token.
end_ ||
1723 digit > maxIntegerValue % 10) {
1727 value = value * 10 + digit;
1750 const int bufferSize = 32;
1756 return addError(
"Unable to parse token length", token);
1764 char format[] =
"%lf";
1766 if (length <= bufferSize) {
1767 Char buffer[bufferSize + 1];
1768 memcpy(buffer, token.
start_, length);
1770 count = sscanf(buffer, format, &value);
1772 std::string buffer(token.
start_, token.
end_);
1773 count = sscanf(buffer.c_str(), format, &value);
1778 "' is not a number.",
1785 std::string decoded_string;
1788 Value decoded(decoded_string);
1796 decoded.reserve(token.
end_ - token.
start_ - 2);
1799 while (current != end) {
1800 Char c = *current++;
1803 else if (c ==
'\\') {
1805 return addError(
"Empty escape sequence in string", token, current);
1806 Char escape = *current++;
1833 unsigned int unicode;
1839 return addError(
"Bad escape sequence in string", token, current);
1851 unsigned int& unicode) {
1855 if (unicode >= 0xD800 && unicode <= 0xDBFF) {
1857 if (end - current < 6)
1859 "additional six characters expected to parse unicode surrogate pair.",
1862 unsigned int surrogatePair;
1863 if (*(current++) ==
'\\' && *(current++) ==
'u') {
1865 unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
1869 return addError(
"expecting another \\u token to begin the second half of "
1870 "a unicode surrogate pair",
1880 unsigned int& unicode) {
1881 if (end - current < 4)
1883 "Bad unicode escape sequence in string: four digits expected.",
1887 for (
int index = 0; index < 4; ++index) {
1888 Char c = *current++;
1890 if (c >=
'0' && c <=
'9')
1892 else if (c >=
'a' && c <=
'f')
1893 unicode += c -
'a' + 10;
1894 else if (c >=
'A' && c <=
'F')
1895 unicode += c -
'A' + 10;
1898 "Bad unicode escape sequence in string: hexadecimal digit expected.",
1916 int errorCount = int(
errors_.size());
1945 int& column)
const {
1949 while (current < location && current !=
end_) {
1950 Char c = *current++;
1952 if (*current ==
'\n')
1954 lastLineStart = current;
1956 }
else if (c ==
'\n') {
1957 lastLineStart = current;
1962 column = int(location - lastLineStart) + 1;
1969 char buffer[18 + 16 + 16 + 1];
1970 #if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
1972 _snprintf(buffer,
sizeof(buffer),
"Line %d, Column %d", line, column);
1974 sprintf_s(buffer,
sizeof(buffer),
"Line %d, Column %d", line, column);
1977 snprintf(buffer,
sizeof(buffer),
"Line %d, Column %d", line, column);
1983 std::string formattedMessage;
1984 for (Errors::const_iterator itError =
errors_.begin();
1990 formattedMessage +=
" " + error.
message_ +
"\n";
1995 return formattedMessage;
1999 std::vector<OurReader::StructuredError> allErrors;
2000 for (Errors::const_iterator itError =
errors_.begin();
2008 allErrors.push_back(structured);
2058 bool collectComments,
2064 char const* beginDoc,
char const* endDoc,
2065 Value* root, std::string* errs) {
2096 valid_keys->clear();
2097 valid_keys->insert(
"collectComments");
2098 valid_keys->insert(
"allowComments");
2099 valid_keys->insert(
"strictRoot");
2100 valid_keys->insert(
"allowDroppedNullPlaceholders");
2101 valid_keys->insert(
"allowNumericKeys");
2102 valid_keys->insert(
"allowSingleQuotes");
2103 valid_keys->insert(
"stackLimit");
2104 valid_keys->insert(
"failIfExtra");
2105 valid_keys->insert(
"rejectDupKeys");
2110 if (!invalid) invalid = &my_invalid;
2112 std::set<std::string> valid_keys;
2115 size_t n = keys.size();
2116 for (
size_t i = 0; i < n; ++i) {
2117 std::string
const& key = keys[i];
2118 if (valid_keys.find(key) == valid_keys.end()) {
2122 return 0u == inv.
size();
2132 (*settings)[
"allowComments"] =
false;
2133 (*settings)[
"strictRoot"] =
true;
2134 (*settings)[
"allowDroppedNullPlaceholders"] =
false;
2135 (*settings)[
"allowNumericKeys"] =
false;
2136 (*settings)[
"allowSingleQuotes"] =
false;
2137 (*settings)[
"failIfExtra"] =
true;
2138 (*settings)[
"rejectDupKeys"] =
true;
2145 (*settings)[
"collectComments"] =
true;
2146 (*settings)[
"allowComments"] =
true;
2147 (*settings)[
"strictRoot"] =
false;
2148 (*settings)[
"allowDroppedNullPlaceholders"] =
false;
2149 (*settings)[
"allowNumericKeys"] =
false;
2150 (*settings)[
"allowSingleQuotes"] =
false;
2151 (*settings)[
"stackLimit"] = 1000;
2152 (*settings)[
"failIfExtra"] =
false;
2153 (*settings)[
"rejectDupKeys"] =
false;
2162 Value* root, std::string* errs)
2164 std::ostringstream ssin;
2165 ssin << sin.rdbuf();
2166 std::string doc = ssin.str();
2167 char const* begin = doc.data();
2168 char const* end = begin + doc.size();
2171 return reader->parse(begin, end, root, errs);
2180 "Error from reader: %s",
2221 : current_(), isNull_(true) {
2225 const Value::ObjectValues::iterator& current)
2226 : current_(current), isNull_(false) {}
2242 #ifdef JSON_USE_CPPTL_SMALLMAP
2282 if (czstring.
data()) {
2292 if (!czstring.
data())
2293 return czstring.
index();
2301 if (!key)
return std::string();
2302 return std::string(key, end);
2306 const char*
name = (*current_).first.data();
2307 return name ? name :
"";
2311 const char*
name = (*current_).first.data();
2316 *end = name + (*current_).first.length();
2331 const Value::ObjectValues::iterator& current)
2384 #if !defined(JSON_IS_AMALGAMATION)
2385 #include <json/assertions.h>
2386 #include <json/value.h>
2387 #include <json/writer.h>
2388 #endif // if !defined(JSON_IS_AMALGAMATION)
2394 #ifdef JSON_USE_CPPTL
2395 #include <cpptl/conststring.h>
2398 #include <algorithm>
2400 #define JSON_ASSERT_UNREACHABLE assert(false)
2407 #if defined(__ARMEL__)
2408 #define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
2410 #define ALIGNAS(byte_alignment)
2412 static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 };
2420 #if defined(JSON_HAS_INT64)
2428 #endif // defined(JSON_HAS_INT64)
2433 #if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2434 template <
typename T,
typename U>
2435 static inline bool InRange(
double d, T min, U max) {
2436 return d >= min && d <= max;
2438 #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2439 static inline double integerToDouble(
Json::UInt64 value) {
2440 return static_cast<double>(
Int64(value / 2)) * 2.0 +
Int64(value & 1);
2443 template <
typename T>
static inline double integerToDouble(T value) {
2444 return static_cast<double>(value);
2447 template <
typename T,
typename U>
2448 static inline bool InRange(
double d, T min, U max) {
2449 return d >= integerToDouble(min) && d <= integerToDouble(max);
2451 #endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2465 length = Value::maxInt - 1;
2467 char* newString =
static_cast<char*
>(malloc(length + 1));
2468 if (newString == NULL) {
2470 "in Json::Value::duplicateStringValue(): "
2471 "Failed to allocate string value buffer");
2473 memcpy(newString, value, length);
2474 newString[length] = 0;
2482 unsigned int length)
2487 "in Json::Value::duplicateAndPrefixStringValue(): "
2488 "length too big for prefixing");
2489 unsigned actualLength = length +
sizeof(unsigned) + 1U;
2490 char* newString =
static_cast<char*
>(malloc(actualLength));
2491 if (newString == 0) {
2493 "in Json::Value::duplicateAndPrefixStringValue(): "
2494 "Failed to allocate string value buffer");
2496 *
reinterpret_cast<unsigned*
>(newString) = length;
2497 memcpy(newString +
sizeof(
unsigned), value, length);
2498 newString[actualLength - 1U] = 0;
2502 bool isPrefixed,
char const* prefixed,
2503 unsigned* length,
char const** value)
2506 *length = strlen(prefixed);
2509 *length = *
reinterpret_cast<unsigned const*
>(prefixed);
2510 *value = prefixed +
sizeof(unsigned);
2526 #if !defined(JSON_IS_AMALGAMATION)
2528 #include "json_valueiterator.inl"
2529 #endif // if !defined(JSON_IS_AMALGAMATION)
2537 virtual char const* what()
const throw();
2557 return msg_.c_str();
2596 text[0] ==
'\0' || text[0] ==
'/',
2597 "in Json::Value::setComment(): Comments must start with /");
2624 : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
2636 if (cstr_ && storage_.policy_ == duplicate)
2651 if (!cstr_)
return index_ < other.
index_;
2654 unsigned this_len = this->storage_.length_;
2656 unsigned min_len = std::min(this_len, other_len);
2657 int comp = memcmp(this->cstr_, other.
cstr_, min_len);
2658 if (comp < 0)
return true;
2659 if (comp > 0)
return false;
2660 return (this_len < other_len);
2664 if (!cstr_)
return index_ == other.
index_;
2667 unsigned this_len = this->storage_.length_;
2669 if (this_len != other_len)
return false;
2670 int comp = memcmp(this->cstr_, other.
cstr_, this_len);
2729 #if defined(JSON_HAS_INT64)
2738 #endif // defined(JSON_HAS_INT64)
2767 #ifdef JSON_USE_CPPTL
2882 return typeDelta < 0 ?
true :
false;
2902 char const* this_str;
2903 char const* other_str;
2906 unsigned min_len = std::min(this_len, other_len);
2907 int comp = memcmp(this_str, other_str, min_len);
2908 if (comp < 0)
return true;
2909 if (comp > 0)
return false;
2910 return (this_len < other_len);
2936 int temp = other.
type_;
2957 char const* this_str;
2958 char const* other_str;
2961 if (this_len != other_len)
return false;
2962 int comp = memcmp(this_str, other_str, this_len);
2979 "in Json::Value::asCString(): requires stringValue");
2982 char const* this_str;
2992 *end = *str + length;
3004 char const* this_str;
3006 return std::string(this_str, this_len);
3021 #ifdef JSON_USE_CPPTL
3022 CppTL::ConstString Value::asConstString()
const {
3027 return CppTL::ConstString(str, len);
3041 "double out of Int range");
3063 "double out of UInt range");
3075 #if defined(JSON_HAS_INT64)
3086 "double out of Int64 range");
3107 "double out of UInt64 range");
3118 #endif // if defined(JSON_HAS_INT64)
3121 #if defined(JSON_NO_INT64)
3129 #if defined(JSON_NO_INT64)
3141 #if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3143 #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3145 #endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3163 #if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3165 #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3167 #endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3243 ObjectValues::const_iterator itLast =
value_.
map_->end();
3245 return (*itLast).first.index() + 1;
3257 return size() == 0u;
3267 "in Json::Value::clear(): requires complex value");
3282 "in Json::Value::resize(): requires arrayValue");
3288 else if (newSize > oldSize)
3289 (*this)[newSize - 1];
3291 for (
ArrayIndex index = newSize; index < oldSize; ++index) {
3294 assert(
size() == newSize);
3301 "in Json::Value::operator[](ArrayIndex): requires arrayValue");
3305 ObjectValues::iterator it =
value_.
map_->lower_bound(key);
3306 if (it !=
value_.
map_->end() && (*it).first == key)
3307 return (*it).second;
3309 ObjectValues::value_type defaultValue(key,
nullRef);
3311 return (*it).second;
3317 "in Json::Value::operator[](int index): index cannot be negative");
3324 "in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
3328 ObjectValues::const_iterator it =
value_.
map_->find(key);
3331 return (*it).second;
3337 "in Json::Value::operator[](int index) const: index cannot be negative");
3355 "in Json::Value::resolveReference(): requires objectValue");
3360 ObjectValues::iterator it =
value_.
map_->lower_bound(actualKey);
3361 if (it !=
value_.
map_->end() && (*it).first == actualKey)
3362 return (*it).second;
3364 ObjectValues::value_type defaultValue(actualKey,
nullRef);
3366 Value& value = (*it).second;
3375 "in Json::Value::resolveReference(key, end): requires objectValue");
3380 ObjectValues::iterator it =
value_.
map_->lower_bound(actualKey);
3381 if (it !=
value_.
map_->end() && (*it).first == actualKey)
3382 return (*it).second;
3384 ObjectValues::value_type defaultValue(actualKey,
nullRef);
3386 Value& value = (*it).second;
3391 const Value* value = &((*this)[index]);
3392 return value == &
nullRef ? defaultValue : *value;
3401 "in Json::Value::find(key, end, found): requires objectValue or nullValue");
3404 ObjectValues::const_iterator it =
value_.
map_->find(actualKey);
3406 return &(*it).second;
3410 Value const* found =
find(key, key + strlen(key));
3416 Value const* found =
find(key.data(), key.data() + key.length());
3433 #ifdef JSON_USE_CPPTL
3439 Value const* found =
find(key.c_str(), key.end_c_str());
3450 return !found ? defaultValue : *found;
3454 return get(key, key + strlen(key), defaultValue);
3458 return get(key.data(), key.data() + key.length(), defaultValue);
3468 ObjectValues::iterator it =
value_.
map_->find(actualKey);
3471 *removed = it->second;
3481 return removeMember(key.data(), key.data() + key.length(), removed);
3486 "in Json::Value::removeMember(): requires objectValue");
3504 ObjectValues::iterator it =
value_.
map_->find(key);
3508 *removed = it->second;
3511 for (
ArrayIndex i = index; i < (oldSize - 1); ++i){
3517 ObjectValues::iterator itLast =
value_.
map_->find(keyLast);
3522 #ifdef JSON_USE_CPPTL
3524 const Value& defaultValue)
const {
3525 return get(key.c_str(), key.end_c_str(), defaultValue);
3532 return NULL != value;
3536 return isMember(key, key + strlen(key));
3540 return isMember(key.data(), key.data() + key.length());
3543 #ifdef JSON_USE_CPPTL
3545 return isMember(key.c_str(), key.end_c_str());
3552 "in Json::Value::getMemberNames(), value must be objectValue");
3557 ObjectValues::const_iterator it =
value_.
map_->begin();
3558 ObjectValues::const_iterator itEnd =
value_.
map_->end();
3559 for (; it != itEnd; ++it) {
3560 members.push_back(std::string((*it).first.data(),
3561 (*it).first.length()));
3592 double integral_part;
3593 return modf(d, &integral_part) == 0.0;
3631 #if defined(JSON_HAS_INT64)
3646 #endif // JSON_HAS_INT64
3651 #if defined(JSON_HAS_INT64)
3666 #endif // JSON_HAS_INT64
3671 #if defined(JSON_HAS_INT64)
3691 if ((len > 0) && (comment[len-1] ==
'\n')) {
3699 setComment(comment, strlen(comment), placement);
3703 setComment(comment.c_str(), comment.length(), placement);
3726 return writer.
write(*
this);
3787 : key_(), index_(index), kind_(kindIndex) {}
3790 : key_(key), index_(), kind_(kindKey) {}
3793 : key_(key.c_str()), index_(), kind_(kindKey) {}
3814 const char* current = path.c_str();
3815 const char* end = current + path.length();
3816 InArgs::const_iterator itInArg = in.begin();
3817 while (current != end) {
3818 if (*current ==
'[') {
3820 if (*current ==
'%')
3824 for (; current != end && *current >=
'0' && *current <=
'9'; ++current)
3825 index = index * 10 +
ArrayIndex(*current -
'0');
3826 args_.push_back(index);
3828 if (current == end || *current++ !=
']')
3830 }
else if (*current ==
'%') {
3833 }
else if (*current ==
'.') {
3836 const char* beginName = current;
3837 while (current != end && !strchr(
"[.", *current))
3839 args_.push_back(std::string(beginName, current));
3846 InArgs::const_iterator& itInArg,
3848 if (itInArg == in.end()) {
3850 }
else if ((*itInArg)->kind_ != kind) {
3853 args_.push_back(**itInArg);
3862 const Value* node = &root;
3863 for (Args::const_iterator it =
args_.begin(); it !=
args_.end(); ++it) {
3869 node = &((*node)[arg.
index_]);
3874 node = &((*node)[arg.
key_]);
3885 const Value* node = &root;
3886 for (Args::const_iterator it =
args_.begin(); it !=
args_.end(); ++it) {
3890 return defaultValue;
3891 node = &((*node)[arg.
index_]);
3894 return defaultValue;
3895 node = &((*node)[arg.
key_]);
3897 return defaultValue;
3904 Value* node = &root;
3905 for (Args::const_iterator it =
args_.begin(); it !=
args_.end(); ++it) {
3911 node = &((*node)[arg.
index_]);
3916 node = &((*node)[arg.
key_]);
3942 #if !defined(JSON_IS_AMALGAMATION)
3943 #include <json/writer.h>
3944 #include "json_tool.h"
3945 #endif // if !defined(JSON_IS_AMALGAMATION)
3955 #if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0
3957 #define isfinite _finite
3958 #elif defined(__sun) && defined(__SVR4) //Solaris
3960 #define isfinite finite
3963 #define isfinite std::isfinite
3966 #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
3967 #define snprintf _snprintf
3968 #elif __cplusplus >= 201103L
3969 #define snprintf std::snprintf
3972 #if defined(__BORLANDC__)
3974 #define isfinite _finite
3975 #define snprintf _snprintf
3978 #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
3980 #pragma warning(disable : 4996)
3985 #if __cplusplus >= 201103L
4000 char const* end = str + len;
4001 while (end != str) {
4011 char* current = buffer +
sizeof(buffer);
4012 bool isNegative = value < 0;
4018 assert(current >= buffer);
4024 char* current = buffer +
sizeof(buffer);
4026 assert(current >= buffer);
4030 #if defined(JSON_HAS_INT64)
4040 #endif // # if defined(JSON_HAS_INT64)
4051 #if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with
4055 len = _snprintf(buffer,
sizeof(buffer),
"%.17g", value);
4057 len = sprintf_s(buffer,
sizeof(buffer),
"%.17g", value);
4061 len = snprintf(buffer,
sizeof(buffer),
"%.17g", value);
4064 if (value != value) {
4065 len = snprintf(buffer,
sizeof(buffer),
"null");
4066 }
else if (value < 0) {
4067 len = snprintf(buffer,
sizeof(buffer),
"-1e+9999");
4069 len = snprintf(buffer,
sizeof(buffer),
"1e+9999");
4085 if (strpbrk(value,
"\"\\\b\f\n\r\t") == NULL &&
4087 return std::string(
"\"") + value +
"\"";
4091 std::string::size_type maxsize =
4092 strlen(value) * 2 + 3;
4094 result.reserve(maxsize);
4096 for (
const char* c = value; *c != 0; ++c) {
4129 std::ostringstream oss;
4130 oss <<
"\\u" << std::hex << std::uppercase << std::setfill(
'0')
4131 << std::setw(4) <<
static_cast<int>(*c);
4132 result += oss.str();
4144 static char const*
strnpbrk(
char const* s,
char const* accept,
size_t n) {
4145 assert((s || !n) && accept);
4147 char const*
const end = s + n;
4148 for (
char const* cur = s; cur < end; ++cur) {
4150 for (
char const* a = accept; *a; ++a) {
4162 if (
strnpbrk(value,
"\"\\\b\f\n\r\t", length) == NULL &&
4164 return std::string(
"\"") + value +
"\"";
4168 std::string::size_type maxsize =
4171 result.reserve(maxsize);
4173 char const* end = value + length;
4174 for (
const char* c = value; c != end; ++c) {
4207 std::ostringstream oss;
4208 oss <<
"\\u" << std::hex << std::uppercase << std::setfill(
'0')
4209 << std::setw(4) <<
static_cast<int>(*c);
4210 result += oss.str();
4229 : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
4230 omitEndingLineFeed_(false) {}
4247 switch (value.
type()) {
4275 int size = value.
size();
4276 for (
int index = 0; index < size; ++index) {
4286 for (Value::Members::iterator it = members.begin(); it != members.end();
4288 const std::string& name = *it;
4289 if (it != members.begin())
4304 : rightMargin_(74), indentSize_(3), addChildValues_() {}
4318 switch (value.
type()) {
4349 if (members.empty())
4354 Value::Members::iterator it = members.begin();
4356 const std::string& name = *it;
4357 const Value& childValue = value[name];
4362 if (++it == members.end()) {
4377 unsigned size = value.
size();
4382 if (isArrayMultiLine) {
4388 const Value& childValue = value[index];
4396 if (++index == size) {
4409 for (
unsigned index = 0; index < size; ++index) {
4420 int size = value.
size();
4423 for (
int index = 0; index < size && !isMultiLine; ++index) {
4424 const Value& childValue = value[index];
4427 childValue.
size() > 0);
4433 int lineLength = 4 + (size - 1) * 2;
4434 for (
int index = 0; index < size; ++index) {
4442 isMultiLine = isMultiLine || lineLength >=
rightMargin_;
4484 std::string::const_iterator iter = comment.begin();
4485 while (iter != comment.end()) {
4487 if (*iter ==
'\n' &&
4488 (iter != comment.end() && *(iter + 1) ==
'/'))
4518 : document_(NULL), rightMargin_(74), indentation_(indentation),
4519 addChildValues_() {}
4536 switch (value.
type()) {
4567 if (members.empty())
4572 Value::Members::iterator it = members.begin();
4574 const std::string& name = *it;
4575 const Value& childValue = value[name];
4580 if (++it == members.end()) {
4595 unsigned size = value.
size();
4600 if (isArrayMultiLine) {
4606 const Value& childValue = value[index];
4616 if (++index == size) {
4629 for (
unsigned index = 0; index < size; ++index) {
4640 int size = value.
size();
4643 for (
int index = 0; index < size && !isMultiLine; ++index) {
4644 const Value& childValue = value[index];
4647 childValue.
size() > 0);
4653 int lineLength = 4 + (size - 1) * 2;
4654 for (
int index = 0; index < size; ++index) {
4662 isMultiLine = isMultiLine || lineLength >=
rightMargin_;
4701 std::string::const_iterator iter = comment.begin();
4702 while (iter != comment.end()) {
4704 if (*iter ==
'\n' &&
4705 (iter != comment.end() && *(iter + 1) ==
'/'))
4746 std::string
const& indentation,
4748 std::string
const& colonSymbol,
4749 std::string
const& nullSymbol,
4750 std::string
const& endingLineFeedSymbol);
4751 virtual int write(
Value const& root, std::ostream* sout);
4756 void pushValue(std::string
const& value);
4779 std::string
const& indentation,
4781 std::string
const& colonSymbol,
4782 std::string
const& nullSymbol,
4783 std::string
const& endingLineFeedSymbol)
4785 , indentation_(indentation)
4787 , colonSymbol_(colonSymbol)
4788 , nullSymbol_(nullSymbol)
4789 , endingLineFeedSymbol_(endingLineFeedSymbol)
4790 , addChildValues_(false)
4810 switch (value.
type()) {
4841 if (members.empty())
4846 Value::Members::iterator it = members.begin();
4848 std::string
const& name = *it;
4849 Value const& childValue = value[name];
4854 if (++it == members.end()) {
4869 unsigned size = value.
size();
4880 Value const& childValue = value[index];
4890 if (++index == size) {
4904 for (
unsigned index = 0; index < size; ++index) {
4916 int size = value.
size();
4919 for (
int index = 0; index < size && !isMultiLine; ++index) {
4920 Value const& childValue = value[index];
4923 childValue.
size() > 0);
4929 int lineLength = 4 + (size - 1) * 2;
4930 for (
int index = 0; index < size; ++index) {
4938 isMultiLine = isMultiLine || lineLength >=
rightMargin_;
4982 std::string::const_iterator iter = comment.begin();
4983 while (iter != comment.end()) {
4985 if (*iter ==
'\n' &&
4986 (iter != comment.end() && *(iter + 1) ==
'/'))
5026 setDefaults(&settings_);
5032 std::string indentation = settings_[
"indentation"].asString();
5033 std::string cs_str = settings_[
"commentStyle"].asString();
5034 bool eyc = settings_[
"enableYAMLCompatibility"].asBool();
5035 bool dnp = settings_[
"dropNullPlaceholders"].asBool();
5037 if (cs_str ==
"All") {
5039 }
else if (cs_str ==
"None") {
5044 std::string colonSymbol =
" : ";
5047 }
else if (indentation.empty()) {
5050 std::string nullSymbol =
"null";
5054 std::string endingLineFeedSymbol =
"";
5057 colonSymbol, nullSymbol, endingLineFeedSymbol);
5061 valid_keys->clear();
5062 valid_keys->insert(
"indentation");
5063 valid_keys->insert(
"commentStyle");
5064 valid_keys->insert(
"enableYAMLCompatibility");
5065 valid_keys->insert(
"dropNullPlaceholders");
5070 if (!invalid) invalid = &my_invalid;
5072 std::set<std::string> valid_keys;
5075 size_t n = keys.size();
5076 for (
size_t i = 0; i < n; ++i) {
5077 std::string
const& key = keys[i];
5078 if (valid_keys.find(key) == valid_keys.end()) {
5079 inv[key] = settings_[key];
5082 return 0u == inv.
size();
5086 return settings_[key];
5092 (*settings)[
"commentStyle"] =
"All";
5093 (*settings)[
"indentation"] =
"\t";
5094 (*settings)[
"enableYAMLCompatibility"] =
false;
5095 (*settings)[
"dropNullPlaceholders"] =
false;
5100 std::ostringstream sout;
5102 writer->write(root, &sout);
5109 writer->write(root, &sout);
bool operator<=(const Value &other) const
void writeWithIndent(const std::string &value)
std::deque< ErrorInfo > Errors
Value & operator[](ArrayIndex index)
std::vector< std::string > Members
static void getValidReaderKeys(std::set< std::string > *valid_keys)
static void fixNumericLocale(char *begin, char *end)
bool allowNumericKeys_
true if numeric object key are allowed. Default: false.
const_iterator begin() const
Value(ValueType type=nullValue)
Create a default Value of the given type.
bool operator>(const Value &other) const
bool isMultineArray(const Value &value)
std::string JSON_API valueToQuotedString(const char *value)
void initBasic(ValueType type, bool allocated=false)
JSON_API std::ostream & operator<<(std::ostream &, const Value &root)
Output using the StyledStreamWriter.
const_iterator end() const
bool allowComments_
true if comments are allowed. Default: true.
bool const collectComments_
bool pushError(const Value &value, const std::string &message)
Features()
Initialize the configuration like JsonConfig::allFeatures;.
Json::LargestInt LargestInt
void writeCommentAfterValueOnSameLine(Value const &root)
bool dropNullPlaceholders_
virtual ~CharReaderBuilder()
Value removeMember(const char *key)
Remove and return the named member.
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value.
bool isEqual(const SelfType &other) const
bool match(Location pattern, int patternLength)
bool decodeNumber(Token &token)
Value get(ArrayIndex index, const Value &defaultValue) const
bool decodeUnicodeEscapeSequence(Token &token, Location ¤t, Location end, unsigned int &unicode)
static void decodePrefixedString(bool isPrefixed, char const *prefixed, unsigned *length, char const **value)
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value.
void addPathInArg(const std::string &path, const InArgs &in, InArgs::const_iterator &itInArg, PathArgument::Kind kind)
std::string indentString_
virtual bool parse(char const *beginDoc, char const *endDoc, Value *root, std::string *errs)
Read a Value from a JSON document. The document must be a UTF-8 encoded string containing the documen...
static bool IsIntegral(double d)
bool readObject(Token &token)
Experimental and untested: represents an element of the "path" to access a node.
Json::ArrayIndex ArrayIndex
void getLocationLineAndColumn(Location location, int &line, int &column) const
BuiltStyledStreamWriter(std::string const &indentation, CommentStyle::Enum cs, std::string const &colonSymbol, std::string const &nullSymbol, std::string const &endingLineFeedSymbol)
bool recoverFromError(TokenType skipUntilToken)
static int const stackLimit_g
void pushValue(std::string const &value)
void makePath(const std::string &path, const InArgs &in)
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
std::string commentsBefore_
virtual StreamWriter * newStreamWriter() const =0
Allocate a CharReader via operator new().
virtual std::string write(const Value &root)
Lightweight wrapper to tag static string.
RuntimeError(std::string const &msg)
ValueConstIterator const_iterator
bool yamlCompatiblityEnabled_
CZString & operator=(CZString other)
void pushValue(const std::string &value)
bool decodeString(Token &token)
bool readArray(Token &token)
static bool containsControlCharacter0(const char *str, unsigned len)
void swapPayload(Value &other)
Swap values but leave comments and source offsets in place.
bool validate(Json::Value *invalid) const
void writeValue(Value const &value)
OurCharReader(bool collectComments, OurFeatures const &features)
static const unsigned char ALIGNAS(8) kNull[sizeof(Value)]
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...
bool parse(const std::string &document, Value &root, bool collectComments=true)
Read a Value from a JSON document.
bool decodeUnicodeEscapeSequence(Token &token, Location ¤t, Location end, unsigned int &unicode)
void writeArrayValue(Value const &value)
std::string getFormattedErrorMessages() const
void writeArrayValue(const Value &value)
std::string commentsBefore_
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
bool operator<(CZString const &other) const
std::vector< StructuredError > getStructuredErrors() const
Returns a vector of structured erros encounted while parsing.
char const * memberName() const
bool operator==(CZString const &other) const
bool match(Location pattern, int patternLength)
Exception(std::string const &msg)
virtual StreamWriter * newStreamWriter() const
bool operator<(const Value &other) const
Compare payload only, not comments etc.
void setComment(const char *comment, CommentPlacement placement)
const Value & resolve(const Value &root) const
const char * c_str() const
Configuration passed to reader and writer. This configuration object can be used to force the Reader ...
bool addErrorAndRecover(const std::string &message, Token &token, TokenType skipUntilToken)
std::vector< StructuredError > getStructuredErrors() const
a comment placed on the line before a value
bool operator!=(const Value &other) const
bool isValidIndex(ArrayIndex index) const
Return true if index < size().
bool readArray(Token &token)
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
void getLocationLineAndColumn(Location location, int &line, int &column) const
Value & operator[](std::string key)
static void getValidWriterKeys(std::set< std::string > *valid_keys)
std::stack< Value * > Nodes
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
bool decodeUnicodeCodePoint(Token &token, Location ¤t, Location end, unsigned int &unicode)
SelfType & operator=(const ValueIteratorBase &other)
bool readCppStyleComment()
void enableYAMLCompatibility()
bool parse(const char *beginDoc, const char *endDoc, Value &root, bool collectComments=true)
void operator=(OurReader const &)
bool isConvertibleTo(ValueType other) const
bool isMember(const char *key) const
void writeValue(const Value &value)
static std::string codePointToUTF8(unsigned int cp)
Converts a unicode code-point to UTF-8.
const unsigned char & kNullRef
void writeCommentBeforeValue(const Value &root)
void swap(Json::Value &a, Json::Value &b)
Specialize std::swap() for Json::Value.
static const Int minInt
Minimum signed int value that can be stored in a Json::Value.
std::string JSON_API valueToString(Int value)
void resize(ArrayIndex size)
void swap(CZString &other)
static void setDefaults(Json::Value *settings)
void addComment(Location begin, Location end, CommentPlacement placement)
bool isStaticString() const
difference_type computeDistance(const SelfType &other) const
void throwLogicError(std::string const &msg)
used internally
static bool isControlCharacter(char ch)
Returns true if ch is a control character (in range [0,32[).
bool removeIndex(ArrayIndex i, Value *removed)
Remove the indexed array element.
bool operator>=(const Value &other) const
std::map< CZString, Value > ObjectValues
bool addError(const std::string &message, Token &token, Location extra=0)
static const Int64 minInt64
Minimum signed 64 bits int value that can be stored in a Json::Value.
bool decodeString(Token &token)
Reader()
Constructs a Reader allowing all features for parsing.
An error tagged with where in the JSON text it was encountered.
bool good() const
Return whether there are any errors.
bool operator==(const Value &other) const
std::auto_ptr< StreamWriter > StreamWriterPtr
static void uintToString(LargestUInt value, char *¤t)
object value (collection of name/value pairs).
static Features all()
A configuration that allows all features and assumes all strings are UTF-8.
class JSON_API RuntimeError
bool readToken(Token &token)
Json::LargestUInt LargestUInt
Build a CharReader implementation.
void writeCommentAfterValueOnSameLine(const Value &root)
void swap(Value &other)
Swap everything.
bool decodeDouble(Token &token)
char UIntToStringBuffer[uintToStringBufferSize]
UInt index() const
Return the index of the referenced Value, or -1 if it is not an arrayValue.
ValueType
Type of the value held by a Value object.
LogicError(std::string const &msg)
bool hasCommentForValue(const Value &value)
void skipCommentTokens(Token &token)
static bool hasCommentForValue(const Value &value)
void writeCommentBeforeValue(const Value &root)
static const Value & null
We regret this reference to a global instance; prefer the simpler Value().
bool addError(const std::string &message, Token &token, Location extra=0)
void invalidPath(const std::string &path, int location)
bool isMultineArray(const Value &value)
a comment just after a value on the same line
static void releaseStringValue(char *value)
char const * data() const
static bool containsControlCharacter(const char *str)
JSON_API std::istream & operator>>(std::istream &, Value &)
Read from 'sin' into 'root'.
CZString(ArrayIndex index)
void writeWithIndent(const std::string &value)
base class for Value iterators.
bool hasComment(CommentPlacement placement) const
void addComment(Location begin, Location end, CommentPlacement placement)
std::string endingLineFeedSymbol_
std::string indentString_
#define JSON_ASSERT_UNREACHABLE
bool readToken(Token &token)
virtual ~StreamWriterBuilder()
void writeCommentBeforeValue(Value const &root)
std::string getFormattedErrorMessages() const
Returns a user friendly string that list errors in the parsed document.
bool empty() const
Return true if empty array, empty object, or null; otherwise, false.
static bool InRange(double d, T min, U max)
Path(const std::string &path, const PathArgument &a1=PathArgument(), const PathArgument &a2=PathArgument(), const PathArgument &a3=PathArgument(), const PathArgument &a4=PathArgument(), const PathArgument &a5=PathArgument())
std::string indentString_
bool decodeUnicodeCodePoint(Token &token, Location ¤t, Location end, unsigned int &unicode)
bool operator!() const
Return isNull()
std::vector< const PathArgument * > InArgs
void copy(const SelfType &other)
std::string asString() const
Embedded zeroes are possible.
void writeWithIndent(std::string const &value)
std::string toStyledString() const
std::string getComment(CommentPlacement placement) const
Include delimiters and embedded newlines.
Value & make(Value &root) const
SelfType & operator=(const SelfType &other)
bool decodeDouble(Token &token)
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value.
Value & operator=(Value other)
bool JSON_API parseFromStream(CharReader::Factory const &, std::istream &, Value *root, std::string *errs)
OurReader(OurFeatures const &features)
bool recoverFromError(TokenType skipUntilToken)
static const double maxUInt64AsDouble
class JSON_API LogicError
bool allowDroppedNullPlaceholders_
true if dropped null placeholders are allowed. Default: false.
LargestUInt asLargestUInt() const
#define JSON_ASSERT_MESSAGE(condition, message)
void write(std::ostream &out, const Value &root)
Serialize a Value in JSON format.
static Features strictMode()
A configuration that is strictly compatible with the JSON specification.
virtual CharReader * newCharReader() const
Allocate a CharReader via operator new().
bool validate(Json::Value *invalid) const
void omitEndingLineFeed()
A simple abstract factory.
union Json::Value::ValueHolder value_
std::vector< std::string > ChildValues
bool readStringSingleQuote()
virtual int write(Value const &root, std::ostream *sout)
static char * duplicateStringValue(const char *value, size_t length)
virtual char const * what() const
static std::string valueToQuotedStringN(const char *value, unsigned length)
bool allowDroppedNullPlaceholders_
const char * asCString() const
Embedded zeroes could cause you trouble!
StyledStreamWriter(std::string indentation="\t")
unsigned long long int UInt64
Value const * find(char const *key, char const *end) const
void writeArrayValue(const Value &value)
static void strictMode(Json::Value *settings)
void writeValue(const Value &value)
bool isMultineArray(Value const &value)
size_t getOffsetLimit() const
Value & resolveReference(const char *key)
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value.
Value & operator[](std::string key)
#define JSON_FAIL_MESSAGE(message)
size_t getOffsetStart() const
static bool containsNewLine(Reader::Location begin, Reader::Location end)
bool getString(char const **str, char const **end) const
bool readObject(Token &token)
Build a StreamWriter implementation.
bool addErrorAndRecover(const std::string &message, Token &token, TokenType skipUntilToken)
Iterator for object and array value.
Members getMemberNames() const
Return a list of the member names.
void setOffsetStart(size_t start)
LargestInt asLargestInt() const
int compare(const Value &other) const
void writeValue(const Value &value)
Writes a Value in JSON format in a human friendly way.
void dropNullPlaceholders()
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.
ArrayIndex size() const
Number of values in array or object.
bool pushError(const Value &value, const std::string &message)
Add a semantic error message.
bool hasCommentForValue(const Value &value)
#define JSON_ASSERT(condition)
void pushValue(const std::string &value)
Value & append(const Value &value)
Append value to array at the end.
void writeCommentAfterValueOnSameLine(const Value &root)
const iterator for object and array value.
std::string getFormatedErrorMessages() const
Returns a user friendly string that list errors in the parsed document.
bool readCppStyleComment()
void skipCommentTokens(Token &token)
static char const * strnpbrk(char const *s, char const *accept, size_t n)
virtual CharReader * newCharReader() const =0
Allocate a CharReader via operator new().
static char * duplicateAndPrefixStringValue(const char *value, unsigned int length)
std::auto_ptr< CharReader > CharReaderPtr
Value::ObjectValues::iterator current_
bool decodeNumber(Token &token)
OurFeatures const features_
static void setDefaults(Json::Value *settings)
array value (ordered list)
static std::string normalizeEOL(Reader::Location begin, Reader::Location end)
void throwRuntimeError(std::string const &msg)
used internally
void setOffsetLimit(size_t limit)
static const Value & nullRef