JsonCpp project page JsonCpp home page

value.h
Go to the documentation of this file.
1 // Copyright 2007-2010 Baptiste Lepilleur
2 // Distributed under MIT license, or public domain if desired and
3 // recognized in your jurisdiction.
4 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5 
6 #ifndef CPPTL_JSON_H_INCLUDED
7 # define CPPTL_JSON_H_INCLUDED
8 
9 #if !defined(JSON_IS_AMALGAMATION)
10 # include "forwards.h"
11 #endif // if !defined(JSON_IS_AMALGAMATION)
12 # include <string>
13 # include <vector>
14 
15 # ifndef JSON_USE_CPPTL_SMALLMAP
16 # include <map>
17 # else
18 # include <cpptl/smallmap.h>
19 # endif
20 # ifdef JSON_USE_CPPTL
21 # include <cpptl/forwards.h>
22 # endif
23 
26 namespace Json {
27 
30  enum ValueType
31  {
32  nullValue = 0,
40  };
41 
43  {
48  };
49 
50 //# ifdef JSON_USE_CPPTL
51 // typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
52 // typedef CppTL::AnyEnumerator<const Value &> EnumValues;
53 //# endif
54 
70  {
71  public:
72  explicit StaticString( const char *czstring )
73  : str_( czstring )
74  {
75  }
76 
77  operator const char *() const
78  {
79  return str_;
80  }
81 
82  const char *c_str() const
83  {
84  return str_;
85  }
86 
87  private:
88  const char *str_;
89  };
90 
119  {
120  friend class ValueIteratorBase;
121 # ifdef JSON_VALUE_USE_INTERNAL_MAP
122  friend class ValueInternalLink;
123  friend class ValueInternalMap;
124 # endif
125  public:
126  typedef std::vector<std::string> Members;
129  typedef Json::UInt UInt;
130  typedef Json::Int Int;
131 # if defined(JSON_HAS_INT64)
134 #endif // defined(JSON_HAS_INT64)
138 
139  static const Value null;
141  static const LargestInt minLargestInt;
143  static const LargestInt maxLargestInt;
145  static const LargestUInt maxLargestUInt;
146 
148  static const Int minInt;
150  static const Int maxInt;
152  static const UInt maxUInt;
153 
155  static const Int64 minInt64;
157  static const Int64 maxInt64;
159  static const UInt64 maxUInt64;
160 
161  private:
162 #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
163 # ifndef JSON_VALUE_USE_INTERNAL_MAP
164  class CZString
165  {
166  public:
167  enum DuplicationPolicy
168  {
169  noDuplication = 0,
170  duplicate,
171  duplicateOnCopy
172  };
173  CZString( ArrayIndex index );
174  CZString( const char *cstr, DuplicationPolicy allocate );
175  CZString( const CZString &other );
176  ~CZString();
177  CZString &operator =( const CZString &other );
178  bool operator<( const CZString &other ) const;
179  bool operator==( const CZString &other ) const;
180  ArrayIndex index() const;
181  const char *c_str() const;
182  bool isStaticString() const;
183  private:
184  void swap( CZString &other );
185  const char *cstr_;
186  ArrayIndex index_;
187  };
188 
189  public:
190 # ifndef JSON_USE_CPPTL_SMALLMAP
191  typedef std::map<CZString, Value> ObjectValues;
192 # else
193  typedef CppTL::SmallMap<CZString, Value> ObjectValues;
194 # endif // ifndef JSON_USE_CPPTL_SMALLMAP
195 # endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
196 #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
197 
198  public:
214  Value( ValueType type = nullValue );
215  Value( Int value );
216  Value( UInt value );
217 #if defined(JSON_HAS_INT64)
218  Value( Int64 value );
219  Value( UInt64 value );
220 #endif // if defined(JSON_HAS_INT64)
221  Value( double value );
222  Value( const char *value );
223  Value( const char *beginValue, const char *endValue );
234  Value( const StaticString &value );
235  Value( const std::string &value );
236 # ifdef JSON_USE_CPPTL
237  Value( const CppTL::ConstString &value );
238 # endif
239  Value( bool value );
240  Value( const Value &other );
241  ~Value();
242 
243  Value &operator=( const Value &other );
247  void swap( Value &other );
248 
249  ValueType type() const;
250 
251  bool operator <( const Value &other ) const;
252  bool operator <=( const Value &other ) const;
253  bool operator >=( const Value &other ) const;
254  bool operator >( const Value &other ) const;
255 
256  bool operator ==( const Value &other ) const;
257  bool operator !=( const Value &other ) const;
258 
259  int compare( const Value &other ) const;
260 
261  const char *asCString() const;
262  std::string asString() const;
263 # ifdef JSON_USE_CPPTL
264  CppTL::ConstString asConstString() const;
265 # endif
266  Int asInt() const;
267  UInt asUInt() const;
268  Int64 asInt64() const;
269  UInt64 asUInt64() const;
270  LargestInt asLargestInt() const;
271  LargestUInt asLargestUInt() const;
272  float asFloat() const;
273  double asDouble() const;
274  bool asBool() const;
275 
276  bool isNull() const;
277  bool isBool() const;
278  bool isInt() const;
279  bool isUInt() const;
280  bool isIntegral() const;
281  bool isDouble() const;
282  bool isNumeric() const;
283  bool isString() const;
284  bool isArray() const;
285  bool isObject() const;
286 
287  bool isConvertibleTo( ValueType other ) const;
288 
290  ArrayIndex size() const;
291 
294  bool empty() const;
295 
297  bool operator!() const;
298 
302  void clear();
303 
309  void resize( ArrayIndex size );
310 
316  Value &operator[]( ArrayIndex index );
317 
323  Value &operator[]( int index );
324 
328  const Value &operator[]( ArrayIndex index ) const;
329 
333  const Value &operator[]( int index ) const;
334 
337  Value get( ArrayIndex index,
338  const Value &defaultValue ) const;
340  bool isValidIndex( ArrayIndex index ) const;
344  Value &append( const Value &value );
345 
347  Value &operator[]( const char *key );
349  const Value &operator[]( const char *key ) const;
351  Value &operator[]( const std::string &key );
353  const Value &operator[]( const std::string &key ) const;
365  Value &operator[]( const StaticString &key );
366 # ifdef JSON_USE_CPPTL
367  Value &operator[]( const CppTL::ConstString &key );
370  const Value &operator[]( const CppTL::ConstString &key ) const;
371 # endif
372  Value get( const char *key,
374  const Value &defaultValue ) const;
376  Value get( const std::string &key,
377  const Value &defaultValue ) const;
378 # ifdef JSON_USE_CPPTL
379  Value get( const CppTL::ConstString &key,
381  const Value &defaultValue ) const;
382 # endif
383  Value removeMember( const char* key );
391  Value removeMember( const std::string &key );
392 
394  bool isMember( const char *key ) const;
396  bool isMember( const std::string &key ) const;
397 # ifdef JSON_USE_CPPTL
398  bool isMember( const CppTL::ConstString &key ) const;
400 # endif
401 
407  Members getMemberNames() const;
408 
409 //# ifdef JSON_USE_CPPTL
410 // EnumMemberNames enumMemberNames() const;
411 // EnumValues enumValues() const;
412 //# endif
413 
415  void setComment( const char *comment,
416  CommentPlacement placement );
418  void setComment( const std::string &comment,
419  CommentPlacement placement );
420  bool hasComment( CommentPlacement placement ) const;
422  std::string getComment( CommentPlacement placement ) const;
423 
424  std::string toStyledString() const;
425 
426  const_iterator begin() const;
427  const_iterator end() const;
428 
429  iterator begin();
430  iterator end();
431 
432  private:
433  Value &resolveReference( const char *key,
434  bool isStatic );
435 
436 # ifdef JSON_VALUE_USE_INTERNAL_MAP
437  inline bool isItemAvailable() const
438  {
439  return itemIsUsed_ == 0;
440  }
441 
442  inline void setItemUsed( bool isUsed = true )
443  {
444  itemIsUsed_ = isUsed ? 1 : 0;
445  }
446 
447  inline bool isMemberNameStatic() const
448  {
449  return memberNameIsStatic_ == 0;
450  }
451 
452  inline void setMemberNameIsStatic( bool isStatic )
453  {
454  memberNameIsStatic_ = isStatic ? 1 : 0;
455  }
456 # endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP
457 
458  private:
459  struct CommentInfo
460  {
461  CommentInfo();
462  ~CommentInfo();
463 
464  void setComment( const char *text );
465 
466  char *comment_;
467  };
468 
469  //struct MemberNamesTransform
470  //{
471  // typedef const char *result_type;
472  // const char *operator()( const CZString &name ) const
473  // {
474  // return name.c_str();
475  // }
476  //};
477 
478  union ValueHolder
479  {
480  LargestInt int_;
481  LargestUInt uint_;
482  double real_;
483  bool bool_;
484  char *string_;
485 # ifdef JSON_VALUE_USE_INTERNAL_MAP
486  ValueInternalArray *array_;
487  ValueInternalMap *map_;
488 #else
489  ObjectValues *map_;
490 # endif
491  } value_;
492  ValueType type_ : 8;
493  int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
494 # ifdef JSON_VALUE_USE_INTERNAL_MAP
495  unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
496  int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
497 # endif
498  CommentInfo *comments_;
499  };
500 
501 
505  {
506  public:
507  friend class Path;
508 
509  PathArgument();
510  PathArgument( ArrayIndex index );
511  PathArgument( const char *key );
512  PathArgument( const std::string &key );
513 
514  private:
515  enum Kind
516  {
517  kindNone = 0,
518  kindIndex,
519  kindKey
520  };
521  std::string key_;
522  ArrayIndex index_;
523  Kind kind_;
524  };
525 
537  class Path
538  {
539  public:
540  Path( const std::string &path,
541  const PathArgument &a1 = PathArgument(),
542  const PathArgument &a2 = PathArgument(),
543  const PathArgument &a3 = PathArgument(),
544  const PathArgument &a4 = PathArgument(),
545  const PathArgument &a5 = PathArgument() );
546 
547  const Value &resolve( const Value &root ) const;
548  Value resolve( const Value &root,
549  const Value &defaultValue ) const;
551  Value &make( Value &root ) const;
552 
553  private:
554  typedef std::vector<const PathArgument *> InArgs;
555  typedef std::vector<PathArgument> Args;
556 
557  void makePath( const std::string &path,
558  const InArgs &in );
559  void addPathInArg( const std::string &path,
560  const InArgs &in,
561  InArgs::const_iterator &itInArg,
562  PathArgument::Kind kind );
563  void invalidPath( const std::string &path,
564  int location );
565 
566  Args args_;
567  };
568 
569 
570 
571 #ifdef JSON_VALUE_USE_INTERNAL_MAP
572 
617  {
618  public:
619  virtual ~ValueMapAllocator();
620  virtual ValueInternalMap *newMap() = 0;
621  virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0;
622  virtual void destructMap( ValueInternalMap *map ) = 0;
623  virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0;
624  virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
625  virtual ValueInternalLink *allocateMapLink() = 0;
626  virtual void releaseMapLink( ValueInternalLink *link ) = 0;
627  };
628 
633  {
634  public:
635  enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
637  flagAvailable = 0,
638  flagUsed = 1
639  };
640 
642 
644 
645  Value items_[itemPerLink];
646  char *keys_[itemPerLink];
649  };
650 
651 
665  {
666  friend class ValueIteratorBase;
667  friend class Value;
668  public:
669  typedef unsigned int HashKey;
670  typedef unsigned int BucketIndex;
671 
672 # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
673  struct IteratorState
674  {
675  IteratorState()
676  : map_(0)
677  , link_(0)
678  , itemIndex_(0)
679  , bucketIndex_(0)
680  {
681  }
682  ValueInternalMap *map_;
683  ValueInternalLink *link_;
684  BucketIndex itemIndex_;
685  BucketIndex bucketIndex_;
686  };
687 # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
688 
690  ValueInternalMap( const ValueInternalMap &other );
691  ValueInternalMap &operator =( const ValueInternalMap &other );
692  ~ValueInternalMap();
693 
694  void swap( ValueInternalMap &other );
695 
696  BucketIndex size() const;
697 
698  void clear();
699 
700  bool reserveDelta( BucketIndex growth );
701 
702  bool reserve( BucketIndex newItemCount );
703 
704  const Value *find( const char *key ) const;
705 
706  Value *find( const char *key );
707 
708  Value &resolveReference( const char *key,
709  bool isStatic );
710 
711  void remove( const char *key );
712 
713  void doActualRemove( ValueInternalLink *link,
714  BucketIndex index,
715  BucketIndex bucketIndex );
716 
717  ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
718 
719  Value &setNewItem( const char *key,
720  bool isStatic,
721  ValueInternalLink *link,
722  BucketIndex index );
723 
724  Value &unsafeAdd( const char *key,
725  bool isStatic,
726  HashKey hashedKey );
727 
728  HashKey hash( const char *key ) const;
729 
730  int compare( const ValueInternalMap &other ) const;
731 
732  private:
733  void makeBeginIterator( IteratorState &it ) const;
734  void makeEndIterator( IteratorState &it ) const;
735  static bool equals( const IteratorState &x, const IteratorState &other );
736  static void increment( IteratorState &iterator );
737  static void incrementBucket( IteratorState &iterator );
738  static void decrement( IteratorState &iterator );
739  static const char *key( const IteratorState &iterator );
740  static const char *key( const IteratorState &iterator, bool &isStatic );
741  static Value &value( const IteratorState &iterator );
742  static int distance( const IteratorState &x, const IteratorState &y );
743 
744  private:
745  ValueInternalLink *buckets_;
746  ValueInternalLink *tailLink_;
747  BucketIndex bucketsSize_;
748  BucketIndex itemCount_;
749  };
750 
763  {
764  friend class Value;
765  friend class ValueIteratorBase;
766  public:
767  enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo.
769  typedef unsigned int PageIndex;
770 
771 # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
772  struct IteratorState // Must be a POD
773  {
774  IteratorState()
775  : array_(0)
776  , currentPageIndex_(0)
777  , currentItemIndex_(0)
778  {
779  }
780  ValueInternalArray *array_;
781  Value **currentPageIndex_;
782  unsigned int currentItemIndex_;
783  };
784 # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
785 
787  ValueInternalArray( const ValueInternalArray &other );
788  ValueInternalArray &operator =( const ValueInternalArray &other );
790  void swap( ValueInternalArray &other );
791 
792  void clear();
793  void resize( ArrayIndex newSize );
794 
795  Value &resolveReference( ArrayIndex index );
796 
797  Value *find( ArrayIndex index ) const;
798 
799  ArrayIndex size() const;
800 
801  int compare( const ValueInternalArray &other ) const;
802 
803  private:
804  static bool equals( const IteratorState &x, const IteratorState &other );
805  static void increment( IteratorState &iterator );
806  static void decrement( IteratorState &iterator );
807  static Value &dereference( const IteratorState &iterator );
808  static Value &unsafeDereference( const IteratorState &iterator );
809  static int distance( const IteratorState &x, const IteratorState &y );
810  static ArrayIndex indexOf( const IteratorState &iterator );
811  void makeBeginIterator( IteratorState &it ) const;
812  void makeEndIterator( IteratorState &it ) const;
813  void makeIterator( IteratorState &it, ArrayIndex index ) const;
814 
815  void makeIndexValid( ArrayIndex index );
816 
817  Value **pages_;
818  ArrayIndex size_;
819  PageIndex pageCount_;
820  };
821 
882  {
883  public:
884  virtual ~ValueArrayAllocator();
885  virtual ValueInternalArray *newArray() = 0;
886  virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0;
887  virtual void destructArray( ValueInternalArray *array ) = 0;
899  virtual void reallocateArrayPageIndex( Value **&indexes,
900  ValueInternalArray::PageIndex &indexCount,
901  ValueInternalArray::PageIndex minNewIndexCount ) = 0;
902  virtual void releaseArrayPageIndex( Value **indexes,
903  ValueInternalArray::PageIndex indexCount ) = 0;
904  virtual Value *allocateArrayPage() = 0;
905  virtual void releaseArrayPage( Value *value ) = 0;
906  };
907 #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
908 
909 
914  {
915  public:
916  typedef unsigned int size_t;
917  typedef int difference_type;
919 
921 #ifndef JSON_VALUE_USE_INTERNAL_MAP
922  explicit ValueIteratorBase( const Value::ObjectValues::iterator &current );
923 #else
924  ValueIteratorBase( const ValueInternalArray::IteratorState &state );
925  ValueIteratorBase( const ValueInternalMap::IteratorState &state );
926 #endif
927 
928  bool operator ==( const SelfType &other ) const
929  {
930  return isEqual( other );
931  }
932 
933  bool operator !=( const SelfType &other ) const
934  {
935  return !isEqual( other );
936  }
937 
938  difference_type operator -( const SelfType &other ) const
939  {
940  return computeDistance( other );
941  }
942 
944  Value key() const;
945 
947  UInt index() const;
948 
950  const char *memberName() const;
951 
952  protected:
953  Value &deref() const;
954 
955  void increment();
956 
957  void decrement();
958 
959  difference_type computeDistance( const SelfType &other ) const;
960 
961  bool isEqual( const SelfType &other ) const;
962 
963  void copy( const SelfType &other );
964 
965  private:
966 #ifndef JSON_VALUE_USE_INTERNAL_MAP
967  Value::ObjectValues::iterator current_;
968  // Indicates that iterator is for a null value.
969  bool isNull_;
970 #else
971  union
972  {
973  ValueInternalArray::IteratorState array_;
974  ValueInternalMap::IteratorState map_;
975  } iterator_;
976  bool isArray_;
977 #endif
978  };
979 
984  {
985  friend class Value;
986  public:
987  typedef unsigned int size_t;
988  typedef int difference_type;
989  typedef const Value &reference;
990  typedef const Value *pointer;
992 
994  private:
997 #ifndef JSON_VALUE_USE_INTERNAL_MAP
998  explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
999 #else
1000  ValueConstIterator( const ValueInternalArray::IteratorState &state );
1001  ValueConstIterator( const ValueInternalMap::IteratorState &state );
1002 #endif
1003  public:
1004  SelfType &operator =( const ValueIteratorBase &other );
1005 
1006  SelfType operator++( int )
1007  {
1008  SelfType temp( *this );
1009  ++*this;
1010  return temp;
1011  }
1012 
1013  SelfType operator--( int )
1014  {
1015  SelfType temp( *this );
1016  --*this;
1017  return temp;
1018  }
1019 
1020  SelfType &operator--()
1021  {
1022  decrement();
1023  return *this;
1024  }
1025 
1026  SelfType &operator++()
1027  {
1028  increment();
1029  return *this;
1030  }
1031 
1032  reference operator *() const
1033  {
1034  return deref();
1035  }
1036  };
1037 
1038 
1042  {
1043  friend class Value;
1044  public:
1045  typedef unsigned int size_t;
1046  typedef int difference_type;
1047  typedef Value &reference;
1048  typedef Value *pointer;
1050 
1051  ValueIterator();
1052  ValueIterator( const ValueConstIterator &other );
1053  ValueIterator( const ValueIterator &other );
1054  private:
1057 #ifndef JSON_VALUE_USE_INTERNAL_MAP
1058  explicit ValueIterator( const Value::ObjectValues::iterator &current );
1059 #else
1060  ValueIterator( const ValueInternalArray::IteratorState &state );
1061  ValueIterator( const ValueInternalMap::IteratorState &state );
1062 #endif
1063  public:
1064 
1065  SelfType &operator =( const SelfType &other );
1066 
1067  SelfType operator++( int )
1068  {
1069  SelfType temp( *this );
1070  ++*this;
1071  return temp;
1072  }
1073 
1074  SelfType operator--( int )
1075  {
1076  SelfType temp( *this );
1077  --*this;
1078  return temp;
1079  }
1080 
1081  SelfType &operator--()
1082  {
1083  decrement();
1084  return *this;
1085  }
1086 
1087  SelfType &operator++()
1088  {
1089  increment();
1090  return *this;
1091  }
1092 
1093  reference operator *() const
1094  {
1095  return deref();
1096  }
1097  };
1098 
1099 
1100 } // namespace Json
1101 
1102 
1103 #endif // CPPTL_JSON_H_INCLUDED
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())
Int64 LargestInt
Definition: config.h:89
Experimental: do not use.
Definition: value.h:881
Value & make(Value &root) const
Creates the "path" to access the specified node and returns a reference on the node.
#define JSON_API
If defined, indicates that the source file is amalgated to prevent private header inclusion...
Definition: config.h:51
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
Definition: value.h:157
unsigned int ArrayIndex
Definition: forwards.h:23
reference operator*() const
Definition: value.h:1032
std::vector< std::string > Members
Definition: value.h:126
unsigned int HashKey
Definition: value.h:669
base class for Value iterators.
Definition: value.h:913
array value (ordered list)
Definition: value.h:38
unsigned __int64 UInt64
Definition: config.h:84
unsigned integer value
Definition: value.h:34
unsigned int PageIndex
Definition: value.h:769
Json::ArrayIndex ArrayIndex
Definition: value.h:137
object value (collection of name/value pairs).
Definition: value.h:39
Value::ArrayIndex ArrayIndex
Definition: value.h:768
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value.
Definition: value.h:150
Lightweight wrapper to tag static string.
Definition: value.h:69
ValueInternalMap::IteratorState map_
Definition: value.h:974
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
Definition: value.h:152
bool isEqual(const SelfType &other) const
Json::LargestUInt LargestUInt
Definition: value.h:136
difference_type computeDistance(const SelfType &other) const
void copy(const SelfType &other)
bool operator!=(const SelfType &other) const
Definition: value.h:933
const iterator for object and array value.
Definition: value.h:983
unsigned int size_t
Definition: value.h:1045
Experimental and untested: represents an element of the "path" to access a node.
Definition: value.h:504
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value.
Definition: value.h:141
SelfType & operator--()
Definition: value.h:1020
'null' value
Definition: value.h:32
CommentPlacement
Definition: value.h:42
SelfType & operator--()
Definition: value.h:1081
StaticString(const char *czstring)
Definition: value.h:72
ValueConstIterator SelfType
Definition: value.h:991
UInt64 LargestUInt
Definition: config.h:90
static const Value null
Definition: value.h:139
ValueConstIterator const_iterator
Definition: value.h:128
Allocator to customize Value internal map.
Definition: value.h:616
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: json_reader.cpp:55
SelfType & operator=(const SelfType &other)
JSON (JavaScript Object Notation).
Definition: config.h:73
ValueIteratorBase SelfType
Definition: value.h:918
Json::Int64 Int64
Definition: value.h:133
ValueIterator SelfType
Definition: value.h:1049
Experimental and untested: represents a "path" to access a node.
Definition: value.h:537
SelfType operator--(int)
Definition: value.h:1013
Json::LargestInt LargestInt
Definition: value.h:135
const char * c_str() const
Definition: value.h:82
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
Definition: value.h:159
double value
Definition: value.h:35
unsigned int BucketIndex
Definition: value.h:670
A simplified deque implementation used internally by Value.
Definition: value.h:762
SelfType operator--(int)
Definition: value.h:1074
Json::UInt UInt
Definition: value.h:129
SelfType & operator=(const ValueIteratorBase &other)
const Value & resolve(const Value &root) const
SelfType & operator++()
Definition: value.h:1087
Json::UInt64 UInt64
Definition: value.h:132
Json::Int Int
Definition: value.h:130
Value * pointer
Definition: value.h:1048
Represents a JSON value.
Definition: value.h:118
UInt index() const
Return the index of the referenced Value. -1 if it is not an arrayValue.
ValueIterator iterator
Definition: value.h:127
const Value * pointer
Definition: value.h:990
difference_type operator-(const SelfType &other) const
Definition: value.h:938
static const Int64 minInt64
Minimum signed 64 bits int value that can be stored in a Json::Value.
Definition: value.h:155
static const Int minInt
Minimum signed int value that can be stored in a Json::Value.
Definition: value.h:148
reference operator*() const
Definition: value.h:1093
const Value & reference
Definition: value.h:989
a comment on the line after a value (only make sense for root value)
Definition: value.h:46
unsigned int UInt
Definition: config.h:75
Value key() const
Return either the index or the member name of the referenced value as a Value.
Iterator for object and array value.
Definition: value.h:1041
SelfType & operator++()
Definition: value.h:1026
A linked page based hash-table implementation used internally by Value.
Definition: value.h:664
__int64 Int64
Definition: config.h:83
SelfType operator++(int)
Definition: value.h:1006
ValueType
Type of the value held by a Value object.
Definition: value.h:30
bool value
Definition: value.h:37
signed integer value
Definition: value.h:33
SelfType operator++(int)
Definition: value.h:1067
unsigned int size_t
Definition: value.h:916
int Int
Definition: config.h:74
a comment placed on the line before a value
Definition: value.h:44
UTF-8 string value.
Definition: value.h:36
ValueInternalArray::IteratorState array_
Definition: value.h:973
a comment just after a value on the same line
Definition: value.h:45
unsigned int size_t
Definition: value.h:987
const char * memberName() const
Return the member name of the referenced Value. "" if it is not an objectValue.
bool operator==(const SelfType &other) const
Definition: value.h:928
Value & reference
Definition: value.h:1047
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value.
Definition: value.h:143
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value.
Definition: value.h:145

SourceForge Logo hosts this site. Send comments to:
Json-cpp Developers