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);
93static inline double integerToDouble(
Json::UInt64 value) {
94 return static_cast<double>(
Int64(value / 2)) * 2.0 +
95 static_cast<double>(
Int64(value & 1));
98template <
typename T>
static inline double integerToDouble(T value) {
99 return static_cast<double>(value);
102template <
typename T,
typename U>
103static inline bool InRange(
double d, T min, U max) {
104 return d >= integerToDouble(min) && d <= integerToDouble(max);
121 auto newString =
static_cast<char*
>(malloc(length + 1));
122 if (newString ==
nullptr) {
123 throwRuntimeError(
"in Json::Value::duplicateStringValue(): "
124 "Failed to allocate string value buffer");
126 memcpy(newString, value, length);
127 newString[length] = 0;
134 unsigned int length) {
138 sizeof(
unsigned) - 1U,
139 "in Json::Value::duplicateAndPrefixStringValue(): "
140 "length too big for prefixing");
141 size_t actualLength =
sizeof(length) + length + 1;
142 auto newString =
static_cast<char*
>(malloc(actualLength));
143 if (newString ==
nullptr) {
144 throwRuntimeError(
"in Json::Value::duplicateAndPrefixStringValue(): "
145 "Failed to allocate string value buffer");
147 *
reinterpret_cast<unsigned*
>(newString) = length;
148 memcpy(newString +
sizeof(
unsigned), value, length);
149 newString[actualLength - 1U] =
154 unsigned* length,
char const** value) {
156 *length =
static_cast<unsigned>(strlen(prefixed));
159 *length = *
reinterpret_cast<unsigned const*
>(prefixed);
160 *value = prefixed +
sizeof(unsigned);
166#if JSONCPP_USING_SECURE_MEMORY
169 char const* valueDecoded;
171 size_t const size =
sizeof(unsigned) + length + 1U;
172 memset(value, 0, size);
177 size_t size = (length == 0) ? strlen(value) : length;
178 memset(value, 0, size);
195#if !defined(JSON_IS_AMALGAMATION)
202#if JSON_USE_EXCEPTION
205char const*
Exception::what() const noexcept {
return msg_.c_str(); }
212 throw LogicError(msg);
216 std::cerr << msg << std::endl;
220 std::cerr << msg << std::endl;
236Value::CZString::CZString(
ArrayIndex index) : cstr_(nullptr), index_(index) {}
238Value::CZString::CZString(
char const* str,
unsigned length,
239 DuplicationPolicy allocate)
242 storage_.policy_ = allocate & 0x3;
243 storage_.length_ = length & 0x3FFFFFFF;
246Value::CZString::CZString(
const CZString& other) {
247 cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ !=
nullptr
251 static_cast<unsigned>(
253 ? (
static_cast<DuplicationPolicy
>(other.storage_.policy_) ==
257 :
static_cast<DuplicationPolicy
>(other.storage_.policy_)) &
259 storage_.length_ = other.storage_.length_;
262Value::CZString::CZString(CZString&& other) noexcept
263 : cstr_(other.cstr_), index_(other.index_) {
264 other.cstr_ =
nullptr;
267Value::CZString::~CZString() {
268 if (cstr_ && storage_.policy_ == duplicate) {
270 storage_.length_ + 1U);
282Value::CZString& Value::CZString::operator=(
const CZString& other) {
284 index_ = other.index_;
288Value::CZString& Value::CZString::operator=(CZString&& other)
noexcept {
290 index_ = other.index_;
291 other.cstr_ =
nullptr;
295bool Value::CZString::operator<(
const CZString& other)
const {
297 return index_ < other.index_;
300 unsigned this_len = this->storage_.length_;
301 unsigned other_len = other.storage_.length_;
302 unsigned min_len = std::min<unsigned>(this_len, other_len);
304 int comp = memcmp(this->cstr_, other.cstr_, min_len);
309 return (this_len < other_len);
314 return index_ == other.index_;
317 unsigned this_len = this->storage_.length_;
318 unsigned other_len = other.storage_.length_;
319 if (this_len != other_len)
322 int comp = memcmp(this->cstr_, other.cstr_, this_len);
326ArrayIndex Value::CZString::index()
const {
return index_; }
329const char* Value::CZString::data()
const {
return cstr_; }
330unsigned Value::CZString::length()
const {
return storage_.length_; }
331bool Value::CZString::isStaticString()
const {
332 return storage_.policy_ == noDuplication;
348 static char const emptyString[] =
"";
362 value_.string_ =
const_cast<char*
>(
static_cast<char const*
>(emptyString));
366 value_.map_ =
new ObjectValues();
369 value_.bool_ =
false;
383 value_.uint_ = value;
385#if defined(JSON_HAS_INT64)
392 value_.uint_ = value;
396Value::Value(
double value) {
398 value_.real_ = value;
401Value::Value(
const char* value) {
404 "Null Value Passed to Value Constructor");
406 value,
static_cast<unsigned>(strlen(value)));
409Value::Value(
const char* begin,
const char* end) {
418 value.data(),
static_cast<unsigned>(value.length()));
423 value_.string_ =
const_cast<char*
>(value.
c_str());
426Value::Value(
bool value) {
428 value_.bool_ = value;
436Value::Value(
Value&& other)
noexcept {
456void Value::swapPayload(
Value& other) {
461void Value::copyPayload(
const Value& other) {
473void Value::copy(
const Value& other) {
479 return static_cast<ValueType>(bits_.value_type_);
482int Value::compare(
const Value& other)
const {
490bool Value::operator<(
const Value& other)
const {
491 int typeDelta = type() - other.
type();
493 return typeDelta < 0;
498 return value_.int_ < other.value_.int_;
500 return value_.uint_ < other.value_.uint_;
502 return value_.real_ < other.value_.real_;
504 return value_.bool_ < other.value_.bool_;
506 if ((value_.string_ ==
nullptr) || (other.value_.string_ ==
nullptr)) {
507 return other.value_.string_ !=
nullptr;
511 char const* this_str;
512 char const* other_str;
517 unsigned min_len = std::min<unsigned>(this_len, other_len);
519 int comp = memcmp(this_str, other_str, min_len);
524 return (this_len < other_len);
528 auto thisSize = value_.map_->size();
529 auto otherSize = other.value_.map_->size();
530 if (thisSize != otherSize)
531 return thisSize < otherSize;
532 return (*value_.map_) < (*other.value_.map_);
540bool Value::operator<=(
const Value& other)
const {
return !(other < *
this); }
542bool Value::operator>=(
const Value& other)
const {
return !(*
this < other); }
544bool Value::operator>(
const Value& other)
const {
return other < *
this; }
547 if (type() != other.
type())
553 return value_.int_ == other.value_.int_;
555 return value_.uint_ == other.value_.uint_;
557 return value_.real_ == other.value_.real_;
559 return value_.bool_ == other.value_.bool_;
561 if ((value_.string_ ==
nullptr) || (other.value_.string_ ==
nullptr)) {
562 return (value_.string_ == other.value_.string_);
566 char const* this_str;
567 char const* other_str;
572 if (this_len != other_len)
575 int comp = memcmp(this_str, other_str, this_len);
580 return value_.map_->size() == other.value_.map_->size() &&
581 (*value_.map_) == (*other.value_.map_);
590const char* Value::asCString()
const {
592 "in Json::Value::asCString(): requires stringValue");
593 if (value_.string_ ==
nullptr)
596 char const* this_str;
602#if JSONCPP_USING_SECURE_MEMORY
603unsigned Value::getCStringLength()
const {
605 "in Json::Value::asCString(): requires stringValue");
606 if (value_.string_ == 0)
609 char const* this_str;
616bool Value::getString(
char const** begin,
char const** end)
const {
619 if (value_.string_ ==
nullptr)
624 *end = *begin + length;
633 if (value_.string_ ==
nullptr)
636 char const* this_str;
639 return String(this_str, this_len);
642 return value_.bool_ ?
"true" :
"false";
658 return Int(value_.int_);
661 return Int(value_.uint_);
664 "double out of Int range");
665 return Int(value_.real_);
669 return value_.bool_ ? 1 : 0;
680 return UInt(value_.int_);
683 return UInt(value_.uint_);
686 "double out of UInt range");
687 return UInt(value_.real_);
691 return value_.bool_ ? 1 : 0;
698#if defined(JSON_HAS_INT64)
703 return Int64(value_.int_);
706 return Int64(value_.uint_);
709 "double out of Int64 range");
710 return Int64(value_.real_);
714 return value_.bool_ ? 1 : 0;
725 return UInt64(value_.int_);
727 return UInt64(value_.uint_);
730 "double out of UInt64 range");
731 return UInt64(value_.real_);
735 return value_.bool_ ? 1 : 0;
744#if defined(JSON_NO_INT64)
752#if defined(JSON_NO_INT64)
759double Value::asDouble()
const {
762 return static_cast<double>(value_.int_);
764#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
765 return static_cast<double>(value_.uint_);
767 return integerToDouble(value_.uint_);
774 return value_.bool_ ? 1.0 : 0.0;
781float Value::asFloat()
const {
784 return static_cast<float>(value_.int_);
786#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
787 return static_cast<float>(value_.uint_);
790 return static_cast<float>(integerToDouble(value_.uint_));
793 return static_cast<float>(value_.real_);
797 return value_.bool_ ? 1.0F : 0.0F;
804bool Value::asBool()
const {
811 return value_.int_ != 0;
813 return value_.uint_ != 0;
816 const auto value_classification = std::fpclassify(value_.real_);
817 return value_classification != FP_ZERO && value_classification != FP_NAN;
828 return (isNumeric() && asDouble() == 0.0) ||
831 (type() ==
arrayValue && value_.map_->empty()) ||
869 if (!value_.map_->empty()) {
870 ObjectValues::const_iterator itLast = value_.map_->end();
872 return (*itLast).first.index() + 1;
882bool Value::empty()
const {
883 if (isNull() || isArray() || isObject())
888Value::operator bool()
const {
return !isNull(); }
893 "in Json::Value::clear(): requires complex value");
899 value_.map_->clear();
908 "in Json::Value::resize(): requires arrayValue");
914 else if (newSize > oldSize)
915 for (
ArrayIndex i = oldSize; i < newSize; ++i)
918 for (
ArrayIndex index = newSize; index < oldSize; ++index) {
919 value_.map_->erase(index);
928 "in Json::Value::operator[](ArrayIndex): requires arrayValue");
932 auto it = value_.map_->lower_bound(key);
933 if (it != value_.map_->end() && (*it).first == key)
936 ObjectValues::value_type defaultValue(key, nullSingleton());
937 it = value_.map_->insert(it, defaultValue);
941Value& Value::operator[](
int index) {
944 "in Json::Value::operator[](int index): index cannot be negative");
951 "in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
953 return nullSingleton();
955 ObjectValues::const_iterator it = value_.map_->find(key);
956 if (it == value_.map_->end())
957 return nullSingleton();
961const Value& Value::operator[](
int index)
const {
964 "in Json::Value::operator[](int index) const: index cannot be negative");
968void Value::initBasic(
ValueType type,
bool allocated) {
970 setIsAllocated(allocated);
971 comments_ = Comments{};
976void Value::dupPayload(
const Value& other) {
977 setType(other.type());
978 setIsAllocated(
false);
985 value_ = other.value_;
988 if (other.value_.string_ && other.isAllocated()) {
994 setIsAllocated(
true);
996 value_.string_ = other.value_.string_;
1001 value_.map_ =
new ObjectValues(*other.value_.map_);
1008void Value::releasePayload() {
1029void Value::dupMeta(
const Value& other) {
1030 comments_ = other.comments_;
1031 start_ = other.start_;
1032 limit_ = other.limit_;
1038Value& Value::resolveReference(
const char* key) {
1041 "in Json::Value::resolveReference(): requires objectValue");
1044 CZString actualKey(key,
static_cast<unsigned>(strlen(key)),
1045 CZString::noDuplication);
1046 auto 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, nullSingleton());
1051 it = value_.map_->insert(it, defaultValue);
1052 Value& value = (*it).second;
1057Value& Value::resolveReference(
char const* key,
char const* end) {
1060 "in Json::Value::resolveReference(key, end): requires objectValue");
1063 CZString actualKey(key,
static_cast<unsigned>(end - key),
1064 CZString::duplicateOnCopy);
1065 auto it = value_.map_->lower_bound(actualKey);
1066 if (it != value_.map_->end() && (*it).first == actualKey)
1067 return (*it).second;
1069 ObjectValues::value_type defaultValue(actualKey, nullSingleton());
1070 it = value_.map_->insert(it, defaultValue);
1071 Value& value = (*it).second;
1076 const Value* value = &((*this)[index]);
1077 return value == &nullSingleton() ? defaultValue : *value;
1080bool Value::isValidIndex(
ArrayIndex index)
const {
return index < size(); }
1082Value const* Value::find(
char const* begin,
char const* end)
const {
1084 "in Json::Value::find(begin, end): requires "
1085 "objectValue or nullValue");
1088 CZString actualKey(begin,
static_cast<unsigned>(end - begin),
1089 CZString::noDuplication);
1090 ObjectValues::const_iterator it = value_.map_->find(actualKey);
1091 if (it == value_.map_->end())
1093 return &(*it).second;
1095Value* Value::demand(
char const* begin,
char const* end) {
1097 "in Json::Value::demand(begin, end): requires "
1098 "objectValue or nullValue");
1099 return &resolveReference(begin, end);
1101const Value& Value::operator[](
const char* key)
const {
1102 Value const* found = find(key, key + strlen(key));
1104 return nullSingleton();
1108 Value const* found = find(key.data(), key.data() + key.length());
1110 return nullSingleton();
1114Value& Value::operator[](
const char* key) {
1115 return resolveReference(key, key + strlen(key));
1119 return resolveReference(key.data(), key.data() + key.length());
1123 return resolveReference(key.
c_str());
1130 "in Json::Value::append: requires arrayValue");
1134 return this->value_.map_->emplace(size(), std::move(value)).first->second;
1138 return insert(index,
Value(newValue));
1143 "in Json::Value::insert: requires arrayValue");
1145 if (index > length) {
1148 for (
ArrayIndex i = length; i > index; i--) {
1149 (*this)[i] = std::move((*
this)[i - 1]);
1151 (*this)[index] = std::move(newValue);
1155Value Value::get(
char const* begin,
char const* end,
1156 Value const& defaultValue)
const {
1157 Value const* found = find(begin, end);
1158 return !found ? defaultValue : *found;
1160Value Value::get(
char const* key,
Value const& defaultValue)
const {
1161 return get(key, key + strlen(key), defaultValue);
1164 return get(key.data(), key.data() + key.length(), defaultValue);
1167bool Value::removeMember(
const char* begin,
const char* end,
Value* removed) {
1171 CZString actualKey(begin,
static_cast<unsigned>(end - begin),
1172 CZString::noDuplication);
1173 auto it = value_.map_->find(actualKey);
1174 if (it == value_.map_->end())
1177 *removed = std::move(it->second);
1178 value_.map_->erase(it);
1181bool Value::removeMember(
const char* key,
Value* removed) {
1182 return removeMember(key, key + strlen(key), removed);
1185 return removeMember(key.data(), key.data() + key.length(), removed);
1187void Value::removeMember(
const char* key) {
1189 "in Json::Value::removeMember(): requires objectValue");
1193 CZString actualKey(key,
unsigned(strlen(key)), CZString::noDuplication);
1194 value_.map_->erase(actualKey);
1196void Value::removeMember(
const String& key) { removeMember(key.c_str()); }
1202 CZString key(index);
1203 auto it = value_.map_->find(key);
1204 if (it == value_.map_->end()) {
1208 *removed = it->second;
1211 for (
ArrayIndex i = index; i < (oldSize - 1); ++i) {
1213 (*value_.map_)[keey] = (*
this)[i + 1];
1216 CZString keyLast(oldSize - 1);
1217 auto itLast = value_.map_->find(keyLast);
1218 value_.map_->erase(itLast);
1222bool Value::isMember(
char const* begin,
char const* end)
const {
1223 Value const* value = find(begin, end);
1224 return nullptr != value;
1226bool Value::isMember(
char const* key)
const {
1227 return isMember(key, key + strlen(key));
1229bool Value::isMember(
String const& key)
const {
1230 return isMember(key.data(), key.data() + key.length());
1236 "in Json::Value::getMemberNames(), value must be objectValue");
1240 members.reserve(value_.map_->size());
1241 ObjectValues::const_iterator it = value_.map_->begin();
1242 ObjectValues::const_iterator itEnd = value_.map_->end();
1243 for (; it != itEnd; ++it) {
1244 members.push_back(
String((*it).first.data(), (*it).first.length()));
1250 double integral_part;
1251 return modf(d, &integral_part) == 0.0;
1258bool Value::isInt()
const {
1261#if defined(JSON_HAS_INT64)
1262 return value_.int_ >= minInt && value_.int_ <= maxInt;
1267 return value_.uint_ <=
UInt(maxInt);
1269 return value_.real_ >= minInt && value_.real_ <= maxInt &&
1277bool Value::isUInt()
const {
1280#if defined(JSON_HAS_INT64)
1283 return value_.int_ >= 0;
1286#if defined(JSON_HAS_INT64)
1287 return value_.uint_ <= maxUInt;
1292 return value_.real_ >= 0 && value_.real_ <= maxUInt &&
1300bool Value::isInt64()
const {
1301#if defined(JSON_HAS_INT64)
1306 return value_.uint_ <=
UInt64(maxInt64);
1311 return value_.real_ >= double(minInt64) &&
1312 value_.real_ < double(maxInt64) &&
IsIntegral(value_.real_);
1320bool Value::isUInt64()
const {
1321#if defined(JSON_HAS_INT64)
1324 return value_.int_ >= 0;
1331 return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble &&
1340bool Value::isIntegral()
const {
1346#if defined(JSON_HAS_INT64)
1350 return value_.real_ >= double(minInt64) &&
1351 value_.real_ < maxUInt64AsDouble &&
IsIntegral(value_.real_);
1353 return value_.real_ >= minInt && value_.real_ <= maxUInt &&
1362bool Value::isDouble()
const {
1366bool Value::isNumeric()
const {
return isDouble(); }
1374Value::Comments::Comments(
const Comments& that)
1377Value::Comments::Comments(Comments&& that) noexcept
1378 : ptr_{std::move(that.ptr_)} {}
1380Value::Comments& Value::Comments::operator=(
const Comments& that) {
1385Value::Comments& Value::Comments::operator=(Comments&& that)
noexcept {
1386 ptr_ = std::move(that.ptr_);
1391 return ptr_ && !(*ptr_)[slot].empty();
1397 return (*ptr_)[slot];
1404 ptr_ = std::unique_ptr<Array>(
new Array());
1405 (*ptr_)[slot] = std::move(comment);
1409 if (!comment.empty() && (comment.back() ==
'\n')) {
1415 comment[0] ==
'\0' || comment[0] ==
'/',
1416 "in Json::Value::setComment(): Comments must start with /");
1417 comments_.set(
placement, std::move(comment));
1477 return iterator(value_.map_->begin());
1490 return iterator(value_.map_->end());
1504 : index_(index), kind_(kindIndex) {}
1526void Path::makePath(
const String& path,
const InArgs& in) {
1527 const char* current = path.c_str();
1528 const char* end = current + path.length();
1529 auto itInArg = in.begin();
1530 while (current != end) {
1531 if (*current ==
'[') {
1533 if (*current ==
'%')
1534 addPathInArg(path, in, itInArg, PathArgument::kindIndex);
1537 for (; current != end && *current >=
'0' && *current <=
'9'; ++current)
1538 index = index * 10 +
ArrayIndex(*current -
'0');
1539 args_.push_back(index);
1541 if (current == end || *++current !=
']')
1542 invalidPath(path,
int(current - path.c_str()));
1543 }
else if (*current ==
'%') {
1544 addPathInArg(path, in, itInArg, PathArgument::kindKey);
1546 }
else if (*current ==
'.' || *current ==
']') {
1549 const char* beginName = current;
1550 while (current != end && !strchr(
"[.", *current))
1552 args_.push_back(
String(beginName, current));
1557void Path::addPathInArg(
const String& ,
const InArgs& in,
1558 InArgs::const_iterator& itInArg,
1559 PathArgument::Kind kind) {
1560 if (itInArg == in.end()) {
1562 }
else if ((*itInArg)->kind_ != kind) {
1565 args_.push_back(**itInArg++);
1569void Path::invalidPath(
const String& ,
int ) {
1574 const Value* node = &root;
1575 for (
const auto& arg : args_) {
1576 if (arg.kind_ == PathArgument::kindIndex) {
1581 node = &((*node)[arg.index_]);
1582 }
else if (arg.kind_ == PathArgument::kindKey) {
1587 node = &((*node)[arg.key_]);
1599 const Value* node = &root;
1600 for (
const auto& arg : args_) {
1601 if (arg.kind_ == PathArgument::kindIndex) {
1603 return defaultValue;
1604 node = &((*node)[arg.index_]);
1605 }
else if (arg.kind_ == PathArgument::kindKey) {
1607 return defaultValue;
1608 node = &((*node)[arg.key_]);
1610 return defaultValue;
1617 Value* node = &root;
1618 for (
const auto& arg : args_) {
1619 if (arg.kind_ == PathArgument::kindIndex) {
1623 node = &((*node)[arg.index_]);
1624 }
else if (arg.kind_ == PathArgument::kindKey) {
1628 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)
Base class for all exceptions we throw.
~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 for object and array value.
const_iterator begin() const
Json::ArrayIndex ArrayIndex
static const Value & null
void setComment(const char *comment, size_t len, CommentPlacement placement)
Comments must be //... or /* ... */.
ptrdiff_t getOffsetLimit() const
std::vector< String > Members
const_iterator end() const
String getComment(CommentPlacement placement) const
Include delimiters and embedded newlines.
String toStyledString() const
CommentPlacement placement
void setOffsetLimit(ptrdiff_t limit)
bool hasComment(CommentPlacement placement) const
Json::LargestInt LargestInt
Json::LargestUInt LargestUInt
ValueConstIterator const_iterator
void setOffsetStart(ptrdiff_t start)
void swap(Value &other)
Swap everything.
static const Value & nullRef
static constexpr Int maxInt
Maximum signed int value that can be stored in a Json::Value.
bool isValidIndex(ArrayIndex index) const
Return true if index < size().
static Value const & nullSingleton()
ptrdiff_t getOffsetStart() const
Iterator for object and array 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)
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
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
bool operator==(const SecureAllocator< T > &, const SecureAllocator< U > &)
bool operator!=(const SecureAllocator< T > &, const SecureAllocator< U > &)
static void decodePrefixedString(bool isPrefixed, char const *prefixed, unsigned *length, char const **value)
static std::unique_ptr< T > cloneUnique(const std::unique_ptr< T > &p)
static char * duplicateAndPrefixStringValue(const char *value, unsigned int length)
void swap(Value &a, Value &b)
static bool InRange(double d, T min, U max)