40 #include <plugin/json_server/json/value.h>
41 #include <plugin/json_server/json/writer.h>
51 # include <cpptl/conststring.h>
54 #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
55 # include "json_batchallocator.h"
56 #endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
58 #define JSON_ASSERT_UNREACHABLE assert( false )
59 #define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
60 #define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
64 const Value Value::null;
65 const Int Value::minInt = Int( ~(UInt(-1)/2) );
66 const Int Value::maxInt = Int( UInt(-1)/2 );
67 const UInt Value::maxUInt = UInt(-1);
97 ValueAllocator::~ValueAllocator()
104 virtual char *makeMemberName(
const char *memberName )
106 return duplicateStringValue( memberName );
109 virtual void releaseMemberName(
char *memberName )
111 releaseStringValue( memberName );
114 virtual char *duplicateStringValue(
const char *value,
115 unsigned int length = unknown )
121 if ( length == unknown )
122 length = (
unsigned int)strlen(value);
123 char *newString =
static_cast<char *
>( malloc( length + 1 ) );
124 memcpy( newString, value, length );
125 newString[length] = 0;
129 virtual void releaseStringValue(
char *value )
139 return valueAllocator;
147 } dummyValueAllocatorInitializer;
158 #ifdef JSON_VALUE_USE_INTERNAL_MAP
159 # include "json_internalarray.inl"
160 # include "json_internalmap.inl"
161 #endif // JSON_VALUE_USE_INTERNAL_MAP
163 # include "json_valueiterator.inl"
175 Value::CommentInfo::CommentInfo()
180 Value::CommentInfo::~CommentInfo()
183 valueAllocator()->releaseStringValue( comment_ );
188 Value::CommentInfo::setComment(
const char *text )
191 valueAllocator()->releaseStringValue( comment_ );
193 JSON_ASSERT_MESSAGE( text[0]==
'\0' || text[0]==
'/',
"Comments must start with /");
195 comment_ = valueAllocator()->duplicateStringValue( text );
206 # ifndef JSON_VALUE_USE_INTERNAL_MAP
211 Value::CZString::CZString(
int index_arg )
213 , index_( index_arg )
217 Value::CZString::CZString(
const char *cstr, DuplicationPolicy allocate )
218 : cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr)
224 Value::CZString::CZString(
const CZString &other )
225 : cstr_( other.index_ != noDuplication && other.cstr_ != 0
226 ? valueAllocator()->makeMemberName( other.cstr_ )
228 , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate)
233 Value::CZString::~CZString()
235 if ( cstr_ && index_ == duplicate )
236 valueAllocator()->releaseMemberName( const_cast<char *>( cstr_ ) );
240 Value::CZString::swap( CZString &other )
242 std::swap( cstr_, other.cstr_ );
243 std::swap( index_, other.index_ );
247 Value::CZString::operator =(
const CZString &other )
249 CZString temp( other );
255 Value::CZString::operator<(
const CZString &other )
const
258 return strcmp( cstr_, other.cstr_ ) < 0;
259 return index_ < other.index_;
263 Value::CZString::operator==(
const CZString &other )
const
266 return strcmp( cstr_, other.cstr_ ) == 0;
267 return index_ == other.index_;
272 Value::CZString::index()
const
279 Value::CZString::c_str()
const
285 Value::CZString::isStaticString()
const
287 return index_ == noDuplication;
290 #endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
309 # ifdef JSON_VALUE_USE_INTERNAL_MAP
312 , value_as_string_( 0 )
328 #ifndef JSON_VALUE_USE_INTERNAL_MAP
331 value_.map_ =
new ObjectValues();
335 value_.array_ = arrayAllocator()->newArray();
338 value_.map_ = mapAllocator()->newMap();
342 value_.bool_ =
false;
345 JSON_ASSERT_UNREACHABLE;
353 # ifdef JSON_VALUE_USE_INTERNAL_MAP
356 , value_as_string_( 0 )
365 # ifdef JSON_VALUE_USE_INTERNAL_MAP
368 , value_as_string_( 0 )
370 value_.uint_ = value;
376 # ifdef JSON_VALUE_USE_INTERNAL_MAP
379 , value_as_string_( 0 )
381 value_.real_ = value;
388 # ifdef JSON_VALUE_USE_INTERNAL_MAP
391 , value_as_string_( 0 )
393 value_.string_ = valueAllocator()->duplicateStringValue( value );
398 const char *endValue )
402 # ifdef JSON_VALUE_USE_INTERNAL_MAP
405 , value_as_string_( 0 )
407 value_.string_ = valueAllocator()->duplicateStringValue( beginValue,
408 UInt(endValue - beginValue) );
416 # ifdef JSON_VALUE_USE_INTERNAL_MAP
419 , value_as_string_( 0 )
421 value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(),
422 (
unsigned int)value.length() );
428 , allocated_( false )
430 # ifdef JSON_VALUE_USE_INTERNAL_MAP
433 , value_as_string_( 0 )
435 value_.string_ =
const_cast<char *
>( value.c_str() );
439 # ifdef JSON_USE_CPPTL
444 # ifdef JSON_VALUE_USE_INTERNAL_MAP
447 , value_as_string_( 0 )
449 value_.string_ = valueAllocator()->duplicateStringValue( value, value.length() );
456 # ifdef JSON_VALUE_USE_INTERNAL_MAP
459 , value_as_string_( 0 )
461 value_.bool_ = value;
466 : type_( other.type_ )
468 # ifdef JSON_VALUE_USE_INTERNAL_MAP
471 , value_as_string_( 0 )
480 value_ = other.value_;
483 if ( other.value_.string_ )
485 value_.string_ = valueAllocator()->duplicateStringValue( other.value_.string_ );
491 #ifndef JSON_VALUE_USE_INTERNAL_MAP
494 value_.map_ =
new ObjectValues( *other.value_.map_ );
498 value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ );
501 value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ );
505 JSON_ASSERT_UNREACHABLE;
507 if ( other.comments_ )
509 comments_ =
new CommentInfo[numberOfCommentPlacement];
510 for (
int comment =0; comment < numberOfCommentPlacement; ++comment )
512 const CommentInfo &otherComment = other.comments_[comment];
513 if ( otherComment.comment_ )
514 comments_[comment].setComment( otherComment.comment_ );
528 if ( value_as_string_ )
529 valueAllocator()->releaseStringValue( value_as_string_ );
533 valueAllocator()->releaseStringValue( value_.string_ );
535 #ifndef JSON_VALUE_USE_INTERNAL_MAP
542 arrayAllocator()->destructArray( value_.array_ );
545 mapAllocator()->destructMap( value_.map_ );
549 JSON_ASSERT_UNREACHABLE;
556 Value::operator=(
const Value &other )
569 std::swap( value_, other.value_ );
570 int temp2 = allocated_;
571 allocated_ = other.allocated_;
572 other.allocated_ = temp2;
583 Value::compare(
const Value & )
613 Value::operator <(
const Value &other )
const
615 int typeDelta = type_ - other.type_;
617 return typeDelta < 0 ?
true :
false;
623 return value_.int_ < other.value_.int_;
625 return value_.uint_ < other.value_.uint_;
627 return value_.real_ < other.value_.real_;
629 return value_.bool_ < other.value_.bool_;
631 return ( value_.string_ == 0 && other.value_.string_ )
632 || ( other.value_.string_
634 && strcmp( value_.string_, other.value_.string_ ) < 0 );
635 #ifndef JSON_VALUE_USE_INTERNAL_MAP
639 int delta = int( value_.map_->size() - other.value_.map_->size() );
642 return (*value_.map_) < (*other.value_.map_);
646 return value_.array_->compare( *(other.value_.array_) ) < 0;
648 return value_.map_->compare( *(other.value_.map_) ) < 0;
651 JSON_ASSERT_UNREACHABLE;
657 Value::operator <=(
const Value &other )
const
659 return !(other > *
this);
663 Value::operator >=(
const Value &other )
const
665 return !(*
this < other);
669 Value::operator >(
const Value &other )
const
671 return other < *
this;
675 Value::operator ==(
const Value &other )
const
681 int temp = other.type_;
689 return value_.int_ == other.value_.int_;
691 return value_.uint_ == other.value_.uint_;
693 return value_.real_ == other.value_.real_;
695 return value_.bool_ == other.value_.bool_;
697 return ( value_.string_ == other.value_.string_ )
698 || ( other.value_.string_
700 && strcmp( value_.string_, other.value_.string_ ) == 0 );
701 #ifndef JSON_VALUE_USE_INTERNAL_MAP
704 return value_.map_->size() == other.value_.map_->size()
705 && (*value_.map_) == (*other.value_.map_);
708 return value_.array_->compare( *(other.value_.array_) ) == 0;
710 return value_.map_->compare( *(other.value_.map_) ) == 0;
713 JSON_ASSERT_UNREACHABLE;
719 Value::operator !=(
const Value &other )
const
721 return !( *
this == other );
725 Value::asCString()
const
728 return value_.string_;
743 return value_.string_ ? value_.string_ :
"";
745 return value_.bool_ ?
"true" :
"false";
747 if(!value_as_string_)
750 sprintf(buf,
"%d", value_.int_);
751 value_as_string_ = valueAllocator()->duplicateStringValue( buf );
753 return value_as_string_;
755 if(!value_as_string_)
758 sprintf(buf,
"%d", value_.uint_);
759 value_as_string_ = valueAllocator()->duplicateStringValue( buf );
761 return value_as_string_;
763 if(!value_as_string_)
766 sprintf(buf,
"%f", value_.real_);
767 value_as_string_ = valueAllocator()->duplicateStringValue( buf );
769 return value_as_string_;
772 JSON_ASSERT_MESSAGE(
false,
"Type is not convertible to string" );
774 JSON_ASSERT_UNREACHABLE;
779 # ifdef JSON_USE_CPPTL
781 Value::asConstString()
const
783 return CppTL::ConstString(
asString().c_str() );
797 JSON_ASSERT_MESSAGE( value_.uint_ < (
unsigned)maxInt,
"integer out of signed integer range" );
800 JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt,
"Real out of signed integer range" );
801 return Int( value_.real_ );
803 return value_.bool_ ? 1 : 0;
807 JSON_ASSERT_MESSAGE(
false,
"Type is not convertible to int" );
809 JSON_ASSERT_UNREACHABLE;
815 Value::asUInt()
const
822 JSON_ASSERT_MESSAGE( value_.int_ >= 0,
"Negative integer can not be converted to unsigned integer" );
827 JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt,
"Real out of unsigned integer range" );
828 return UInt( value_.real_ );
830 return value_.bool_ ? 1 : 0;
834 JSON_ASSERT_MESSAGE(
false,
"Type is not convertible to uint" );
836 JSON_ASSERT_UNREACHABLE;
842 Value::asDouble()
const
855 return value_.bool_ ? 1.0 : 0.0;
859 JSON_ASSERT_MESSAGE(
false,
"Type is not convertible to double" );
861 JSON_ASSERT_UNREACHABLE;
867 Value::asBool()
const
875 return value_.int_ != 0;
877 return value_.real_ != 0.0;
881 return value_.string_ && value_.string_[0] != 0;
884 return value_.map_->size() != 0;
886 JSON_ASSERT_UNREACHABLE;
893 Value::isConvertibleTo(
ValueType other )
const
900 return ( other ==
nullValue && value_.int_ == 0 )
902 || ( other ==
uintValue && value_.int_ >= 0 )
907 return ( other ==
nullValue && value_.uint_ == 0 )
908 || ( other ==
intValue && value_.uint_ <= (unsigned)maxInt )
914 return ( other ==
nullValue && value_.real_ == 0.0 )
915 || ( other ==
intValue && value_.real_ >= minInt && value_.real_ <= maxInt )
916 || ( other ==
uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt )
921 return ( other ==
nullValue && value_.bool_ ==
false )
929 || ( other ==
nullValue && (!value_.string_ || value_.string_[0] == 0) );
932 || ( other ==
nullValue && value_.map_->size() == 0 );
935 || ( other ==
nullValue && value_.map_->size() == 0 );
937 JSON_ASSERT_UNREACHABLE;
956 #ifndef JSON_VALUE_USE_INTERNAL_MAP
958 if ( !value_.map_->empty() )
960 ObjectValues::const_iterator itLast = value_.map_->end();
962 return (*itLast).first.index()+1;
966 return Int( value_.map_->size() );
969 return Int( value_.array_->size() );
971 return Int( value_.map_->size() );
974 JSON_ASSERT_UNREACHABLE;
983 if ( isNull() || isArray() || isObject() )
1004 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1007 value_.map_->clear();
1011 value_.array_->clear();
1014 value_.map_->clear();
1028 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1029 UInt oldSize =
size();
1032 else if ( newSize > oldSize )
1033 (*this)[ newSize - 1 ];
1036 for ( UInt index = newSize; index < oldSize; ++index )
1037 value_.map_->erase( index );
1038 assert(
size() == newSize );
1041 value_.array_->resize( newSize );
1052 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1054 ObjectValues::iterator it = value_.map_->lower_bound( key );
1055 if ( it != value_.map_->end() && (*it).first == key )
1056 return (*it).second;
1058 ObjectValues::value_type defaultValue( key, null );
1059 it = value_.map_->insert( it, defaultValue );
1060 return (*it).second;
1062 return value_.array_->resolveReference( index );
1073 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1075 ObjectValues::const_iterator it = value_.map_->find( key );
1076 if ( it == value_.map_->end() )
1078 return (*it).second;
1080 Value *value = value_.array_->find( index );
1081 return value ? *value : null;
1089 return resolveReference( key,
false );
1094 Value::resolveReference(
const char *key,
1100 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1101 CZString actualKey( key, isStatic ? CZString::noDuplication
1102 : CZString::duplicateOnCopy );
1103 ObjectValues::iterator it = value_.map_->lower_bound( actualKey );
1104 if ( it != value_.map_->end() && (*it).first == actualKey )
1105 return (*it).second;
1107 ObjectValues::value_type defaultValue( actualKey, null );
1108 it = value_.map_->insert( it, defaultValue );
1109 Value &value = (*it).second;
1112 return value_.map_->resolveReference( key, isStatic );
1119 const Value &defaultValue )
const
1121 const Value *value = &((*this)[index]);
1122 return value == &null ? defaultValue : *value;
1129 return index <
size();
1140 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1141 CZString actualKey( key, CZString::noDuplication );
1142 ObjectValues::const_iterator it = value_.map_->find( actualKey );
1143 if ( it == value_.map_->end() )
1145 return (*it).second;
1147 const Value *value = value_.map_->find( key );
1148 return value ? *value : null;
1156 return (*
this)[ key.c_str() ];
1163 return (*
this)[ key.c_str() ];
1169 return resolveReference( key,
true );
1173 # ifdef JSON_USE_CPPTL
1177 return (*
this)[ key.c_str() ];
1184 return (*
this)[ key.c_str() ];
1192 return (*
this)[
size()] = value;
1198 const Value &defaultValue )
const
1200 const Value *value = &((*this)[key]);
1201 return value == &null ? defaultValue : *value;
1207 const Value &defaultValue )
const
1209 return get( key.c_str(), defaultValue );
1218 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1219 CZString actualKey( key, CZString::noDuplication );
1220 ObjectValues::iterator it = value_.map_->find( actualKey );
1221 if ( it == value_.map_->end() )
1223 Value old(it->second);
1224 value_.map_->erase(it);
1227 Value *value = value_.map_->find( key );
1230 value_.map_.remove( key );
1244 # ifdef JSON_USE_CPPTL
1247 const Value &defaultValue )
const
1249 return get( key.c_str(), defaultValue );
1256 const Value *value = &((*this)[key]);
1257 return value != &null;
1268 # ifdef JSON_USE_CPPTL
1281 return Value::Members();
1283 members.reserve( value_.map_->size() );
1284 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1285 ObjectValues::const_iterator it = value_.map_->begin();
1286 ObjectValues::const_iterator itEnd = value_.map_->end();
1287 for ( ; it != itEnd; ++it )
1288 members.push_back( std::string( (*it).first.c_str() ) );
1290 ValueInternalMap::IteratorState it;
1291 ValueInternalMap::IteratorState itEnd;
1292 value_.map_->makeBeginIterator( it );
1293 value_.map_->makeEndIterator( itEnd );
1294 for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) )
1295 members.push_back( std::string( ValueInternalMap::key( it ) ) );
1327 Value::isNull()
const
1334 Value::isBool()
const
1341 Value::isInt()
const
1348 Value::isUInt()
const
1355 Value::isIntegral()
const
1364 Value::isDouble()
const
1371 Value::isNumeric()
const
1373 return isIntegral() || isDouble();
1378 Value::isString()
const
1385 Value::isArray()
const
1392 Value::isObject()
const
1403 comments_ =
new CommentInfo[numberOfCommentPlacement];
1404 comments_[placement].setComment( comment );
1419 return comments_ != 0 && comments_[placement].comment_ != 0;
1425 if ( hasComment(placement) )
1426 return comments_[placement].comment_;
1432 Value::toStyledString()
const
1435 return writer.
write( *
this );
1439 Value::const_iterator
1440 Value::begin()
const
1444 #ifdef JSON_VALUE_USE_INTERNAL_MAP
1446 if ( value_.array_ )
1448 ValueInternalArray::IteratorState it;
1449 value_.array_->makeBeginIterator( it );
1450 return const_iterator( it );
1456 ValueInternalMap::IteratorState it;
1457 value_.map_->makeBeginIterator( it );
1458 return const_iterator( it );
1465 return const_iterator( value_.map_->begin() );
1471 return const_iterator();
1474 Value::const_iterator
1479 #ifdef JSON_VALUE_USE_INTERNAL_MAP
1481 if ( value_.array_ )
1483 ValueInternalArray::IteratorState it;
1484 value_.array_->makeEndIterator( it );
1485 return const_iterator( it );
1491 ValueInternalMap::IteratorState it;
1492 value_.map_->makeEndIterator( it );
1493 return const_iterator( it );
1500 return const_iterator( value_.map_->end() );
1506 return const_iterator();
1515 #ifdef JSON_VALUE_USE_INTERNAL_MAP
1517 if ( value_.array_ )
1519 ValueInternalArray::IteratorState it;
1520 value_.array_->makeBeginIterator( it );
1521 return iterator( it );
1527 ValueInternalMap::IteratorState it;
1528 value_.map_->makeBeginIterator( it );
1529 return iterator( it );
1536 return iterator( value_.map_->begin() );
1550 #ifdef JSON_VALUE_USE_INTERNAL_MAP
1552 if ( value_.array_ )
1554 ValueInternalArray::IteratorState it;
1555 value_.array_->makeEndIterator( it );
1556 return iterator( it );
1562 ValueInternalMap::IteratorState it;
1563 value_.map_->makeEndIterator( it );
1564 return iterator( it );
1571 return iterator( value_.map_->end() );
1584 PathArgument::PathArgument()
1590 PathArgument::PathArgument( Value::UInt index )
1592 , kind_( kindIndex )
1597 PathArgument::PathArgument(
const char *key )
1604 PathArgument::PathArgument(
const std::string &key )
1605 : key_( key.c_str() )
1613 Path::Path(
const std::string &path,
1614 const PathArgument &a1,
1615 const PathArgument &a2,
1616 const PathArgument &a3,
1617 const PathArgument &a4,
1618 const PathArgument &a5 )
1621 in.push_back( &a1 );
1622 in.push_back( &a2 );
1623 in.push_back( &a3 );
1624 in.push_back( &a4 );
1625 in.push_back( &a5 );
1626 makePath( path, in );
1631 Path::makePath(
const std::string &path,
1634 const char *current = path.c_str();
1635 const char *end = current + path.length();
1636 InArgs::const_iterator itInArg = in.begin();
1637 while ( current != end )
1639 if ( *current ==
'[' )
1642 if ( *current ==
'%' )
1643 addPathInArg( path, in, itInArg, PathArgument::kindIndex );
1646 Value::UInt index = 0;
1647 for ( ; current != end && *current >=
'0' && *current <=
'9'; ++current )
1648 index = index * 10 + Value::UInt(*current -
'0');
1649 args_.push_back( index );
1651 if ( current == end || *current++ !=
']' )
1652 invalidPath( path,
int(current - path.c_str()) );
1654 else if ( *current ==
'%' )
1656 addPathInArg( path, in, itInArg, PathArgument::kindKey );
1659 else if ( *current ==
'.' )
1665 const char *beginName = current;
1666 while ( current != end && !strchr(
"[.", *current ) )
1668 args_.push_back( std::string( beginName, current ) );
1675 Path::addPathInArg(
const std::string &,
1677 InArgs::const_iterator &itInArg,
1678 PathArgument::Kind kind )
1680 if ( itInArg == in.end() )
1684 else if ( (*itInArg)->kind_ != kind )
1690 args_.push_back( **itInArg );
1696 Path::invalidPath(
const std::string &,
1704 Path::resolve(
const Value &root )
const
1706 const Value *node = &root;
1707 for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
1709 const PathArgument &arg = *it;
1710 if ( arg.kind_ == PathArgument::kindIndex )
1712 if ( !node->isArray() || node->isValidIndex( arg.index_ ) )
1716 node = &((*node)[arg.index_]);
1718 else if ( arg.kind_ == PathArgument::kindKey )
1720 if ( !node->isObject() )
1724 node = &((*node)[arg.key_]);
1725 if ( node == &Value::null )
1736 Path::resolve(
const Value &root,
1737 const Value &defaultValue )
const
1739 const Value *node = &root;
1740 for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
1742 const PathArgument &arg = *it;
1743 if ( arg.kind_ == PathArgument::kindIndex )
1745 if ( !node->isArray() || node->isValidIndex( arg.index_ ) )
1746 return defaultValue;
1747 node = &((*node)[arg.index_]);
1749 else if ( arg.kind_ == PathArgument::kindKey )
1751 if ( !node->isObject() )
1752 return defaultValue;
1753 node = &((*node)[arg.key_]);
1754 if ( node == &Value::null )
1755 return defaultValue;
1765 Value *node = &root;
1766 for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
1769 if ( arg.kind_ == PathArgument::kindIndex )
1771 if ( !node->isArray() )
1775 node = &((*node)[arg.index_]);
1777 else if ( arg.kind_ == PathArgument::kindKey )
1779 if ( !node->isObject() )
1783 node = &((*node)[arg.key_]);
Value & operator[](UInt index)
Value get(UInt index, const Value &defaultValue) const
Value(ValueType type=nullValue)
Create a default Value of the given type.
Value removeMember(const char *key)
Remove and return the named member.
Experimental and untested: represents an element of the "path" to access a node.
virtual std::string write(const Value &root)
Serialize a Value in JSON format.
Lightweight wrapper to tag static string.
void setComment(const char *comment, CommentPlacement placement)
Comments must be //... or /* ... */.
bool isMember(const char *key) const
Return true if the object has a member named key.
object value (collection of name/value pairs).
ValueType
Type of the value held by a Value object.
JSON (JavaScript Object Notation).
bool empty() const
Return true if empty array, empty object, or null; otherwise, false.
bool operator!() const
Return isNull()
bool isValidIndex(UInt index) const
Return true if index < size().
std::string getComment(CommentPlacement placement) const
Include delimiters and embedded newlines.
Value & make(Value &root) const
Creates the "path" to access the specified node and returns a reference on the node.
Experimental do not use: Allocator to customize member name and string value memory management done b...
Members getMemberNames() const
Return a list of the member names.
Writes a Value in JSON format in a human friendly way.
Value & append(const Value &value)
Append value to array at the end.
UInt size() const
Number of values in array or object.
array value (ordered list)