6 #if !defined(JSON_IS_AMALGAMATION) 10 #endif // if !defined(JSON_IS_AMALGAMATION) 17 #include <cpptl/conststring.h> 22 #define JSON_ASSERT_UNREACHABLE assert(false) 29 #if defined(__ARMEL__) 30 #define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) 32 #define ALIGNAS(byte_alignment) 42 #if defined(JSON_HAS_INT64) 50 #endif // defined(JSON_HAS_INT64) 55 #if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 56 template <
typename T,
typename U>
57 static inline bool InRange(
double d, T min, U max) {
61 return d >= min && d <= max;
63 #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 64 static inline double integerToDouble(
Json::UInt64 value) {
65 return static_cast<double>(
Int64(value / 2)) * 2.0 + static_cast<double>(
Int64(value & 1));
68 template <
typename T>
static inline double integerToDouble(T value) {
69 return static_cast<double>(value);
72 template <
typename T,
typename U>
73 static inline bool InRange(
double d, T min, U max) {
74 return d >= integerToDouble(min) && d <= integerToDouble(max);
76 #endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 90 if (length >= static_cast<size_t>(Value::maxInt))
91 length = Value::maxInt - 1;
93 char* newString =
static_cast<char*
>(malloc(length + 1));
94 if (newString == NULL) {
96 "in Json::Value::duplicateStringValue(): " 97 "Failed to allocate string value buffer");
99 memcpy(newString, value, length);
100 newString[length] = 0;
112 JSON_ASSERT_MESSAGE(length <= static_cast<unsigned>(Value::maxInt) -
sizeof(
unsigned) - 1U,
113 "in Json::Value::duplicateAndPrefixStringValue(): " 114 "length too big for prefixing");
115 unsigned actualLength = length +
static_cast<unsigned>(
sizeof(unsigned)) + 1U;
116 char* newString =
static_cast<char*
>(malloc(actualLength));
117 if (newString == 0) {
119 "in Json::Value::duplicateAndPrefixStringValue(): " 120 "Failed to allocate string value buffer");
122 *
reinterpret_cast<unsigned*
>(newString) = length;
123 memcpy(newString +
sizeof(
unsigned), value, length);
124 newString[actualLength - 1U] = 0;
128 bool isPrefixed,
char const* prefixed,
129 unsigned* length,
char const** value)
132 *length =
static_cast<unsigned>(strlen(prefixed));
135 *length = *
reinterpret_cast<unsigned const*
>(prefixed);
136 *value = prefixed +
sizeof(unsigned);
141 #if JSONCPP_USING_SECURE_MEMORY 144 char const* valueDecoded;
146 size_t const size =
sizeof(unsigned) + length + 1U;
147 memset(value, 0, size);
152 size_t size = (length==0) ? strlen(value) : length;
153 memset(value, 0, size);
156 #else // !JSONCPP_USING_SECURE_MEMORY 163 #endif // JSONCPP_USING_SECURE_MEMORY 174 #if !defined(JSON_IS_AMALGAMATION) 177 #endif // if !defined(JSON_IS_AMALGAMATION) 213 Value::CommentInfo::CommentInfo() : comment_(0)
216 Value::CommentInfo::~CommentInfo() {
221 void Value::CommentInfo::setComment(
const char* text,
size_t len) {
228 text[0] ==
'\0' || text[0] ==
'/',
229 "in Json::Value::setComment(): Comments must start with /");
245 Value::CZString::CZString(
ArrayIndex aindex) : cstr_(0), index_(aindex) {}
247 Value::CZString::CZString(
char const* str,
unsigned ulength, DuplicationPolicy allocate)
250 storage_.policy_ = allocate & 0x3;
251 storage_.length_ = ulength & 0x3FFFFFFF;
254 Value::CZString::CZString(
const CZString& other) {
255 cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
258 storage_.policy_ =
static_cast<unsigned>(other.cstr_
259 ? (
static_cast<DuplicationPolicy
>(other.storage_.policy_) == noDuplication
260 ? noDuplication : duplicate)
261 :
static_cast<DuplicationPolicy
>(other.storage_.policy_)) & 3U;
262 storage_.length_ = other.storage_.length_;
265 #if JSON_HAS_RVALUE_REFERENCES 266 Value::CZString::CZString(CZString&& other)
267 : cstr_(other.cstr_), index_(other.index_) {
268 other.cstr_ =
nullptr;
272 Value::CZString::~CZString() {
273 if (cstr_ && storage_.policy_ == duplicate) {
278 void Value::CZString::swap(CZString& other) {
279 std::swap(cstr_, other.cstr_);
280 std::swap(index_, other.index_);
283 Value::CZString& Value::CZString::operator=(CZString other) {
288 bool Value::CZString::operator<(
const CZString& other)
const {
289 if (!cstr_)
return index_ < other.index_;
292 unsigned this_len = this->storage_.length_;
293 unsigned other_len = other.storage_.length_;
294 unsigned min_len = std::min(this_len, other_len);
296 int comp = memcmp(this->cstr_, other.cstr_, min_len);
297 if (comp < 0)
return true;
298 if (comp > 0)
return false;
299 return (this_len < other_len);
303 if (!cstr_)
return index_ == other.index_;
306 unsigned this_len = this->storage_.length_;
307 unsigned other_len = other.storage_.length_;
308 if (this_len != other_len)
return false;
310 int comp = memcmp(this->cstr_, other.cstr_, this_len);
314 ArrayIndex Value::CZString::index()
const {
return index_; }
317 const char* Value::CZString::data()
const {
return cstr_; }
318 unsigned Value::CZString::length()
const {
return storage_.length_; }
319 bool Value::CZString::isStaticString()
const {
return storage_.policy_ == noDuplication; }
350 value_.map_ =
new ObjectValues();
353 value_.bool_ =
false;
367 value_.uint_ = value;
369 #if defined(JSON_HAS_INT64) 376 value_.uint_ = value;
378 #endif // defined(JSON_HAS_INT64) 382 value_.real_ = value;
404 value_.string_ =
const_cast<char*
>(value.
c_str());
407 #ifdef JSON_USE_CPPTL 416 value_.bool_ = value;
420 : type_(other.type_), allocated_(
false)
422 comments_(0), start_(other.start_), limit_(other.limit_)
430 value_ = other.value_;
433 if (other.value_.string_ && other.allocated_) {
441 value_.string_ = other.value_.string_;
447 value_.map_ =
new ObjectValues(*other.value_.map_);
452 if (other.comments_) {
455 const CommentInfo& otherComment = other.comments_[comment];
456 if (otherComment.comment_)
457 comments_[comment].setComment(
458 otherComment.comment_, strlen(otherComment.comment_));
463 #if JSON_HAS_RVALUE_REFERENCES 506 std::swap(value_, other.value_);
507 int temp2 = allocated_;
508 allocated_ = other.allocated_;
509 other.allocated_ = temp2 & 0x1;
514 std::swap(comments_, other.comments_);
515 std::swap(start_, other.start_);
516 std::swap(limit_, other.limit_);
530 int typeDelta = type_ - other.type_;
532 return typeDelta < 0 ?
true :
false;
537 return value_.int_ < other.value_.int_;
539 return value_.uint_ < other.value_.uint_;
541 return value_.real_ < other.value_.real_;
543 return value_.bool_ < other.value_.bool_;
546 if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
547 if (other.value_.string_)
return true;
552 char const* this_str;
553 char const* other_str;
556 unsigned min_len = std::min(this_len, other_len);
558 int comp = memcmp(this_str, other_str, min_len);
559 if (comp < 0)
return true;
560 if (comp > 0)
return false;
561 return (this_len < other_len);
565 int delta = int(value_.map_->size() - other.value_.map_->size());
568 return (*value_.map_) < (*other.value_.map_);
587 int temp = other.type_;
594 return value_.int_ == other.value_.int_;
596 return value_.uint_ == other.value_.uint_;
598 return value_.real_ == other.value_.real_;
600 return value_.bool_ == other.value_.bool_;
603 if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
604 return (value_.string_ == other.value_.string_);
608 char const* this_str;
609 char const* other_str;
612 if (this_len != other_len)
return false;
614 int comp = memcmp(this_str, other_str, this_len);
619 return value_.map_->size() == other.value_.map_->size() &&
620 (*value_.map_) == (*other.value_.map_);
631 "in Json::Value::asCString(): requires stringValue");
632 if (value_.string_ == 0)
return 0;
634 char const* this_str;
639 #if JSONCPP_USING_SECURE_MEMORY 640 unsigned Value::getCStringLength()
const {
642 "in Json::Value::asCString(): requires stringValue");
643 if (value_.string_ == 0)
return 0;
645 char const* this_str;
653 if (value_.string_ == 0)
return false;
656 *cend = *str + length;
666 if (value_.string_ == 0)
return "";
668 char const* this_str;
673 return value_.bool_ ?
"true" :
"false";
685 #ifdef JSON_USE_CPPTL 686 CppTL::ConstString Value::asConstString()
const {
691 return CppTL::ConstString(str, len);
699 return Int(value_.int_);
702 return Int(value_.uint_);
705 "double out of Int range");
706 return Int(value_.real_);
710 return value_.bool_ ? 1 : 0;
721 return UInt(value_.int_);
724 return UInt(value_.uint_);
727 "double out of UInt range");
728 return UInt(value_.real_);
732 return value_.bool_ ? 1 : 0;
739 #if defined(JSON_HAS_INT64) 744 return Int64(value_.int_);
747 return Int64(value_.uint_);
750 "double out of Int64 range");
751 return Int64(value_.real_);
755 return value_.bool_ ? 1 : 0;
766 return UInt64(value_.int_);
768 return UInt64(value_.uint_);
771 "double out of UInt64 range");
772 return UInt64(value_.real_);
776 return value_.bool_ ? 1 : 0;
782 #endif // if defined(JSON_HAS_INT64) 785 #if defined(JSON_NO_INT64) 793 #if defined(JSON_NO_INT64) 803 return static_cast<double>(value_.int_);
805 #if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 806 return static_cast<double>(value_.uint_);
807 #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 808 return integerToDouble(value_.uint_);
809 #endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 815 return value_.bool_ ? 1.0 : 0.0;
825 return static_cast<float>(value_.int_);
827 #if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 828 return static_cast<float>(value_.uint_);
829 #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 831 return static_cast<float>(integerToDouble(value_.uint_));
832 #endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) 834 return static_cast<float>(value_.real_);
838 return value_.bool_ ? 1.0f : 0.0f;
852 return value_.int_ ?
true :
false;
854 return value_.uint_ ?
true :
false;
857 return (value_.real_ != 0.0) ?
true :
false;
867 return (isNumeric() && asDouble() == 0.0) ||
870 (type_ ==
arrayValue && value_.map_->size() == 0) ||
871 (type_ ==
objectValue && value_.map_->size() == 0) ||
908 if (!value_.map_->empty()) {
909 ObjectValues::const_iterator itLast = value_.map_->end();
911 return (*itLast).first.index() + 1;
922 if (isNull() || isArray() || isObject())
933 "in Json::Value::clear(): requires complex value");
939 value_.map_->clear();
948 "in Json::Value::resize(): requires arrayValue");
954 else if (newSize > oldSize)
955 (*this)[newSize - 1];
957 for (
ArrayIndex index = newSize; index < oldSize; ++index) {
958 value_.map_->erase(index);
967 "in Json::Value::operator[](ArrayIndex): requires arrayValue");
971 ObjectValues::iterator it = value_.map_->lower_bound(key);
972 if (it != value_.map_->end() && (*it).first == key)
975 ObjectValues::value_type defaultValue(key, nullRef);
976 it = value_.map_->insert(it, defaultValue);
983 "in Json::Value::operator[](int index): index cannot be negative");
990 "in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
994 ObjectValues::const_iterator it = value_.map_->find(key);
995 if (it == value_.map_->end())
1003 "in Json::Value::operator[](int index) const: index cannot be negative");
1007 void Value::initBasic(
ValueType vtype,
bool allocated) {
1009 allocated_ = allocated;
1018 Value& Value::resolveReference(
const char* key) {
1021 "in Json::Value::resolveReference(): requires objectValue");
1025 key, static_cast<unsigned>(strlen(key)), CZString::noDuplication);
1026 ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
1027 if (it != value_.map_->end() && (*it).first == actualKey)
1028 return (*it).second;
1030 ObjectValues::value_type defaultValue(actualKey, nullRef);
1031 it = value_.map_->insert(it, defaultValue);
1032 Value& value = (*it).second;
1037 Value& Value::resolveReference(
char const* key,
char const* cend)
1041 "in Json::Value::resolveReference(key, end): requires objectValue");
1045 key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
1046 ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
1047 if (it != value_.map_->end() && (*it).first == actualKey)
1048 return (*it).second;
1050 ObjectValues::value_type defaultValue(actualKey, nullRef);
1051 it = value_.map_->insert(it, defaultValue);
1052 Value& value = (*it).second;
1057 const Value* value = &((*this)[index]);
1058 return value == &nullRef ? defaultValue : *value;
1067 "in Json::Value::find(key, end, found): requires objectValue or nullValue");
1069 CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
1070 ObjectValues::const_iterator it = value_.map_->find(actualKey);
1071 if (it == value_.map_->end())
return NULL;
1072 return &(*it).second;
1076 Value const* found = find(key, key + strlen(key));
1077 if (!found)
return nullRef;
1082 Value const* found = find(key.data(), key.data() + key.length());
1083 if (!found)
return nullRef;
1088 return resolveReference(key, key + strlen(key));
1092 return resolveReference(key.data(), key.data() + key.length());
1096 return resolveReference(key.
c_str());
1099 #ifdef JSON_USE_CPPTL 1101 return resolveReference(key.c_str(), key.end_c_str());
1105 Value const* found = find(key.c_str(), key.end_c_str());
1106 if (!found)
return nullRef;
1115 Value const* found = find(key, cend);
1116 return !found ? defaultValue : *found;
1120 return get(key, key + strlen(key), defaultValue);
1124 return get(key.data(), key.data() + key.length(), defaultValue);
1133 CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
1134 ObjectValues::iterator it = value_.map_->find(actualKey);
1135 if (it == value_.map_->end())
1137 *removed = it->second;
1138 value_.map_->erase(it);
1143 return removeMember(key, key + strlen(key), removed);
1147 return removeMember(key.data(), key.data() + key.length(), removed);
1152 "in Json::Value::removeMember(): requires objectValue");
1157 removeMember(key, key + strlen(key), &removed);
1162 return removeMember(key.c_str());
1169 CZString key(index);
1170 ObjectValues::iterator it = value_.map_->find(key);
1171 if (it == value_.map_->end()) {
1174 *removed = it->second;
1177 for (
ArrayIndex i = index; i < (oldSize - 1); ++i){
1179 (*value_.map_)[keey] = (*
this)[i + 1];
1182 CZString keyLast(oldSize - 1);
1183 ObjectValues::iterator itLast = value_.map_->find(keyLast);
1184 value_.map_->erase(itLast);
1188 #ifdef JSON_USE_CPPTL 1190 const Value& defaultValue)
const {
1191 return get(key.c_str(), key.end_c_str(), defaultValue);
1197 Value const* value = find(key, cend);
1198 return NULL != value;
1202 return isMember(key, key + strlen(key));
1206 return isMember(key.data(), key.data() + key.length());
1209 #ifdef JSON_USE_CPPTL 1211 return isMember(key.c_str(), key.end_c_str());
1218 "in Json::Value::getMemberNames(), value must be objectValue");
1222 members.reserve(value_.map_->size());
1223 ObjectValues::const_iterator it = value_.map_->begin();
1224 ObjectValues::const_iterator itEnd = value_.map_->end();
1225 for (; it != itEnd; ++it) {
1227 (*it).first.length()));
1258 double integral_part;
1259 return modf(d, &integral_part) == 0.0;
1269 return value_.int_ >= minInt && value_.int_ <= maxInt;
1271 return value_.uint_ <=
UInt(maxInt);
1273 return value_.real_ >= minInt && value_.real_ <= maxInt &&
1286 return value_.uint_ <= maxUInt;
1288 return value_.real_ >= 0 && value_.real_ <= maxUInt &&
1297 #if defined(JSON_HAS_INT64) 1302 return value_.uint_ <=
UInt64(maxInt64);
1307 return value_.real_ >= double(minInt64) &&
1308 value_.real_ < double(maxInt64) &&
IsIntegral(value_.real_);
1312 #endif // JSON_HAS_INT64 1317 #if defined(JSON_HAS_INT64) 1320 return value_.int_ >= 0;
1327 return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble &&
1332 #endif // JSON_HAS_INT64 1337 #if defined(JSON_HAS_INT64) 1338 return isInt64() || isUInt64();
1340 return isInt() || isUInt();
1357 if ((len > 0) && (comment[len-1] ==
'\n')) {
1361 comments_[placement].setComment(comment, len);
1365 setComment(comment, strlen(comment), placement);
1369 setComment(comment.c_str(), comment.length(), placement);
1373 return comments_ != 0 && comments_[placement].comment_ != 0;
1377 if (hasComment(placement))
1378 return comments_[placement].comment_;
1392 return writer.
write(*
this);
1426 return iterator(value_.map_->begin());
1439 return iterator(value_.map_->end());
1453 : key_(), index_(index), kind_(kindIndex) {}
1456 : key_(key), index_(), kind_(kindKey) {}
1459 : key_(key.c_str()), index_(), kind_(kindKey) {}
1479 void Path::makePath(
const JSONCPP_STRING& path,
const InArgs& in) {
1480 const char* current = path.c_str();
1481 const char* end = current + path.length();
1482 InArgs::const_iterator itInArg = in.begin();
1483 while (current != end) {
1484 if (*current ==
'[') {
1486 if (*current ==
'%')
1487 addPathInArg(path, in, itInArg, PathArgument::kindIndex);
1490 for (; current != end && *current >=
'0' && *current <=
'9'; ++current)
1491 index = index * 10 +
ArrayIndex(*current -
'0');
1492 args_.push_back(index);
1494 if (current == end || *current++ !=
']')
1495 invalidPath(path,
int(current - path.c_str()));
1496 }
else if (*current ==
'%') {
1497 addPathInArg(path, in, itInArg, PathArgument::kindKey);
1499 }
else if (*current ==
'.') {
1502 const char* beginName = current;
1503 while (current != end && !strchr(
"[.", *current))
1512 InArgs::const_iterator& itInArg,
1513 PathArgument::Kind kind) {
1514 if (itInArg == in.end()) {
1516 }
else if ((*itInArg)->kind_ != kind) {
1519 args_.push_back(**itInArg);
1528 const Value* node = &root;
1529 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
1531 if (arg.kind_ == PathArgument::kindIndex) {
1535 node = &((*node)[arg.index_]);
1536 }
else if (arg.kind_ == PathArgument::kindKey) {
1540 node = &((*node)[arg.key_]);
1541 if (node == &Value::nullRef) {
1551 const Value* node = &root;
1552 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
1554 if (arg.kind_ == PathArgument::kindIndex) {
1556 return defaultValue;
1557 node = &((*node)[arg.index_]);
1558 }
else if (arg.kind_ == PathArgument::kindKey) {
1560 return defaultValue;
1561 node = &((*node)[arg.key_]);
1562 if (node == &Value::nullRef)
1563 return defaultValue;
1570 Value* node = &root;
1571 for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
1573 if (arg.kind_ == PathArgument::kindIndex) {
1577 node = &((*node)[arg.index_]);
1578 }
else if (arg.kind_ == PathArgument::kindKey) {
1582 node = &((*node)[arg.key_]);
const unsigned char & kNullRef
bool hasComment(CommentPlacement placement) const
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())
Writes a Value in JSON format in a human friendly way.
Value & make(Value &root) const
Creates the "path" to access the specified node and returns a reference on the node.
static bool IsIntegral(double d)
std::string asString() const
Embedded zeroes are possible.
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
static const Value & null
We regret this reference to a global instance; prefer the simpler Value().
#define JSON_ASSERT_MESSAGE(condition, message)
array value (ordered list)
LargestUInt asLargestUInt() const
#define ALIGNAS(byte_alignment)
bool operator<(const Value &other) const
Compare payload only, not comments etc.
Json::ArrayIndex ArrayIndex
int compare(const Value &other) const
object value (collection of name/value pairs).
void swapPayload(Value &other)
Swap values but leave comments and source offsets in place.
RuntimeError(std::string const &msg)
bool removeIndex(ArrayIndex i, Value *removed)
Remove the indexed array element.
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value.
bool empty() const
Return true if empty array, empty object, or null; otherwise, false.
Lightweight wrapper to tag static string.
Value removeMember(const char *key)
Remove and return the named member.
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
Json::LargestUInt LargestUInt
LogicError(std::string const &msg)
Value & operator=(Value other)
Deep copy, then swap(other).
const iterator for object and array value.
Value(ValueType type=nullValue)
Create a default Value of the given type.
Experimental and untested: represents an element of the "path" to access a node.
void setComment(const char *comment, CommentPlacement placement)
static bool InRange(double d, T min, U max)
std::string getComment(CommentPlacement placement) const
Include delimiters and embedded newlines.
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value.
bool isMember(const char *key) const
Return true if the object has a member named key.
static void decodePrefixedString(bool isPrefixed, char const *prefixed, unsigned *length, char const **value)
#define JSON_ASSERT(condition)
It should not be possible for a maliciously designed file to cause an abort() or seg-fault, so these macros are used only for pre-condition violations and internal logic errors.
static const unsigned char kNull[sizeof(Value)]
static const Value & nullRef
just a kludge for binary-compatibility; same as null
Value & operator[](ArrayIndex index)
Access an array element (zero based index ).
std::string valueToString(Int value)
std::string write(const Value &root)
Serialize a Value in JSON format.
JSON (JavaScript Object Notation).
bool operator==(const SecureAllocator< T > &, const SecureAllocator< U > &)
Members getMemberNames() const
Return a list of the member names.
void swap(Value &other)
Swap everything.
Json::LargestInt LargestInt
const char * c_str() const
static const double maxUInt64AsDouble
const char * asCString() const
Embedded zeroes could cause you trouble!
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
bool operator>(const Value &other) const
Exception(std::string const &msg)
bool operator>=(const Value &other) const
bool operator==(const Value &other) const
const Value & resolve(const Value &root) const
bool isValidIndex(ArrayIndex index) const
Return true if index < size().
Value & append(const Value &value)
Append value to array at the end.
ArrayIndex size() const
Number of values in array or object.
std::string toStyledString() const
static char * duplicateAndPrefixStringValue(const char *value, unsigned int length)
#define JSON_ASSERT_UNREACHABLE
void setOffsetStart(ptrdiff_t start)
bool isConvertibleTo(ValueType other) const
ptrdiff_t getOffsetStart() const
static char * duplicateStringValue(const char *value, size_t length)
Duplicates the specified string value.
static const Int64 minInt64
Minimum signed 64 bits int value that can be stored in a Json::Value.
static const Int minInt
Minimum signed int value that can be stored in a Json::Value.
Exceptions which the user cannot easily avoid.
bool operator!() const
Return isNull()
LargestInt asLargestInt() const
static void releaseStringValue(char *value, unsigned length)
Value const * find(char const *begin, char const *end) const
Most general and efficient version of isMember()const, get()const, and operator[]const.
void resize(ArrayIndex size)
Resize the array to size elements.
void clear()
Remove all object members and array elements.
Iterator for object and array value.
static void releasePrefixedStringValue(char *value)
Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue().
ptrdiff_t getOffsetLimit() const
bool operator<=(const Value &other) const
void setOffsetLimit(ptrdiff_t limit)
std::vector< std::string > Members
Value get(ArrayIndex index, const Value &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
char const * what() const
#define JSON_FAIL_MESSAGE(message)
const_iterator begin() const
Base class for all exceptions we throw.
bool operator!=(const Value &other) const
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value.
const_iterator end() const
bool getString(char const **begin, char const **end) const
Get raw char* of string-value.
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value.