JsonCpp project page Classes Namespace JsonCpp home page

value.h
Go to the documentation of this file.
1 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
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 
13 // Conditional NORETURN attribute on the throw functions would:
14 // a) suppress false positives from static code analysis
15 // b) possibly improve optimization opportunities.
16 #if !defined(JSONCPP_NORETURN)
17 #if defined(_MSC_VER) && _MSC_VER == 1800
18 #define JSONCPP_NORETURN __declspec(noreturn)
19 #else
20 #define JSONCPP_NORETURN [[noreturn]]
21 #endif
22 #endif
23 
24 #include <array>
25 #include <exception>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 #ifndef JSON_USE_CPPTL_SMALLMAP
31 #include <map>
32 #else
33 #include <cpptl/smallmap.h>
34 #endif
35 #ifdef JSON_USE_CPPTL
36 #include <cpptl/forwards.h>
37 #endif
38 
39 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
40 // be used by...
41 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
42 #pragma warning(push)
43 #pragma warning(disable : 4251)
44 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
45 
46 #pragma pack(push, 8)
47 
50 namespace Json {
51 
52 #if JSON_USE_EXCEPTION
53 
57 class JSON_API Exception : public std::exception {
58 public:
59  Exception(String msg);
60  ~Exception() JSONCPP_NOEXCEPT override;
61  char const* what() const JSONCPP_NOEXCEPT override;
62 
63 protected:
65 };
66 
74 public:
75  RuntimeError(String const& msg);
76 };
77 
84 class JSON_API LogicError : public Exception {
85 public:
86  LogicError(String const& msg);
87 };
88 #endif
89 
91 JSONCPP_NORETURN void throwRuntimeError(String const& msg);
93 JSONCPP_NORETURN void throwLogicError(String const& msg);
94 
97 enum ValueType {
98  nullValue = 0,
106 };
107 
114 };
115 
121 };
122 
123 //# ifdef JSON_USE_CPPTL
124 // typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
125 // typedef CppTL::AnyEnumerator<const Value &> EnumValues;
126 //# endif
127 
143 public:
144  explicit StaticString(const char* czstring) : c_str_(czstring) {}
145 
146  operator const char*() const { return c_str_; }
147 
148  const char* c_str() const { return c_str_; }
149 
150 private:
151  const char* c_str_;
152 };
153 
189  friend class ValueIteratorBase;
190 
191 public:
192  typedef std::vector<String> Members;
195  typedef Json::UInt UInt;
196  typedef Json::Int Int;
197 #if defined(JSON_HAS_INT64)
200 #endif // defined(JSON_HAS_INT64)
204 
205  // Required for boost integration, e. g. BOOST_TEST
206  typedef std::string value_type;
207 
208 #if JSON_USE_NULLREF
209  // Binary compatibility kludges, do not use.
210  static const Value& null;
211  static const Value& nullRef;
212 #endif
213 
214  // null and nullRef are deprecated, use this instead.
215  static Value const& nullSingleton();
216 
218  static constexpr LargestInt minLargestInt =
219  LargestInt(~(LargestUInt(-1) / 2));
221  static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(-1) / 2);
223  static constexpr LargestUInt maxLargestUInt = LargestUInt(-1);
224 
226  static constexpr Int minInt = Int(~(UInt(-1) / 2));
228  static constexpr Int maxInt = Int(UInt(-1) / 2);
230  static constexpr UInt maxUInt = UInt(-1);
231 
232 #if defined(JSON_HAS_INT64)
233  static constexpr Int64 minInt64 = Int64(~(UInt64(-1) / 2));
236  static constexpr Int64 maxInt64 = Int64(UInt64(-1) / 2);
238  static constexpr UInt64 maxUInt64 = UInt64(-1);
239 #endif // defined(JSON_HAS_INT64)
240  static constexpr UInt defaultRealPrecision = 17;
242  // The constant is hard-coded because some compiler have trouble
243  // converting Value::maxUInt64 to a double correctly (AIX/xlC).
244  // Assumes that UInt64 is a 64 bits integer.
245  static constexpr double maxUInt64AsDouble = 18446744073709551615.0;
246 // Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler
247 // when using gcc and clang backend compilers. CZString
248 // cannot be defined as private. See issue #486
249 #ifdef __NVCC__
250 public:
251 #else
252 private:
253 #endif
254 #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
255  class CZString {
256  public:
257  enum DuplicationPolicy { noDuplication = 0, duplicate, duplicateOnCopy };
258  CZString(ArrayIndex index);
259  CZString(char const* str, unsigned length, DuplicationPolicy allocate);
260  CZString(CZString const& other);
261  CZString(CZString&& other);
262  ~CZString();
263  CZString& operator=(const CZString& other);
264  CZString& operator=(CZString&& other);
265 
266  bool operator<(CZString const& other) const;
267  bool operator==(CZString const& other) const;
268  ArrayIndex index() const;
269  // const char* c_str() const; ///< \deprecated
270  char const* data() const;
271  unsigned length() const;
272  bool isStaticString() const;
273 
274  private:
275  void swap(CZString& other);
276 
277  struct StringStorage {
278  unsigned policy_ : 2;
279  unsigned length_ : 30; // 1GB max
280  };
281 
282  char const* cstr_; // actually, a prefixed string, unless policy is noDup
283  union {
284  ArrayIndex index_;
285  StringStorage storage_;
286  };
287  };
288 
289 public:
290 #ifndef JSON_USE_CPPTL_SMALLMAP
291  typedef std::map<CZString, Value> ObjectValues;
292 #else
293  typedef CppTL::SmallMap<CZString, Value> ObjectValues;
294 #endif // ifndef JSON_USE_CPPTL_SMALLMAP
295 #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
296 
297 public:
314  Value(ValueType type = nullValue);
315  Value(Int value);
316  Value(UInt value);
317 #if defined(JSON_HAS_INT64)
318  Value(Int64 value);
319  Value(UInt64 value);
320 #endif // if defined(JSON_HAS_INT64)
321  Value(double value);
322  Value(const char* value);
323  Value(const char* begin, const char* end);
324 
341  Value(const StaticString& value);
342  Value(const String& value);
343 #ifdef JSON_USE_CPPTL
344  Value(const CppTL::ConstString& value);
345 #endif
346  Value(bool value);
347  Value(const Value& other);
348  Value(Value&& other);
349  ~Value();
350 
353  Value& operator=(const Value& other);
354  Value& operator=(Value&& other);
355 
357  void swap(Value& other);
359  void swapPayload(Value& other);
360 
362  void copy(const Value& other);
364  void copyPayload(const Value& other);
365 
366  ValueType type() const;
367 
369  bool operator<(const Value& other) const;
370  bool operator<=(const Value& other) const;
371  bool operator>=(const Value& other) const;
372  bool operator>(const Value& other) const;
373  bool operator==(const Value& other) const;
374  bool operator!=(const Value& other) const;
375  int compare(const Value& other) const;
376 
377  const char* asCString() const;
378 #if JSONCPP_USING_SECURE_MEMORY
379  unsigned getCStringLength() const; // Allows you to understand the length of
380  // the CString
381 #endif
382  String asString() const;
383 
386  bool getString(char const** begin, char const** end) const;
387 #ifdef JSON_USE_CPPTL
388  CppTL::ConstString asConstString() const;
389 #endif
390  Int asInt() const;
391  UInt asUInt() const;
392 #if defined(JSON_HAS_INT64)
393  Int64 asInt64() const;
394  UInt64 asUInt64() const;
395 #endif // if defined(JSON_HAS_INT64)
396  LargestInt asLargestInt() const;
397  LargestUInt asLargestUInt() const;
398  float asFloat() const;
399  double asDouble() const;
400  bool asBool() const;
401 
402  bool isNull() const;
403  bool isBool() const;
404  bool isInt() const;
405  bool isInt64() const;
406  bool isUInt() const;
407  bool isUInt64() const;
408  bool isIntegral() const;
409  bool isDouble() const;
410  bool isNumeric() const;
411  bool isString() const;
412  bool isArray() const;
413  bool isObject() const;
414 
416  template <typename T> T as() const = delete;
417  template <typename T> bool is() const = delete;
418 
419  bool isConvertibleTo(ValueType other) const;
420 
422  ArrayIndex size() const;
423 
426  bool empty() const;
427 
429  JSONCPP_OP_EXPLICIT operator bool() const;
430 
434  void clear();
435 
441  void resize(ArrayIndex newSize);
442 
444  Value& operator[](ArrayIndex index);
450  Value& operator[](int index);
452 
454  const Value& operator[](ArrayIndex index) const;
458  const Value& operator[](int index) const;
460 
463  Value get(ArrayIndex index, const Value& defaultValue) const;
465  bool isValidIndex(ArrayIndex index) const;
469  Value& append(const Value& value);
470  Value& append(Value&& value);
472  bool insert(ArrayIndex index, Value newValue);
473 
477  Value& operator[](const char* key);
480  const Value& operator[](const char* key) const;
483  Value& operator[](const String& key);
487  const Value& operator[](const String& key) const;
500  Value& operator[](const StaticString& key);
501 #ifdef JSON_USE_CPPTL
502  Value& operator[](const CppTL::ConstString& key);
506  const Value& operator[](const CppTL::ConstString& key) const;
507 #endif
508  Value get(const char* key, const Value& defaultValue) const;
514  Value get(const char* begin, const char* end,
515  const Value& defaultValue) const;
519  Value get(const String& key, const Value& defaultValue) const;
520 #ifdef JSON_USE_CPPTL
521  Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
524 #endif
525  Value const* find(char const* begin, char const* end) const;
532  Value* demand(char const* begin, char const* end);
538  void removeMember(const char* key);
541  void removeMember(const String& key);
544  bool removeMember(const char* key, Value* removed);
551  bool removeMember(String const& key, Value* removed);
553  bool removeMember(const char* begin, const char* end, Value* removed);
560  bool removeIndex(ArrayIndex index, Value* removed);
561 
564  bool isMember(const char* key) const;
567  bool isMember(const String& key) const;
569  bool isMember(const char* begin, const char* end) const;
570 #ifdef JSON_USE_CPPTL
571  bool isMember(const CppTL::ConstString& key) const;
573 #endif
574 
580  Members getMemberNames() const;
581 
582  //# ifdef JSON_USE_CPPTL
583  // EnumMemberNames enumMemberNames() const;
584  // EnumValues enumValues() const;
585  //# endif
586 
588  JSONCPP_DEPRECATED("Use setComment(String const&) instead.")
589  void setComment(const char* comment, CommentPlacement placement) {
590  setComment(String(comment, strlen(comment)), placement);
591  }
593  void setComment(const char* comment, size_t len, CommentPlacement placement) {
594  setComment(String(comment, len), placement);
595  }
597  void setComment(String comment, CommentPlacement placement);
598  bool hasComment(CommentPlacement placement) const;
600  String getComment(CommentPlacement placement) const;
601 
602  String toStyledString() const;
603 
604  const_iterator begin() const;
605  const_iterator end() const;
606 
607  iterator begin();
608  iterator end();
609 
610  // Accessors for the [start, limit) range of bytes within the JSON text from
611  // which this value was parsed, if any.
612  void setOffsetStart(ptrdiff_t start);
613  void setOffsetLimit(ptrdiff_t limit);
614  ptrdiff_t getOffsetStart() const;
615  ptrdiff_t getOffsetLimit() const;
616 
617 private:
618  void setType(ValueType v) {
619  bits_.value_type_ = static_cast<unsigned char>(v);
620  }
621  bool isAllocated() const { return bits_.allocated_; }
622  void setIsAllocated(bool v) { bits_.allocated_ = v; }
623 
624  void initBasic(ValueType type, bool allocated = false);
625  void dupPayload(const Value& other);
626  void releasePayload();
627  void dupMeta(const Value& other);
628 
629  Value& resolveReference(const char* key);
630  Value& resolveReference(const char* key, const char* end);
631 
632  // struct MemberNamesTransform
633  //{
634  // typedef const char *result_type;
635  // const char *operator()( const CZString &name ) const
636  // {
637  // return name.c_str();
638  // }
639  //};
640 
641  union ValueHolder {
642  LargestInt int_;
643  LargestUInt uint_;
644  double real_;
645  bool bool_;
646  char* string_; // if allocated_, ptr to { unsigned, char[] }.
647  ObjectValues* map_;
648  } value_;
649 
650  struct {
651  // Really a ValueType, but types should agree for bitfield packing.
652  unsigned int value_type_ : 8;
653  // Unless allocated_, string_ must be null-terminated.
654  unsigned int allocated_ : 1;
655  } bits_;
656 
657  class Comments {
658  public:
659  Comments() = default;
660  Comments(const Comments& that);
661  Comments(Comments&& that);
662  Comments& operator=(const Comments& that);
663  Comments& operator=(Comments&& that);
664  bool has(CommentPlacement slot) const;
665  String get(CommentPlacement slot) const;
666  void set(CommentPlacement slot, String comment);
667 
668  private:
669  using Array = std::array<String, numberOfCommentPlacement>;
670  std::unique_ptr<Array> ptr_;
671  };
672  Comments comments_;
673 
674  // [start, limit) byte offsets in the source JSON text from which this Value
675  // was extracted.
676  ptrdiff_t start_;
677  ptrdiff_t limit_;
678 };
679 
680 template <> inline bool Value::as<bool>() const { return asBool(); }
681 template <> inline bool Value::is<bool>() const { return isBool(); }
682 
683 template <> inline Int Value::as<Int>() const { return asInt(); }
684 template <> inline bool Value::is<Int>() const { return isInt(); }
685 
686 template <> inline UInt Value::as<UInt>() const { return asUInt(); }
687 template <> inline bool Value::is<UInt>() const { return isUInt(); }
688 
689 #if defined(JSON_HAS_INT64)
690 template <> inline Int64 Value::as<Int64>() const { return asInt64(); }
691 template <> inline bool Value::is<Int64>() const { return isInt64(); }
692 
693 template <> inline UInt64 Value::as<UInt64>() const { return asUInt64(); }
694 template <> inline bool Value::is<UInt64>() const { return isUInt64(); }
695 #endif
696 
697 template <> inline double Value::as<double>() const { return asDouble(); }
698 template <> inline bool Value::is<double>() const { return isDouble(); }
699 
700 template <> inline String Value::as<String>() const { return asString(); }
701 template <> inline bool Value::is<String>() const { return isString(); }
702 
705 template <> inline float Value::as<float>() const { return asFloat(); }
706 template <> inline const char* Value::as<const char*>() const {
707  return asCString();
708 }
709 #ifdef JSON_USE_CPPTL
710 template <> inline CppTL::ConstString Value::as<CppTL::ConstString>() const {
711  return asConstString();
712 }
713 #endif
714 
719 public:
720  friend class Path;
721 
722  PathArgument();
723  PathArgument(ArrayIndex index);
724  PathArgument(const char* key);
725  PathArgument(String key);
726 
727 private:
728  enum Kind { kindNone = 0, kindIndex, kindKey };
729  String key_;
730  ArrayIndex index_{};
731  Kind kind_{kindNone};
732 };
733 
745 class JSON_API Path {
746 public:
747  Path(const String& path, const PathArgument& a1 = PathArgument(),
748  const PathArgument& a2 = PathArgument(),
749  const PathArgument& a3 = PathArgument(),
750  const PathArgument& a4 = PathArgument(),
751  const PathArgument& a5 = PathArgument());
752 
753  const Value& resolve(const Value& root) const;
754  Value resolve(const Value& root, const Value& defaultValue) const;
757  Value& make(Value& root) const;
758 
759 private:
760  typedef std::vector<const PathArgument*> InArgs;
761  typedef std::vector<PathArgument> Args;
762 
763  void makePath(const String& path, const InArgs& in);
764  void addPathInArg(const String& path, const InArgs& in,
765  InArgs::const_iterator& itInArg, PathArgument::Kind kind);
766  static void invalidPath(const String& path, int location);
767 
768  Args args_;
769 };
770 
775 public:
776  typedef std::bidirectional_iterator_tag iterator_category;
777  typedef unsigned int size_t;
778  typedef int difference_type;
780 
781  bool operator==(const SelfType& other) const { return isEqual(other); }
782 
783  bool operator!=(const SelfType& other) const { return !isEqual(other); }
784 
785  difference_type operator-(const SelfType& other) const {
786  return other.computeDistance(*this);
787  }
788 
791  Value key() const;
792 
795  UInt index() const;
796 
800  String name() const;
801 
806  JSONCPP_DEPRECATED("Use `key = name();` instead.")
807  char const* memberName() const;
811  char const* memberName(char const** end) const;
812 
813 protected:
820  const Value& deref() const;
821  Value& deref();
822 
823  void increment();
824 
825  void decrement();
826 
827  difference_type computeDistance(const SelfType& other) const;
828 
829  bool isEqual(const SelfType& other) const;
830 
831  void copy(const SelfType& other);
832 
833 private:
834  Value::ObjectValues::iterator current_;
835  // Indicates that iterator is for a null value.
836  bool isNull_{true};
837 
838 public:
839  // For some reason, BORLAND needs these at the end, rather
840  // than earlier. No idea why.
841  ValueIteratorBase();
842  explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
843 };
844 
849  friend class Value;
850 
851 public:
852  typedef const Value value_type;
853  // typedef unsigned int size_t;
854  // typedef int difference_type;
855  typedef const Value& reference;
856  typedef const Value* pointer;
858 
860  ValueConstIterator(ValueIterator const& other);
861 
862 private:
865  explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
866 
867 public:
868  SelfType& operator=(const ValueIteratorBase& other);
869 
871  SelfType temp(*this);
872  ++*this;
873  return temp;
874  }
875 
877  SelfType temp(*this);
878  --*this;
879  return temp;
880  }
881 
883  decrement();
884  return *this;
885  }
886 
888  increment();
889  return *this;
890  }
891 
892  reference operator*() const { return deref(); }
893 
894  pointer operator->() const { return &deref(); }
895 };
896 
900  friend class Value;
901 
902 public:
903  typedef Value value_type;
904  typedef unsigned int size_t;
905  typedef int difference_type;
906  typedef Value& reference;
907  typedef Value* pointer;
909 
910  ValueIterator();
911  explicit ValueIterator(const ValueConstIterator& other);
912  ValueIterator(const ValueIterator& other);
913 
914 private:
917  explicit ValueIterator(const Value::ObjectValues::iterator& current);
918 
919 public:
920  SelfType& operator=(const SelfType& other);
921 
923  SelfType temp(*this);
924  ++*this;
925  return temp;
926  }
927 
929  SelfType temp(*this);
930  --*this;
931  return temp;
932  }
933 
935  decrement();
936  return *this;
937  }
938 
940  increment();
941  return *this;
942  }
943 
949  reference operator*() { return deref(); }
950  pointer operator->() { return &deref(); }
951 };
952 
953 inline void swap(Value& a, Value& b) { a.swap(b); }
954 
955 } // namespace Json
956 
957 #pragma pack(pop)
958 
959 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
960 #pragma warning(pop)
961 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
962 
963 #endif // CPPTL_JSON_H_INCLUDED
Json::Value::asUInt
UInt asUInt() const
Definition: json_value.cpp:688
Json::ValueIteratorBase::operator!=
bool operator!=(const SelfType &other) const
Definition: value.h:783
Json::ValueConstIterator::operator->
pointer operator->() const
Definition: value.h:894
Json::ValueType
ValueType
Type of the value held by a Value object.
Definition: value.h:97
Json::numberOfCommentPlacement
root value)
Definition: value.h:113
Json::ArrayIndex
unsigned int ArrayIndex
Definition: forwards.h:29
JSONCPP_NORETURN
#define JSONCPP_NORETURN
Definition: value.h:18
Json::ValueIterator::reference
Value & reference
Definition: value.h:906
Json::Value::Int64
Json::Int64 Int64
Definition: value.h:199
JSONCPP_OP_EXPLICIT
#define JSONCPP_OP_EXPLICIT
Definition: config.h:98
Json::uintValue
unsigned integer value
Definition: value.h:100
Json::significantDigits
we set max number of significant digits in string
Definition: value.h:119
Json::LargestUInt
UInt64 LargestUInt
Definition: config.h:154
JSONCPP_NOEXCEPT
#define JSONCPP_NOEXCEPT
Definition: config.h:97
Json::ValueIterator::operator*
reference operator*()
Definition: value.h:949
Json::commentAfterOnSameLine
a comment just after a value on the same line
Definition: value.h:110
Json::ValueConstIterator
const iterator for object and array value.
Definition: value.h:848
Json::Int
int Int
Definition: config.h:138
Json::Value::asCString
const char * asCString() const
Embedded zeroes could cause you trouble!
Definition: json_value.cpp:593
Json::Value::isUInt
bool isUInt() const
Definition: json_value.cpp:1336
forwards.h
Json::ValueIteratorBase::operator==
bool operator==(const SelfType &other) const
Definition: value.h:781
Json::commentBefore
a comment placed on the line before a value
Definition: value.h:109
Json::LogicError
Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
Definition: value.h:84
Json::stringValue
UTF-8 string value.
Definition: value.h:102
Json::ValueIterator
Iterator for object and array value.
Definition: value.h:899
Json::ValueIteratorBase::difference_type
int difference_type
Definition: value.h:778
Json::ValueIterator::operator--
SelfType & operator--()
Definition: value.h:934
Json::operator==
bool operator==(const SecureAllocator< T > &, const SecureAllocator< U > &)
Definition: allocator.h:76
Json::Int64
__int64 Int64
Definition: config.h:147
Json::ValueIteratorBase::computeDistance
difference_type computeDistance(const SelfType &other) const
Definition: json_valueiterator.inl:32
Json::Value::iterator
ValueIterator iterator
Definition: value.h:193
Json::ValueIterator::operator++
SelfType & operator++()
Definition: value.h:939
Json::Path
Experimental and untested: represents a "path" to access a node.
Definition: value.h:745
Json::LargestInt
Int64 LargestInt
Definition: config.h:153
Json::UInt
unsigned int UInt
Definition: config.h:139
Json::commentAfter
a comment on the line after a value (only make sense for
Definition: value.h:111
Json::Value::isInt64
bool isInt64() const
Definition: json_value.cpp:1359
Json::intValue
signed integer value
Definition: value.h:99
Json::ValueConstIterator::operator++
SelfType operator++(int)
Definition: value.h:870
Json::decimalPlaces
we set max number of digits after "." in string
Definition: value.h:120
Json::operator!=
bool operator!=(const SecureAllocator< T > &, const SecureAllocator< U > &)
Definition: allocator.h:81
Json::UInt64
unsigned __int64 UInt64
Definition: config.h:148
Json::Value::asUInt64
UInt64 asUInt64() const
Definition: json_value.cpp:733
Json::ValueIterator::operator--
SelfType operator--(int)
Definition: value.h:928
Json::ValueIterator::value_type
Value value_type
Definition: value.h:903
Json::Exception::msg_
String msg_
Definition: value.h:64
Json::Value::isUInt64
bool isUInt64() const
Definition: json_value.cpp:1379
Json::arrayValue
array value (ordered list)
Definition: value.h:104
Json::PrecisionType
PrecisionType
Type of precision for formatting of real values.
Definition: value.h:118
Json::ValueIteratorBase::SelfType
ValueIteratorBase SelfType
Definition: value.h:779
Json::ValueConstIterator::SelfType
ValueConstIterator SelfType
Definition: value.h:857
Json::Value::isString
bool isString() const
Definition: json_value.cpp:1427
Json::Value::Int
Json::Int Int
Definition: value.h:196
Json::Value::asInt64
Int64 asInt64() const
Definition: json_value.cpp:712
Json::Value::swap
void swap(Value &other)
Swap everything.
Definition: json_value.cpp:470
Json::Value
Represents a JSON value.
Definition: value.h:188
Json::Exception
Base class for all exceptions we throw.
Definition: value.h:57
Json::StaticString::StaticString
StaticString(const char *czstring)
Definition: value.h:144
Json::Value::isDouble
bool isDouble() const
Definition: json_value.cpp:1421
Json::Value::value_type_
unsigned int value_type_
Definition: value.h:652
Json::Value::value_type
std::string value_type
Definition: value.h:206
Json::PathArgument
Experimental and untested: represents an element of the "path" to access a node.
Definition: value.h:718
Json::Value::isBool
bool isBool() const
Definition: json_value.cpp:1315
Json::CommentPlacement
CommentPlacement
Definition: value.h:108
JSONCPP_DEPRECATED
#define JSONCPP_DEPRECATED(message)
Definition: config.h:119
Json::Value::asFloat
float asFloat() const
Definition: json_value.cpp:793
Json::ValueIteratorBase::iterator_category
std::bidirectional_iterator_tag iterator_category
Definition: value.h:776
Json::ValueIterator::size_t
unsigned int size_t
Definition: value.h:904
Json::Value::LargestInt
Json::LargestInt LargestInt
Definition: value.h:201
Json::swap
void swap(Value &a, Value &b)
Definition: value.h:953
Json::Value::asInt
Int asInt() const
Definition: json_value.cpp:666
Json::Value::asDouble
double asDouble() const
Definition: json_value.cpp:771
Json
JSON (JavaScript Object Notation).
Definition: allocator.h:14
JSON_API
#define JSON_API
If defined, indicates that the source file is amalgamated to prevent private header inclusion.
Definition: config.h:66
Json::Value::asString
String asString() const
Embedded zeroes are possible.
Definition: json_value.cpp:631
Json::Value::UInt
Json::UInt UInt
Definition: value.h:195
Json::ValueConstIterator::value_type
const typedef Value value_type
Definition: value.h:852
Json::Value::const_iterator
ValueConstIterator const_iterator
Definition: value.h:194
Json::ValueIteratorBase
base class for Value iterators.
Definition: value.h:774
Json::objectValue
object value (collection of name/value pairs).
Definition: value.h:105
Json::ValueConstIterator::operator++
SelfType & operator++()
Definition: value.h:887
Json::StaticString::c_str
const char * c_str() const
Definition: value.h:148
Json::Value::nullRef
static const Value & nullRef
Definition: value.h:211
Json::String
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
Definition: config.h:162
Json::Value::LargestUInt
Json::LargestUInt LargestUInt
Definition: value.h:202
Json::Value::allocated_
unsigned int allocated_
Definition: value.h:654
Json::Value::ArrayIndex
Json::ArrayIndex ArrayIndex
Definition: value.h:203
Json::ValueConstIterator::operator--
SelfType & operator--()
Definition: value.h:882
Json::ValueConstIterator::reference
const typedef Value & reference
Definition: value.h:855
Json::Value::setComment
void setComment(const char *comment, size_t len, CommentPlacement placement)
Comments must be //... or /* ... *‍/.
Definition: value.h:593
Json::ValueIterator::SelfType
ValueIterator SelfType
Definition: value.h:908
Json::ValueIterator::difference_type
int difference_type
Definition: value.h:905
Json::ValueConstIterator::operator*
reference operator*() const
Definition: value.h:892
Json::ValueConstIterator::pointer
const typedef Value * pointer
Definition: value.h:856
Json::booleanValue
bool value
Definition: value.h:103
Json::ValueIterator::operator->
pointer operator->()
Definition: value.h:950
Json::nullValue
'null' value
Definition: value.h:98
Json::ValueIteratorBase::operator-
difference_type operator-(const SelfType &other) const
Definition: value.h:785
Json::Value::isInt
bool isInt() const
Definition: json_value.cpp:1317
Json::StaticString
Lightweight wrapper to tag static string.
Definition: value.h:142
Json::realValue
double value
Definition: value.h:101
Json::Value::Members
std::vector< String > Members
Definition: value.h:192
Json::ValueIterator::operator++
SelfType operator++(int)
Definition: value.h:922
Json::ValueIterator::pointer
Value * pointer
Definition: value.h:907
Json::ValueIteratorBase::size_t
unsigned int size_t
Definition: value.h:777
Json::Value::asBool
bool asBool() const
Definition: json_value.cpp:816
Json::ValueConstIterator::operator--
SelfType operator--(int)
Definition: value.h:876
Json::Value::UInt64
Json::UInt64 UInt64
Definition: value.h:198
Json::RuntimeError
Exceptions which the user cannot easily avoid.
Definition: value.h:73