6#if !defined(JSON_IS_AMALGAMATION)
21#if defined(_MSC_VER) && _MSC_VER < 1900
24 const char* format, va_list ap) {
27 count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
29 count = _vscprintf(format, ap);
34 const char* format, ...) {
45#pragma warning(disable : 4702)
48#define JSON_ASSERT_UNREACHABLE assert(false)
52static std::unique_ptr<T>
cloneUnique(
const std::unique_ptr<T>& p) {
55 r = std::unique_ptr<T>(
new T(*p));
64#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
66#define ALIGNAS(byte_alignment)
71 static Value const nullStatic;
85#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
86template <
typename T,
typename U>
87static inline bool InRange(
double d, T min, U max) {
90 return d >=
static_cast<double>(min) && d <=
static_cast<double>(max) &&
91 !(
static_cast<U
>(d) == min && d !=
static_cast<double>(min));
94static inline double integerToDouble(
Json::UInt64 value) {
95 return static_cast<double>(
Int64(value / 2)) * 2.0 +
96 static_cast<double>(
Int64(value & 1));
99template <
typename T>
static inline double integerToDouble(T value) {
100 return static_cast<double>(value);
103template <
typename T,
typename U>
104static inline bool InRange(
double d, T min, U max) {
105 return d >= integerToDouble(min) && d <= integerToDouble(max) &&
106 !(
static_cast<U
>(d) == min && d != integerToDouble(min));
123 auto newString =
static_cast<char*
>(malloc(length + 1));
124 if (newString ==
nullptr) {
125 throwRuntimeError(
"in Json::Value::duplicateStringValue(): "
126 "Failed to allocate string value buffer");
128 memcpy(newString, value, length);
129 newString[length] = 0;
136 unsigned int length) {
140 sizeof(
unsigned) - 1U,
141 "in Json::Value::duplicateAndPrefixStringValue(): "
142 "length too big for prefixing");
143 size_t actualLength =
sizeof(length) + length + 1;
144 auto newString =
static_cast<char*
>(malloc(actualLength));
145 if (newString ==
nullptr) {
146 throwRuntimeError(
"in Json::Value::duplicateAndPrefixStringValue(): "
147 "Failed to allocate string value buffer");
149 *
reinterpret_cast<unsigned*
>(newString) = length;
150 memcpy(newString +
sizeof(
unsigned), value, length);
151 newString[actualLength - 1U] =
156 unsigned* length,
char const** value) {
158 *length =
static_cast<unsigned>(strlen(prefixed));
161 *length = *
reinterpret_cast<unsigned const*
>(prefixed);
162 *value = prefixed +
sizeof(unsigned);
168#if JSONCPP_USE_SECURE_MEMORY
171 char const* valueDecoded;
173 size_t const size =
sizeof(unsigned) + length + 1U;
174 memset(value, 0, size);
179 size_t size = (length == 0) ? strlen(value) : length;
180 memset(value, 0, size);
210 return "stringValue";
212 return "booleanValue";
216 return "objectValue";
223#if !defined(JSON_IS_AMALGAMATION)
230#if JSON_USE_EXCEPTION
240 throw LogicError(msg);
244 std::cerr << msg << std::endl;
248 std::cerr << msg << std::endl;
264Value::CZString::CZString(
ArrayIndex index) : cstr_(nullptr), index_(index) {}
266Value::CZString::CZString(
char const* str,
unsigned length,
267 DuplicationPolicy allocate)
270 storage_.policy_ = allocate & 0x3;
271 storage_.length_ = length & 0x3FFFFFFF;
274Value::CZString::CZString(
const CZString& other) {
275 cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ !=
nullptr
280 static_cast<unsigned>(
282 ? (static_cast<DuplicationPolicy>(other.storage_.policy_) ==
286 : static_cast<DuplicationPolicy>(other.storage_.policy_)) &
288 storage_.length_ = other.storage_.length_;
290 index_ = other.index_;
294Value::CZString::CZString(CZString&& other) noexcept : cstr_(other.cstr_) {
296 storage_.policy_ = other.storage_.policy_;
297 storage_.length_ = other.storage_.length_;
299 index_ = other.index_;
301 other.cstr_ =
nullptr;
304Value::CZString::~CZString() {
305 if (cstr_ && storage_.policy_ == duplicate) {
307 storage_.length_ + 1U);
314void Value::CZString::swap(CZString& other) {
315 std::swap(cstr_, other.cstr_);
316 std::swap(index_, other.index_);
319Value::CZString& Value::CZString::operator=(
const CZString& other) {
321 index_ = other.index_;
325Value::CZString& Value::CZString::operator=(CZString&& other)
noexcept {
326 if (cstr_ && storage_.policy_ == duplicate) {
331 storage_.policy_ = other.storage_.policy_;
332 storage_.length_ = other.storage_.length_;
334 index_ = other.index_;
336 other.cstr_ =
nullptr;
340bool Value::CZString::operator<(
const CZString& other)
const {
342 return index_ < other.index_;
345 unsigned this_len = this->storage_.length_;
346 unsigned other_len = other.storage_.length_;
347 unsigned min_len = std::min<unsigned>(this_len, other_len);
349 int comp = memcmp(this->cstr_, other.cstr_, min_len);
354 return (this_len < other_len);
357bool Value::CZString::operator==(
const CZString& other)
const {
359 return index_ == other.index_;
362 unsigned this_len = this->storage_.length_;
363 unsigned other_len = other.storage_.length_;
364 if (this_len != other_len)
367 int comp = memcmp(this->cstr_, other.cstr_, this_len);
371ArrayIndex Value::CZString::index()
const {
return index_; }
374const char* Value::CZString::data()
const {
return cstr_; }
375unsigned Value::CZString::length()
const {
return storage_.length_; }
376bool Value::CZString::isStaticString()
const {
377 return storage_.policy_ == noDuplication;
393 static char const emptyString[] =
"";
407 value_.string_ =
const_cast<char*
>(
static_cast<char const*
>(emptyString));
411 value_.map_ =
new ObjectValues();
414 value_.bool_ =
false;
428 value_.uint_ = value;
430#if defined(JSON_HAS_INT64)
437 value_.uint_ = value;
443 value_.real_ = value;
449 "Null Value Passed to Value Constructor");
451 value,
static_cast<unsigned>(strlen(value)));
463 value.data(),
static_cast<unsigned>(value.length()));
468 value_.string_ =
const_cast<char*
>(value.
c_str());
473 value_.bool_ = value;
492 Value(other).swap(*
this);
502 std::swap(bits_, other.bits_);
503 std::swap(value_, other.value_);
513 std::swap(comments_, other.comments_);
514 std::swap(start_, other.start_);
515 std::swap(limit_, other.limit_);
524 return static_cast<ValueType>(bits_.value_type_);
536 int typeDelta =
type() - other.
type();
538 return typeDelta < 0;
543 return value_.int_ < other.value_.int_;
545 return value_.uint_ < other.value_.uint_;
547 return value_.real_ < other.value_.real_;
549 return value_.bool_ < other.value_.bool_;
551 if ((value_.string_ ==
nullptr) || (other.value_.string_ ==
nullptr)) {
552 return other.value_.string_ !=
nullptr;
556 char const* this_str;
557 char const* other_str;
562 unsigned min_len = std::min<unsigned>(this_len, other_len);
564 int comp = memcmp(this_str, other_str, min_len);
569 return (this_len < other_len);
573 auto thisSize = value_.map_->size();
574 auto otherSize = other.value_.map_->size();
575 if (thisSize != otherSize)
576 return thisSize < otherSize;
577 return (*value_.map_) < (*other.value_.map_);
598 return value_.int_ == other.value_.int_;
600 return value_.uint_ == other.value_.uint_;
602 return value_.real_ == other.value_.real_;
604 return value_.bool_ == other.value_.bool_;
606 if ((value_.string_ ==
nullptr) || (other.value_.string_ ==
nullptr)) {
607 return (value_.string_ == other.value_.string_);
611 char const* this_str;
612 char const* other_str;
617 if (this_len != other_len)
620 int comp = memcmp(this_str, other_str, this_len);
625 return value_.map_->size() == other.value_.map_->size() &&
626 (*value_.map_) == (*other.value_.map_);
637 "in Json::Value::asCString(): requires stringValue");
638 if (value_.string_ ==
nullptr)
641 char const* this_str;
647#if JSONCPP_USE_SECURE_MEMORY
648unsigned Value::getCStringLength()
const {
650 "in Json::Value::asCString(): requires stringValue");
651 if (value_.string_ == 0)
654 char const* this_str;
664 if (value_.string_ ==
nullptr)
678 if (value_.string_ ==
nullptr)
681 char const* this_str;
684 return String(this_str, this_len);
687 return value_.bool_ ?
"true" :
"false";
703 return Int(value_.int_);
706 return Int(value_.uint_);
709 "double out of Int range");
710 return Int(value_.real_);
714 return value_.bool_ ? 1 : 0;
725 return UInt(value_.int_);
728 return UInt(value_.uint_);
731 "double out of UInt range");
732 return UInt(value_.real_);
736 return value_.bool_ ? 1 : 0;
743#if defined(JSON_HAS_INT64)
748 return Int64(value_.int_);
751 return Int64(value_.uint_);
757 "Double value is minInt64, precise value cannot be determined");
759 "double out of Int64 range");
760 return Int64(value_.real_);
764 return value_.bool_ ? 1 : 0;
775 return UInt64(value_.int_);
777 return UInt64(value_.uint_);
780 "double out of UInt64 range");
781 return UInt64(value_.real_);
785 return value_.bool_ ? 1 : 0;
794#if defined(JSON_NO_INT64)
802#if defined(JSON_NO_INT64)
812 return static_cast<double>(value_.int_);
814#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
815 return static_cast<double>(value_.uint_);
817 return integerToDouble(value_.uint_);
824 return value_.bool_ ? 1.0 : 0.0;
834 return static_cast<float>(value_.int_);
836#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
837 return static_cast<float>(value_.uint_);
840 return static_cast<float>(integerToDouble(value_.uint_));
843 return static_cast<float>(value_.real_);
847 return value_.bool_ ? 1.0F : 0.0F;
861 return value_.int_ != 0;
863 return value_.uint_ != 0;
866 const auto value_classification = std::fpclassify(value_.real_);
867 return value_classification != FP_ZERO && value_classification != FP_NAN;
919 if (!value_.map_->empty()) {
920 ObjectValues::const_iterator itLast = value_.map_->end();
922 return (*itLast).first.index() + 1;
938Value::operator bool()
const {
return !
isNull(); }
943 "in Json::Value::clear(): requires complex value");
949 value_.map_->clear();
959 "in Json::Value::resize(): requires arrayValue, but found "
966 else if (newSize > oldSize)
967 for (
ArrayIndex i = oldSize; i < newSize; ++i)
970 for (
ArrayIndex index = newSize; index < oldSize; ++index) {
971 value_.map_->erase(index);
980 "in Json::Value::operator[](ArrayIndex): requires arrayValue");
984 auto it = value_.map_->lower_bound(key);
985 if (it != value_.map_->end() && (*it).first == key)
989 it = value_.map_->insert(it, defaultValue);
996 "in Json::Value::operator[](int index): index cannot be negative");
1003 "in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
1006 CZString key(index);
1007 ObjectValues::const_iterator it = value_.map_->find(key);
1008 if (it == value_.map_->end())
1010 return (*it).second;
1016 "in Json::Value::operator[](int index) const: index cannot be negative");
1020void Value::initBasic(
ValueType type,
bool allocated) {
1022 setIsAllocated(allocated);
1023 comments_ = Comments{};
1028void Value::dupPayload(
const Value& other) {
1029 setType(other.type());
1030 setIsAllocated(
false);
1037 value_ = other.value_;
1040 if (other.value_.string_ && other.isAllocated()) {
1046 setIsAllocated(
true);
1048 value_.string_ = other.value_.string_;
1053 value_.map_ =
new ObjectValues(*other.value_.map_);
1060void Value::releasePayload() {
1081void Value::dupMeta(
const Value& other) {
1082 comments_ = other.comments_;
1083 start_ = other.start_;
1084 limit_ = other.limit_;
1090Value& Value::resolveReference(
const char* key) {
1092 type() == nullValue || type() == objectValue,
1093 "in Json::Value::resolveReference(): requires objectValue, but found "
1095 if (type() == nullValue)
1096 *
this = Value(objectValue);
1097 CZString actualKey(key,
static_cast<unsigned>(strlen(key)),
1098 CZString::noDuplication);
1099 auto it = value_.map_->lower_bound(actualKey);
1100 if (it != value_.map_->end() && (*it).first == actualKey)
1101 return (*it).second;
1103 ObjectValues::value_type defaultValue(actualKey, nullSingleton());
1104 it = value_.map_->insert(it, defaultValue);
1105 Value& value = (*it).second;
1110Value& Value::resolveReference(
char const* key,
char const* end) {
1112 "in Json::Value::resolveReference(key, end): requires "
1113 "objectValue, but found "
1115 if (type() == nullValue)
1116 *
this = Value(objectValue);
1117 CZString actualKey(key,
static_cast<unsigned>(end - key),
1118 CZString::duplicateOnCopy);
1119 auto it = value_.map_->lower_bound(actualKey);
1120 if (it != value_.map_->end() && (*it).first == actualKey)
1121 return (*it).second;
1123 ObjectValues::value_type defaultValue(actualKey, nullSingleton());
1124 it = value_.map_->insert(it, defaultValue);
1125 Value& value = (*it).second;
1130 const Value* value = &((*this)[index]);
1138 "in Json::Value::find(begin, end): requires "
1139 "objectValue or nullValue");
1142 CZString actualKey(
begin,
static_cast<unsigned>(
end -
begin),
1143 CZString::noDuplication);
1144 ObjectValues::const_iterator it = value_.map_->find(actualKey);
1145 if (it == value_.map_->end())
1147 return &(*it).second;
1150 return find(key.data(), key.data() + key.length());
1192 "in Json::Value::demand(begin, end): requires "
1193 "objectValue or nullValue");
1194 return &resolveReference(
begin,
end);
1197 Value const* found =
find(key, key + strlen(key));
1210 return resolveReference(key, key + strlen(key));
1214 return resolveReference(key.data(), key.data() + key.length());
1218 return resolveReference(key.
c_str());
1225 "in Json::Value::append: requires arrayValue, but found "
1230 return this->value_.map_->emplace(
size(), std::move(value)).first->second;
1239 "in Json::Value::insert: requires arrayValue");
1241 if (index > length) {
1244 for (
ArrayIndex i = length; i > index; i--) {
1245 (*this)[i] = std::move((*
this)[i - 1]);
1247 (*this)[index] = std::move(newValue);
1252 Value const& defaultValue)
const {
1254 return !found ? defaultValue : *found;
1257 return get(key, key + strlen(key), defaultValue);
1260 return get(key.data(), key.data() + key.length(), defaultValue);
1267 CZString actualKey(
begin,
static_cast<unsigned>(
end -
begin),
1268 CZString::noDuplication);
1269 auto it = value_.map_->find(actualKey);
1270 if (it == value_.map_->end())
1273 *removed = std::move(it->second);
1274 value_.map_->erase(it);
1281 return removeMember(key.data(), key.data() + key.length(), removed);
1287 "in Json::Value::removeMember(): requires objectValue, but found "
1292 CZString actualKey(key,
unsigned(strlen(key)), CZString::noDuplication);
1293 value_.map_->erase(actualKey);
1301 CZString key(index);
1302 auto it = value_.map_->find(key);
1303 if (it == value_.map_->end()) {
1307 *removed = std::move(it->second);
1310 for (
ArrayIndex i = index; i < (oldSize - 1); ++i) {
1312 (*value_.map_)[keey] = (*
this)[i + 1];
1315 CZString keyLast(oldSize - 1);
1316 auto itLast = value_.map_->find(keyLast);
1317 value_.map_->erase(itLast);
1323 return nullptr != value;
1326 return isMember(key, key + strlen(key));
1329 return isMember(key.data(), key.data() + key.length());
1335 "in Json::Value::getMemberNames(), value must be objectValue");
1339 members.reserve(value_.map_->size());
1340 ObjectValues::const_iterator it = value_.map_->begin();
1341 ObjectValues::const_iterator itEnd = value_.map_->end();
1342 for (; it != itEnd; ++it) {
1343 members.push_back(
String((*it).first.data(), (*it).first.length()));
1349 double integral_part;
1350 return modf(d, &integral_part) == 0.0;
1360#if defined(JSON_HAS_INT64)
1368 return value_.real_ >=
minInt && value_.real_ <=
maxInt &&
1379#if defined(JSON_HAS_INT64)
1382 return value_.int_ >= 0;
1385#if defined(JSON_HAS_INT64)
1386 return value_.uint_ <=
maxUInt;
1391 return value_.real_ >= 0 && value_.real_ <=
maxUInt &&
1400#if defined(JSON_HAS_INT64)
1414 return value_.real_ > double(
minInt64) && value_.real_ < double(
maxInt64) &&
1424#if defined(JSON_HAS_INT64)
1427 return value_.int_ >= 0;
1449#if defined(JSON_HAS_INT64)
1457 return value_.real_ > double(
minInt64) &&
1481Value::Comments::Comments(
const Comments& that)
1484Value::Comments::Comments(Comments&& that) noexcept
1485 : ptr_{std::move(that.ptr_)} {}
1487Value::Comments& Value::Comments::operator=(
const Comments& that) {
1492Value::Comments& Value::Comments::operator=(Comments&& that)
noexcept {
1493 ptr_ = std::move(that.ptr_);
1498 return ptr_ && !(*ptr_)[slot].empty();
1504 return (*ptr_)[slot];
1511 ptr_ = std::unique_ptr<Array>(
new Array());
1512 (*ptr_)[slot] = std::move(comment);
1516 if (!comment.empty() && (comment.back() ==
'\n')) {
1521 comment.empty() || comment[0] ==
'/',
1522 "in Json::Value::setComment(): Comments must start with /");
1523 comments_.set(
placement, std::move(comment));
1583 return iterator(value_.map_->begin());
1596 return iterator(value_.map_->end());
1610 : index_(index), kind_(kindIndex) {}
1632void Path::makePath(
const String& path,
const InArgs& in) {
1633 const char* current = path.c_str();
1634 const char* end = current + path.length();
1635 auto itInArg = in.begin();
1636 while (current != end) {
1637 if (*current ==
'[') {
1639 if (*current ==
'%')
1640 addPathInArg(path, in, itInArg, PathArgument::kindIndex);
1643 for (; current != end && *current >=
'0' && *current <=
'9'; ++current)
1644 index = index * 10 +
ArrayIndex(*current -
'0');
1645 args_.push_back(index);
1647 if (current == end || *++current !=
']')
1648 invalidPath(path,
int(current - path.c_str()));
1649 }
else if (*current ==
'%') {
1650 addPathInArg(path, in, itInArg, PathArgument::kindKey);
1652 }
else if (*current ==
'.' || *current ==
']') {
1655 const char* beginName = current;
1656 while (current != end && !strchr(
"[.", *current))
1658 args_.push_back(
String(beginName, current));
1663void Path::addPathInArg(
const String& ,
const InArgs& in,
1664 InArgs::const_iterator& itInArg,
1665 PathArgument::Kind kind) {
1666 if (itInArg == in.end()) {
1668 }
else if ((*itInArg)->kind_ != kind) {
1671 args_.push_back(**itInArg++);
1675void Path::invalidPath(
const String& ,
int ) {
1680 const Value* node = &root;
1681 for (
const auto& arg : args_) {
1682 if (arg.kind_ == PathArgument::kindIndex) {
1687 node = &((*node)[arg.index_]);
1688 }
else if (arg.kind_ == PathArgument::kindKey) {
1693 node = &((*node)[arg.key_]);
1705 const Value* node = &root;
1706 for (
const auto& arg : args_) {
1707 if (arg.kind_ == PathArgument::kindIndex) {
1709 return defaultValue;
1710 node = &((*node)[arg.index_]);
1711 }
else if (arg.kind_ == PathArgument::kindKey) {
1713 return defaultValue;
1714 node = &((*node)[arg.key_]);
1716 return defaultValue;
1723 Value* node = &root;
1724 for (
const auto& arg : args_) {
1725 if (arg.kind_ == PathArgument::kindIndex) {
1729 node = &((*node)[arg.index_]);
1730 }
else if (arg.kind_ == PathArgument::kindKey) {
1734 node = &((*node)[arg.key_]);
#define JSON_ASSERT(condition)
It should not be possible for a maliciously designed file to cause an abort() or seg-fault,...
#define JSON_FAIL_MESSAGE(message)
#define JSON_ASSERT_MESSAGE(condition, message)
char const * what() const noexcept override
~Exception() noexcept override
LogicError(String const &msg)
Experimental and untested: represents an element of the "path" to access a node.
Path(const String &path, const PathArgument &a1=PathArgument(), const PathArgument &a2=PathArgument(), const PathArgument &a3=PathArgument(), const PathArgument &a4=PathArgument(), const PathArgument &a5=PathArgument())
Value & make(Value &root) const
Creates the "path" to access the specified node and returns a reference on the node.
const Value & resolve(const Value &root) const
Exceptions which the user cannot easily avoid.
RuntimeError(String const &msg)
Lightweight wrapper to tag static string.
const char * c_str() const
Build a StreamWriter implementation.
const_iterator begin() const
Value get(ArrayIndex index, const Value &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
bool empty() const
Return true if empty array, empty object, or null; otherwise, false.
Json::ArrayIndex ArrayIndex
ArrayIndex size() const
Number of values in array or object.
const char * asCString() const
Embedded zeroes could cause you trouble!
bool operator==(const Value &other) const
static constexpr Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
void copy(const Value &other)
copy everything.
static const Value & null
Value const * findDouble(const String &key) const
void setComment(const char *comment, size_t len, CommentPlacement placement)
Comments must be //... or /* ... */.
ptrdiff_t getOffsetLimit() const
bool getString(char const **begin, char const **end) const
Get raw char* of string-value.
Value const * findString(const String &key) const
static constexpr double maxUInt64AsDouble
std::vector< String > Members
const_iterator end() const
bool operator<=(const Value &other) const
String getComment(CommentPlacement placement) const
Include delimiters and embedded newlines.
bool operator>(const Value &other) const
String toStyledString() const
void clear()
Remove all object members and array elements.
String asString() const
Embedded zeroes are possible.
void swapPayload(Value &other)
Swap values but leave comments and source offsets in place.
CommentPlacement placement
void setOffsetLimit(ptrdiff_t limit)
bool removeIndex(ArrayIndex index, Value *removed)
Remove the indexed array element.
Value const * findArray(const String &key) const
bool hasComment(CommentPlacement placement) const
Json::LargestInt LargestInt
Json::LargestUInt LargestUInt
ValueConstIterator const_iterator
Members getMemberNames() const
Return a list of the member names.
void resize(ArrayIndex newSize)
Resize the array to newSize elements.
Value & operator[](ArrayIndex index)
Value & append(const Value &value)
Append value to array at the end.
Value const * findBool(const String &key) const
bool operator!=(const Value &other) const
Value const * findValue(const String &key) const
Calls find and only returns a valid pointer if the type is found.
Value const * findInt64(const String &key) const
void removeMember(const char *key)
Remove and return the named member.
void setOffsetStart(ptrdiff_t start)
ValueMembersView members()
Value const * findNull(const String &key) const
Value const * findUInt(const String &key) const
Value * demand(char const *begin, char const *end)
Most general and efficient version of object-mutators.
void swap(Value &other)
Swap everything.
bool operator<(const Value &other) const
Compare payload only, not comments etc.
Value const * findInt(const String &key) const
static const Value & nullRef
LargestInt asLargestInt() const
void copyPayload(const Value &other)
copy values but leave comments and source offsets in place.
Value const * findIntegral(const String &key) const
static constexpr Int maxInt
Maximum signed int value that can be stored in a Json::Value.
Value const * findNumeric(const String &key) const
bool isValidIndex(ArrayIndex index) const
Return true if index < size().
Value const * findUInt64(const String &key) const
LargestUInt asLargestUInt() const
Value const * findObject(const String &key) const
bool isMember(const char *key) const
Return true if the object has a member named key.
Value(ValueType type=nullValue)
Create a default Value of the given type.
static constexpr UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
Value & operator=(const Value &other)
static constexpr Int minInt
Minimum signed int value that can be stored in a Json::Value.
bool insert(ArrayIndex index, const Value &newValue)
Insert value in array at specific index.
static constexpr Int64 minInt64
Minimum signed 64 bits int value that can be stored in a Json::Value.
int compare(const Value &other) const
bool isConvertibleTo(ValueType other) const
static Value const & nullSingleton()
ptrdiff_t getOffsetStart() const
Value const * find(char const *begin, char const *end) const
Most general and efficient version of isMember()const, get()const, and operator[]const.
bool operator>=(const Value &other) const
static constexpr UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
#define JSON_API
If defined, indicates that the source file is amalgamated to prevent private header inclusion.
int msvc_pre1900_c99_snprintf(char *outBuf, size_t size, const char *format,...)
#define JSON_ASSERT_UNREACHABLE
static int msvc_pre1900_c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
JSON (JavaScript Object Notation).
static char * duplicateStringValue(const char *value, size_t length)
Duplicates the specified string value.
static bool IsIntegral(double d)
static const char * valueTypeToString(ValueType type)
static void releaseStringValue(char *value, unsigned)
static void releasePrefixedStringValue(char *value)
Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue().
String writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience.
@ commentBefore
a comment placed on the line before a value
@ numberOfCommentPlacement
root value)
String valueToString(Int value)
ValueType
Type of the value held by a Value object.
@ stringValue
UTF-8 string value.
@ arrayValue
array value (ordered list)
@ intValue
signed integer value
@ objectValue
object value (collection of name/value pairs).
@ uintValue
unsigned integer value
static void decodePrefixedString(bool isPrefixed, char const *prefixed, unsigned *length, char const **value)
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
static std::unique_ptr< T > cloneUnique(const std::unique_ptr< T > &p)
static char * duplicateAndPrefixStringValue(const char *value, unsigned int length)
static bool InRange(double d, T min, U max)
#define JSONCPP_VERSION_STRING