AWS SDK for C++  0.14.3
AWS SDK for C++
json.h
Go to the documentation of this file.
1 
4 // //////////////////////////////////////////////////////////////////////
5 // Beginning of content of file: LICENSE
6 // //////////////////////////////////////////////////////////////////////
7 
8 /*
9 The JsonCpp library's source code, including accompanying documentation,
10 tests and demonstration applications, are licensed under the following
11 conditions...
12 
13 The author (Baptiste Lepilleur) explicitly disclaims copyright in all
14 jurisdictions which recognize such a disclaimer. In such jurisdictions,
15 this software is released into the Public Domain.
16 
17 In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
18 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
19 released under the terms of the MIT License (see below).
20 
21 In jurisdictions which recognize Public Domain property, the user of this
22 software may choose to accept it either as 1) Public Domain, 2) under the
23 conditions of the MIT License (see below), or 3) under the terms of dual
24 Public Domain/MIT License conditions described here, as they choose.
25 
26 The MIT License is about as close to Public Domain as a license can get, and is
27 described in clear, concise terms at:
28 
29  http://en.wikipedia.org/wiki/MIT_License
30 
31 The full text of the MIT License follows:
32 
33 ========================================================================
34 Copyright (c) 2007-2010 Baptiste Lepilleur
35 
36 Permission is hereby granted, free of charge, to any person
37 obtaining a copy of this software and associated documentation
38 files (the "Software"), to deal in the Software without
39 restriction, including without limitation the rights to use, copy,
40 modify, merge, publish, distribute, sublicense, and/or sell copies
41 of the Software, and to permit persons to whom the Software is
42 furnished to do so, subject to the following conditions:
43 
44 The above copyright notice and this permission notice shall be
45 included in all copies or substantial portions of the Software.
46 
47 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
51 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
52 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
53 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
54 SOFTWARE.
55 ========================================================================
56 (END LICENSE TEXT)
57 
58 The MIT license is compatible with both the GPL and commercial
59 software, affording one all of the rights of Public Domain with the
60 minor nuisance of being required to keep the above copyright notice
61 and license text in the source code. Note also that by accepting the
62 Public Domain "license" you can re-license your copy using whatever
63 license you like.
64 
65 */
66 
67 /*
68 This file has been modified from its original version by Amazon:
69  (1) Memory management operations use aws memory management api
70  (2) #includes all use <>
71  (3) Symbol export preprocessor control tweaked slightly to reduce sdk integration tedium
72  (4) Wrapped in Amazon namespace to prevent symbol conflicts in case a project including the native SDK also includes this library through another source and links statically
73 */
74 
75 // //////////////////////////////////////////////////////////////////////
76 // End of content of file: LICENSE
77 // //////////////////////////////////////////////////////////////////////
78 
79 
80 
81 
82 
83 #ifndef AWS_JSON_AMALGATED_H_INCLUDED
84 # define AWS_JSON_AMALGATED_H_INCLUDED
85 #define AWS_JSON_IS_AMALGAMATION
88 
89 // //////////////////////////////////////////////////////////////////////
90 // Beginning of content of file: include/json/version.h
91 // //////////////////////////////////////////////////////////////////////
92 
93 // DO NOT EDIT. This file is generated by CMake from "version"
94 // and "version.h.in" files.
95 // Run CMake configure step to update it.
96 #ifndef AWS_JSON_VERSION_H_INCLUDED
97 # define AWS_JSON_VERSION_H_INCLUDED
98 
99 # define AWS_JSONCPP_VERSION_STRING "1.4.0"
100 # define AWS_JSONCPP_VERSION_MAJOR 1
101 # define AWS_JSONCPP_VERSION_MINOR 4
102 # define AWS_JSONCPP_VERSION_PATCH 0
103 # define AWS_JSONCPP_VERSION_QUALIFIER
104 # define AWS_JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
105 
106 #endif // AWS_JSON_VERSION_H_INCLUDED
107 
108 // //////////////////////////////////////////////////////////////////////
109 // End of content of file: include/json/version.h
110 // //////////////////////////////////////////////////////////////////////
111 
112 
113 
114 
115 
116 
117 // //////////////////////////////////////////////////////////////////////
118 // Beginning of content of file: include/json/config.h
119 // //////////////////////////////////////////////////////////////////////
120 
121 // Copyright 2007-2010 Baptiste Lepilleur
122 // Distributed under MIT license, or public domain if desired and
123 // recognized in your jurisdiction.
124 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
125 
126 #ifndef AWS_JSON_CONFIG_H_INCLUDED
127 #define AWS_JSON_CONFIG_H_INCLUDED
128 
130 //# define AWS_JSON_IN_CPPTL 1
131 
133 //# define AWS_JSON_USE_CPPTL 1
137 //# define AWS_JSON_USE_CPPTL_SMALLMAP 1
141 //# define AWS_JSON_VALUE_USE_INTERNAL_MAP 1
148 //# define AWS_JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
149 
150 // If non-zero, the library uses exceptions to report bad input instead of C
151 // assertion macros. The default is to use exceptions.
152 #ifndef JSON_USE_EXCEPTION
153 #define JSON_USE_EXCEPTION 1
154 #endif
155 
159 // #define AWS_JSON_IS_AMALGAMATION
160 
161 #ifdef AWS_JSON_IN_CPPTL
162 #include <cpptl/config.h>
163 #ifndef AWS_JSON_USE_CPPTL
164 #define AWS_JSON_USE_CPPTL 1
165 #endif
166 #endif
167 
168 #ifdef AWS_JSON_IN_CPPTL
169  #define AWS_JSON_API CPPTL_API
170 #elif defined(USE_IMPORT_EXPORT)
171  #ifdef _MSC_VER
172  #ifdef AWS_CORE_EXPORTS
173  #define AWS_JSON_API __declspec(dllexport)
174  #define AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING
175  #else
176  #define AWS_JSON_API __declspec(dllimport)
177  #define AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING
178  #endif // AWS_CORE_EXPORTS
179  #endif // if defined(_MSC_VER)
180 #endif // ifdef AWS_JSON_IN_CPPTL
181 #if !defined(AWS_JSON_API)
182 #define AWS_JSON_API
183 #endif
184 
185 // If AWS_JSON_NO_INT64 is defined, then Json only support C++ "int" type for
186 // integer
187 // Storages, and 64 bits integer support is disabled.
188 // #define AWS_JSON_NO_INT64 1
189 
190 #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
191 // Microsoft Visual Studio 6 only support conversion from __int64 to double
192 // (no conversion from unsigned __int64).
193 #define AWS_JSON_USE_INT64_DOUBLE_CONVERSION 1
194 // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
195 // characters in the debug information)
196 // All projects I've ever seen with VS6 were using this globally (not bothering
197 // with pragma push/pop).
198 #pragma warning(disable : 4786)
199 #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
200 
201 #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
202 #define AWS_JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
204 #pragma warning(disable : 4267)
205 #pragma warning(disable : 4512)
206 #endif
207 
208 #if !defined(AWS_JSONCPP_DEPRECATED)
209 #define AWS_JSONCPP_DEPRECATED(message)
210 #endif // if !defined(AWS_JSONCPP_DEPRECATED)
211 
212 namespace Aws {
213 namespace External {
214 namespace Json {
215 typedef int Int;
216 typedef unsigned int UInt;
217 #if defined(AWS_JSON_NO_INT64)
218 typedef int LargestInt;
219 typedef unsigned int LargestUInt;
220 #undef AWS_JSON_HAS_INT64
221 #else // if defined(AWS_JSON_NO_INT64)
222 // For Microsoft Visual use specific types as long long is not supported
223 #if defined(_MSC_VER) // Microsoft Visual Studio
224 typedef __int64 Int64;
225 typedef unsigned __int64 UInt64;
226 #else // if defined(_MSC_VER) // Other platforms, use long long
227 typedef long long int Int64;
228 typedef unsigned long long int UInt64;
229 #endif // if defined(_MSC_VER)
230 typedef Int64 LargestInt;
231 typedef UInt64 LargestUInt;
232 #define AWS_JSON_HAS_INT64
233 #endif // if defined(AWS_JSON_NO_INT64)
234 } // end namespace Json
235 } // namespace External
236 } // namespace Aws
237 
238 #endif // AWS_JSON_CONFIG_H_INCLUDED
239 
240 // //////////////////////////////////////////////////////////////////////
241 // End of content of file: include/json/config.h
242 // //////////////////////////////////////////////////////////////////////
243 
244 
245 
246 
247 
248 
249 // //////////////////////////////////////////////////////////////////////
250 // Beginning of content of file: include/json/forwards.h
251 // //////////////////////////////////////////////////////////////////////
252 
253 // Copyright 2007-2010 Baptiste Lepilleur
254 // Distributed under MIT license, or public domain if desired and
255 // recognized in your jurisdiction.
256 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
257 
258 #ifndef AWS_JSON_FORWARDS_H_INCLUDED
259 #define AWS_JSON_FORWARDS_H_INCLUDED
260 
261 #if !defined(AWS_JSON_IS_AMALGAMATION)
262 #include <config.h>
263 #endif // if !defined(AWS_JSON_IS_AMALGAMATION)
264 
265 namespace Aws {
266 namespace External {
267 namespace Json {
268 
269 // writer.h
270 class FastWriter;
271 class StyledWriter;
272 
273 // reader.h
274 class Reader;
275 
276 // features.h
277 class Features;
278 
279 // value.h
280 typedef unsigned int ArrayIndex;
281 class StaticString;
282 class Path;
283 class PathArgument;
284 class Value;
285 class ValueIteratorBase;
286 class ValueIterator;
287 class ValueConstIterator;
288 #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
289 class ValueMapAllocator;
290 class ValueInternalLink;
291 class ValueInternalArray;
292 class ValueInternalMap;
293 #endif // #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
294 
295 } // namespace Json
296 } // namespace External
297 } // namespace Aws
298 
299 #endif // AWS_JSON_FORWARDS_H_INCLUDED
300 
301 // //////////////////////////////////////////////////////////////////////
302 // End of content of file: include/json/forwards.h
303 // //////////////////////////////////////////////////////////////////////
304 
305 
306 
307 
308 
309 
310 // //////////////////////////////////////////////////////////////////////
311 // Beginning of content of file: include/json/features.h
312 // //////////////////////////////////////////////////////////////////////
313 
314 // Copyright 2007-2010 Baptiste Lepilleur
315 // Distributed under MIT license, or public domain if desired and
316 // recognized in your jurisdiction.
317 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
318 
319 #ifndef AWS_CPPTL_JSON_FEATURES_H_INCLUDED
320 #define AWS_CPPTL_JSON_FEATURES_H_INCLUDED
321 
322 #if !defined(AWS_JSON_IS_AMALGAMATION)
323 #include <forwards.h>
324 #endif // if !defined(AWS_JSON_IS_AMALGAMATION)
325 
326 namespace Aws {
327 namespace External {
328 namespace Json {
329 
335 public:
342  static Features all();
343 
350  static Features strictMode();
351 
354  Features();
355 
358 
362 
365 
368 };
369 
370 } // namespace Json
371 } // namespace External
372 } // namespace Aws
373 
374 #endif // AWS_CPPTL_JSON_FEATURES_H_INCLUDED
375 
376 // //////////////////////////////////////////////////////////////////////
377 // End of content of file: include/json/features.h
378 // //////////////////////////////////////////////////////////////////////
379 
380 
381 
382 
383 
384 
385 // //////////////////////////////////////////////////////////////////////
386 // Beginning of content of file: include/json/value.h
387 // //////////////////////////////////////////////////////////////////////
388 
389 // Copyright 2007-2010 Baptiste Lepilleur
390 // Distributed under MIT license, or public domain if desired and
391 // recognized in your jurisdiction.
392 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
393 
394 #ifndef AWS_CPPTL_JSON_H_INCLUDED
395 #define AWS_CPPTL_JSON_H_INCLUDED
396 
397 #if !defined(AWS_JSON_IS_AMALGAMATION)
398 #include <forwards.h>
399 #endif // if !defined(AWS_JSON_IS_AMALGAMATION)
400 
407 
408 #ifndef AWS_JSON_USE_CPPTL_SMALLMAP
409 #include <map>
410 #else
411 #include <cpptl/smallmap.h>
412 #endif
413 #ifdef AWS_JSON_USE_CPPTL
414 #include <cpptl/forwards.h>
415 #endif
416 
417 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
418 // be used by...
419 #if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
420 #pragma warning(push)
421 #pragma warning(disable : 4251)
422 #endif // if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
423 
426 namespace Aws {
427 namespace External {
428 namespace Json {
429 
432 enum ValueType {
433  nullValue = 0,
441 };
442 
449 };
450 
451 //# ifdef AWS_JSON_USE_CPPTL
452 // typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
453 // typedef CppTL::AnyEnumerator<const Value &> EnumValues;
454 //# endif
455 
471 public:
472  explicit StaticString(const char* czstring) : str_(czstring) {}
473 
474  operator const char*() const { return str_; }
475 
476  const char* c_str() const { return str_; }
477 
478 private:
479  const char* str_;
480 };
481 
512  friend class ValueIteratorBase;
513 #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
514  friend class ValueInternalLink;
515  friend class ValueInternalMap;
516 #endif
517 public:
521  typedef Json::UInt UInt;
522  typedef Json::Int Int;
523 #if defined(AWS_JSON_HAS_INT64)
526 #endif // defined(AWS_JSON_HAS_INT64)
530 
531  static const Value& null;
533  static const LargestInt minLargestInt;
535  static const LargestInt maxLargestInt;
537  static const LargestUInt maxLargestUInt;
538 
540  static const Int minInt;
542  static const Int maxInt;
544  static const UInt maxUInt;
545 
546 #if defined(AWS_JSON_HAS_INT64)
547  static const Int64 minInt64;
550  static const Int64 maxInt64;
552  static const UInt64 maxUInt64;
553 #endif // defined(AWS_JSON_HAS_INT64)
554 
555 private:
556 #ifndef AWS_JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
557 #ifndef AWS_JSON_VALUE_USE_INTERNAL_MAP
558  class CZString {
559  public:
560  enum DuplicationPolicy {
561  noDuplication = 0,
562  duplicate,
563  duplicateOnCopy
564  };
565  CZString(ArrayIndex index);
566  CZString(const char* cstr, DuplicationPolicy allocate);
567  CZString(const CZString& other);
568  ~CZString();
569  CZString& operator=(CZString other);
570  bool operator<(const CZString& other) const;
571  bool operator==(const CZString& other) const;
572  ArrayIndex index() const;
573  const char* c_str() const;
574  bool isStaticString() const;
575 
576  private:
577  void swap(CZString& other);
578  const char* cstr_;
579  ArrayIndex index_;
580  };
581 
582 public:
583 #ifndef AWS_JSON_USE_CPPTL_SMALLMAP
585 #else
586  typedef CppTL::SmallMap<CZString, Value> ObjectValues;
587 #endif // ifndef AWS_JSON_USE_CPPTL_SMALLMAP
588 #endif // ifndef AWS_JSON_VALUE_USE_INTERNAL_MAP
589 #endif // ifndef AWS_JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
590 
591 public:
607  Value(ValueType type = nullValue);
608  Value(Int value);
609  Value(UInt value);
610 #if defined(AWS_JSON_HAS_INT64)
611  Value(Int64 value);
612  Value(UInt64 value);
613 #endif // if defined(AWS_JSON_HAS_INT64)
614  Value(double value);
615  Value(const char* value);
616  Value(const char* beginValue, const char* endValue);
627  Value(const StaticString& value);
628  Value(const Aws::String& value);
629 #ifdef AWS_JSON_USE_CPPTL
630  Value(const CppTL::ConstString& value);
631 #endif
632  Value(bool value);
634  Value(const Value& other);
635  ~Value();
636 
637  // Deep copy, then swap(other).
638  Value& operator=(Value other);
640  void swap(Value& other);
642  void swapPayload(Value& other);
643 
644  ValueType type() const;
645 
647  bool operator<(const Value& other) const;
648  bool operator<=(const Value& other) const;
649  bool operator>=(const Value& other) const;
650  bool operator>(const Value& other) const;
651  bool operator==(const Value& other) const;
652  bool operator!=(const Value& other) const;
653  int compare(const Value& other) const;
654 
655  const char* asCString() const;
656  Aws::String asString() const;
657 #ifdef AWS_JSON_USE_CPPTL
658  CppTL::ConstString asConstString() const;
659 #endif
660  Int asInt() const;
661  UInt asUInt() const;
662 #if defined(AWS_JSON_HAS_INT64)
663  Int64 asInt64() const;
664  UInt64 asUInt64() const;
665 #endif // if defined(AWS_JSON_HAS_INT64)
666  LargestInt asLargestInt() const;
667  LargestUInt asLargestUInt() const;
668  float asFloat() const;
669  double asDouble() const;
670  bool asBool() const;
671 
672  bool isNull() const;
673  bool isBool() const;
674  bool isInt() const;
675  bool isInt64() const;
676  bool isUInt() const;
677  bool isUInt64() const;
678  bool isIntegral() const;
679  bool isDouble() const;
680  bool isNumeric() const;
681  bool isString() const;
682  bool isArray() const;
683  bool isObject() const;
684 
685  bool isConvertibleTo(ValueType other) const;
686 
688  ArrayIndex size() const;
689 
692  bool empty() const;
693 
695  bool operator!() const;
696 
700  void clear();
701 
707  void resize(ArrayIndex size);
708 
715  Value& operator[](ArrayIndex index);
716 
723  Value& operator[](int index);
724 
728  const Value& operator[](ArrayIndex index) const;
729 
733  const Value& operator[](int index) const;
734 
738  Value get(ArrayIndex index, const Value& defaultValue) const;
740  bool isValidIndex(ArrayIndex index) const;
744  Value& append(const Value& value);
745 
747  Value& operator[](const char* key);
750  const Value& operator[](const char* key) const;
752  Value& operator[](const Aws::String& key);
755  const Value& operator[](const Aws::String& key) const;
768  Value& operator[](const StaticString& key);
769 #ifdef AWS_JSON_USE_CPPTL
770  Value& operator[](const CppTL::ConstString& key);
774  const Value& operator[](const CppTL::ConstString& key) const;
775 #endif
776  Value get(const char* key, const Value& defaultValue) const;
779  Value get(const Aws::String& key, const Value& defaultValue) const;
780 #ifdef AWS_JSON_USE_CPPTL
781  Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
783 #endif
784  Value removeMember(const char* key);
794  Value removeMember(const Aws::String& key);
800  bool removeMember(const char* key, Value* removed);
807  bool removeIndex(ArrayIndex i, Value* removed);
808 
810  bool isMember(const char* key) const;
812  bool isMember(const Aws::String& key) const;
813 #ifdef AWS_JSON_USE_CPPTL
814  bool isMember(const CppTL::ConstString& key) const;
816 #endif
817 
823  Members getMemberNames() const;
824 
825  //# ifdef AWS_JSON_USE_CPPTL
826  // EnumMemberNames enumMemberNames() const;
827  // EnumValues enumValues() const;
828  //# endif
829 
831  void setComment(const char* comment, CommentPlacement placement);
833  void setComment(const char* comment, size_t len, CommentPlacement placement);
835  void setComment(const Aws::String& comment, CommentPlacement placement);
836  bool hasComment(CommentPlacement placement) const;
838  Aws::String getComment(CommentPlacement placement) const;
839 
840  Aws::String toStyledString() const;
841 
842  const_iterator begin() const;
843  const_iterator end() const;
844 
845  iterator begin();
846  iterator end();
847 
848  // Accessors for the [start, limit) range of bytes within the JSON text from
849  // which this value was parsed, if any.
850  void setOffsetStart(size_t start);
851  void setOffsetLimit(size_t limit);
852  size_t getOffsetStart() const;
853  size_t getOffsetLimit() const;
854 
855 private:
856  void initBasic(ValueType type, bool allocated = false);
857 
858  Value& resolveReference(const char* key, bool isStatic);
859 
860 #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
861  inline bool isItemAvailable() const { return itemIsUsed_ == 0; }
862 
863  inline void setItemUsed(bool isUsed = true) { itemIsUsed_ = isUsed ? 1 : 0; }
864 
865  inline bool isMemberNameStatic() const { return memberNameIsStatic_ == 0; }
866 
867  inline void setMemberNameIsStatic(bool isStatic) {
868  memberNameIsStatic_ = isStatic ? 1 : 0;
869  }
870 #endif // # ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
871 
872 private:
873  struct CommentInfo {
874  CommentInfo();
875  ~CommentInfo();
876 
877  void setComment(const char* text, size_t len);
878 
879  char* comment_;
880  };
881 
882  // struct MemberNamesTransform
883  //{
884  // typedef const char *result_type;
885  // const char *operator()( const CZString &name ) const
886  // {
887  // return name.c_str();
888  // }
889  //};
890 
891  union ValueHolder {
892  LargestInt int_;
893  LargestUInt uint_;
894  double real_;
895  bool bool_;
896  char* string_;
897 #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
898  ValueInternalArray* array_;
899  ValueInternalMap* map_;
900 #else
901  ObjectValues* map_;
902 #endif
903  } value_;
904  ValueType type_ : 8;
905  unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
906 #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
907  unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
908  unsigned int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
909 #endif
910  CommentInfo* comments_;
911 
912  // [start, limit) byte offsets in the source JSON text from which this Value
913  // was extracted.
914  size_t start_;
915  size_t limit_;
916 };
917 
922 public:
923  friend class Path;
924 
925  PathArgument();
926  PathArgument(ArrayIndex index);
927  PathArgument(const char* key);
928  PathArgument(const Aws::String& key);
929 
930 private:
931  enum Kind {
932  kindNone = 0,
933  kindIndex,
934  kindKey
935  };
936  Aws::String key_;
937  ArrayIndex index_;
938  Kind kind_;
939 };
940 
953 public:
954  Path(const Aws::String& path,
955  const PathArgument& a1 = PathArgument(),
956  const PathArgument& a2 = PathArgument(),
957  const PathArgument& a3 = PathArgument(),
958  const PathArgument& a4 = PathArgument(),
959  const PathArgument& a5 = PathArgument());
960 
961  const Value& resolve(const Value& root) const;
962  Value resolve(const Value& root, const Value& defaultValue) const;
965  Value& make(Value& root) const;
966 
967 private:
968  typedef Aws::Vector<const PathArgument*> InArgs;
969  typedef Aws::Vector<PathArgument> Args;
970 
971  void makePath(const Aws::String& path, const InArgs& in);
972  void addPathInArg(const Aws::String& path,
973  const InArgs& in,
974  InArgs::const_iterator& itInArg,
975  PathArgument::Kind kind);
976  void invalidPath(const Aws::String& path, int location);
977 
978  Args args_;
979 };
980 
981 #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
982 
1027 class AWS_JSON_API ValueMapAllocator {
1028 public:
1029  virtual ~ValueMapAllocator();
1030  virtual ValueInternalMap* newMap() = 0;
1031  virtual ValueInternalMap* newMapCopy(const ValueInternalMap& other) = 0;
1032  virtual void destructMap(ValueInternalMap* map) = 0;
1033  virtual ValueInternalLink* allocateMapBuckets(unsigned int size) = 0;
1034  virtual void releaseMapBuckets(ValueInternalLink* links) = 0;
1035  virtual ValueInternalLink* allocateMapLink() = 0;
1036  virtual void releaseMapLink(ValueInternalLink* link) = 0;
1037 };
1038 
1042 class AWS_JSON_API ValueInternalLink {
1043 public:
1044  enum {
1045  itemPerLink = 6
1046  }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
1047  enum InternalFlags {
1048  flagAvailable = 0,
1049  flagUsed = 1
1050  };
1051 
1052  ValueInternalLink();
1053 
1054  ~ValueInternalLink();
1055 
1056  Value items_[itemPerLink];
1057  char* keys_[itemPerLink];
1058  ValueInternalLink* previous_;
1059  ValueInternalLink* next_;
1060 };
1061 
1079 class AWS_JSON_API ValueInternalMap {
1080  friend class ValueIteratorBase;
1081  friend class Value;
1082 
1083 public:
1084  typedef unsigned int HashKey;
1085  typedef unsigned int BucketIndex;
1086 
1087 #ifndef AWS_JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
1088  struct IteratorState {
1089  IteratorState() : map_(0), link_(0), itemIndex_(0), bucketIndex_(0) {}
1090  ValueInternalMap* map_;
1091  ValueInternalLink* link_;
1092  BucketIndex itemIndex_;
1093  BucketIndex bucketIndex_;
1094  };
1095 #endif // ifndef AWS_JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
1096 
1097  ValueInternalMap();
1098  ValueInternalMap(const ValueInternalMap& other);
1099  ValueInternalMap& operator=(ValueInternalMap other);
1100  ~ValueInternalMap();
1101 
1102  void swap(ValueInternalMap& other);
1103 
1104  BucketIndex size() const;
1105 
1106  void clear();
1107 
1108  bool reserveDelta(BucketIndex growth);
1109 
1110  bool reserve(BucketIndex newItemCount);
1111 
1112  const Value* find(const char* key) const;
1113 
1114  Value* find(const char* key);
1115 
1116  Value& resolveReference(const char* key, bool isStatic);
1117 
1118  void remove(const char* key);
1119 
1120  void doActualRemove(ValueInternalLink* link,
1121  BucketIndex index,
1122  BucketIndex bucketIndex);
1123 
1124  ValueInternalLink*& getLastLinkInBucket(BucketIndex bucketIndex);
1125 
1126  Value& setNewItem(const char* key,
1127  bool isStatic,
1128  ValueInternalLink* link,
1129  BucketIndex index);
1130 
1131  Value& unsafeAdd(const char* key, bool isStatic, HashKey hashedKey);
1132 
1133  HashKey hash(const char* key) const;
1134 
1135  int compare(const ValueInternalMap& other) const;
1136 
1137 private:
1138  void makeBeginIterator(IteratorState& it) const;
1139  void makeEndIterator(IteratorState& it) const;
1140  static bool equals(const IteratorState& x, const IteratorState& other);
1141  static void increment(IteratorState& iterator);
1142  static void incrementBucket(IteratorState& iterator);
1143  static void decrement(IteratorState& iterator);
1144  static const char* key(const IteratorState& iterator);
1145  static const char* key(const IteratorState& iterator, bool& isStatic);
1146  static Value& value(const IteratorState& iterator);
1147  static int distance(const IteratorState& x, const IteratorState& y);
1148 
1149 private:
1150  ValueInternalLink* buckets_;
1151  ValueInternalLink* tailLink_;
1152  BucketIndex bucketsSize_;
1153  BucketIndex itemCount_;
1154 };
1155 
1170 class AWS_JSON_API ValueInternalArray {
1171  friend class Value;
1172  friend class ValueIteratorBase;
1173 
1174 public:
1175  enum {
1176  itemsPerPage = 8
1177  }; // should be a power of 2 for fast divide and modulo.
1178  typedef Value::ArrayIndex ArrayIndex;
1179  typedef unsigned int PageIndex;
1180 
1181 #ifndef AWS_JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
1182  struct IteratorState // Must be a POD
1183  {
1184  IteratorState() : array_(0), currentPageIndex_(0), currentItemIndex_(0) {}
1185  ValueInternalArray* array_;
1186  Value** currentPageIndex_;
1187  unsigned int currentItemIndex_;
1188  };
1189 #endif // ifndef AWS_JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
1190 
1191  ValueInternalArray();
1192  ValueInternalArray(const ValueInternalArray& other);
1193  ValueInternalArray& operator=(ValueInternalArray other);
1194  ~ValueInternalArray();
1195  void swap(ValueInternalArray& other);
1196 
1197  void clear();
1198  void resize(ArrayIndex newSize);
1199 
1200  Value& resolveReference(ArrayIndex index);
1201 
1202  Value* find(ArrayIndex index) const;
1203 
1204  ArrayIndex size() const;
1205 
1206  int compare(const ValueInternalArray& other) const;
1207 
1208 private:
1209  static bool equals(const IteratorState& x, const IteratorState& other);
1210  static void increment(IteratorState& iterator);
1211  static void decrement(IteratorState& iterator);
1212  static Value& dereference(const IteratorState& iterator);
1213  static Value& unsafeDereference(const IteratorState& iterator);
1214  static int distance(const IteratorState& x, const IteratorState& y);
1215  static ArrayIndex indexOf(const IteratorState& iterator);
1216  void makeBeginIterator(IteratorState& it) const;
1217  void makeEndIterator(IteratorState& it) const;
1218  void makeIterator(IteratorState& it, ArrayIndex index) const;
1219 
1220  void makeIndexValid(ArrayIndex index);
1221 
1222  Value** pages_;
1223  ArrayIndex size_;
1224  PageIndex pageCount_;
1225 };
1226 
1290 class AWS_JSON_API ValueArrayAllocator {
1291 public:
1292  virtual ~ValueArrayAllocator();
1293  virtual ValueInternalArray* newArray() = 0;
1294  virtual ValueInternalArray* newArrayCopy(const ValueInternalArray& other) = 0;
1295  virtual void destructArray(ValueInternalArray* array) = 0;
1308  virtual void
1309  reallocateArrayPageIndex(Value**& indexes,
1310  ValueInternalArray::PageIndex& indexCount,
1311  ValueInternalArray::PageIndex minNewIndexCount) = 0;
1312  virtual void
1313  releaseArrayPageIndex(Value** indexes,
1314  ValueInternalArray::PageIndex indexCount) = 0;
1315  virtual Value* allocateArrayPage() = 0;
1316  virtual void releaseArrayPage(Value* value) = 0;
1317 };
1318 #endif // #ifdef AWS_JSON_VALUE_USE_INTERNAL_MAP
1319 
1324 public:
1325  typedef std::bidirectional_iterator_tag iterator_category;
1326  typedef unsigned int size_t;
1327  typedef int difference_type;
1329 
1331 #ifndef AWS_JSON_VALUE_USE_INTERNAL_MAP
1332  explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
1333 #else
1334  ValueIteratorBase(const ValueInternalArray::IteratorState& state);
1335  ValueIteratorBase(const ValueInternalMap::IteratorState& state);
1336 #endif
1337 
1338  bool operator==(const SelfType& other) const { return isEqual(other); }
1339 
1340  bool operator!=(const SelfType& other) const { return !isEqual(other); }
1341 
1342  difference_type operator-(const SelfType& other) const {
1343  return computeDistance(other);
1344  }
1345 
1348  Value key() const;
1349 
1351  UInt index() const;
1352 
1355  const char* memberName() const;
1356 
1357 protected:
1358  Value& deref() const;
1359 
1360  void increment();
1361 
1362  void decrement();
1363 
1364  difference_type computeDistance(const SelfType& other) const;
1365 
1366  bool isEqual(const SelfType& other) const;
1367 
1368  void copy(const SelfType& other);
1369 
1370 private:
1371 #ifndef AWS_JSON_VALUE_USE_INTERNAL_MAP
1372  Value::ObjectValues::iterator current_;
1373  // Indicates that iterator is for a null value.
1374  bool isNull_;
1375 #else
1376  union {
1377  ValueInternalArray::IteratorState array_;
1378  ValueInternalMap::IteratorState map_;
1379  } iterator_;
1380  bool isArray_;
1381 #endif
1382 };
1383 
1388  friend class Value;
1389 
1390 public:
1391  typedef const Value value_type;
1392  typedef unsigned int size_t;
1393  typedef int difference_type;
1394  typedef const Value& reference;
1395  typedef const Value* pointer;
1397 
1399 
1400 private:
1403 #ifndef AWS_JSON_VALUE_USE_INTERNAL_MAP
1404  explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
1405 #else
1406  ValueConstIterator(const ValueInternalArray::IteratorState& state);
1407  ValueConstIterator(const ValueInternalMap::IteratorState& state);
1408 #endif
1409 public:
1410  SelfType& operator=(const ValueIteratorBase& other);
1411 
1412  SelfType operator++(int) {
1413  SelfType temp(*this);
1414  ++*this;
1415  return temp;
1416  }
1417 
1418  SelfType operator--(int) {
1419  SelfType temp(*this);
1420  --*this;
1421  return temp;
1422  }
1423 
1424  SelfType& operator--() {
1425  decrement();
1426  return *this;
1427  }
1428 
1429  SelfType& operator++() {
1430  increment();
1431  return *this;
1432  }
1433 
1434  reference operator*() const { return deref(); }
1435 
1436  pointer operator->() const { return &deref(); }
1437 };
1438 
1442  friend class Value;
1443 
1444 public:
1446  typedef unsigned int size_t;
1447  typedef int difference_type;
1448  typedef Value& reference;
1449  typedef Value* pointer;
1451 
1452  ValueIterator();
1453  ValueIterator(const ValueConstIterator& other);
1454  ValueIterator(const ValueIterator& other);
1455 
1456 private:
1459 #ifndef AWS_JSON_VALUE_USE_INTERNAL_MAP
1460  explicit ValueIterator(const Value::ObjectValues::iterator& current);
1461 #else
1462  ValueIterator(const ValueInternalArray::IteratorState& state);
1463  ValueIterator(const ValueInternalMap::IteratorState& state);
1464 #endif
1465 public:
1466  SelfType& operator=(const SelfType& other);
1467 
1468  SelfType operator++(int) {
1469  SelfType temp(*this);
1470  ++*this;
1471  return temp;
1472  }
1473 
1474  SelfType operator--(int) {
1475  SelfType temp(*this);
1476  --*this;
1477  return temp;
1478  }
1479 
1480  SelfType& operator--() {
1481  decrement();
1482  return *this;
1483  }
1484 
1485  SelfType& operator++() {
1486  increment();
1487  return *this;
1488  }
1489 
1490  reference operator*() const { return deref(); }
1491 
1492  pointer operator->() const { return &deref(); }
1493 };
1494 
1495 } // namespace Json
1496 } // namespace External
1497 } // namespace Aws
1498 
1499 namespace std {
1501 template<>
1503 }
1504 
1505 
1506 #if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1507 #pragma warning(pop)
1508 #endif // if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1509 
1510 #endif // AWS_CPPTL_JSON_H_INCLUDED
1511 
1512 // //////////////////////////////////////////////////////////////////////
1513 // End of content of file: include/json/value.h
1514 // //////////////////////////////////////////////////////////////////////
1515 
1516 
1517 
1518 
1519 
1520 
1521 // //////////////////////////////////////////////////////////////////////
1522 // Beginning of content of file: include/json/reader.h
1523 // //////////////////////////////////////////////////////////////////////
1524 
1525 // Copyright 2007-2010 Baptiste Lepilleur
1526 // Distributed under MIT license, or public domain if desired and
1527 // recognized in your jurisdiction.
1528 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
1529 
1530 #ifndef AWS_CPPTL_JSON_READER_H_INCLUDED
1531 #define AWS_CPPTL_JSON_READER_H_INCLUDED
1532 
1533 #if !defined(AWS_JSON_IS_AMALGAMATION)
1534 #include <features.h>
1535 #include <value.h>
1536 #endif // if !defined(AWS_JSON_IS_AMALGAMATION)
1537 
1538 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
1539 // be used by...
1540 #if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1541 #pragma warning(push)
1542 #pragma warning(disable : 4251)
1543 #endif // if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1544 
1545 namespace Aws {
1546 namespace External {
1547 namespace Json {
1548 
1554 public:
1555  typedef char Char;
1556  typedef const Char* Location;
1557 
1568  };
1569 
1573  Reader();
1574 
1578  Reader(const Features& features);
1579 
1594  bool
1595  parse(const Aws::String& document, Value& root, bool collectComments = true);
1596 
1615  bool parse(const char* beginDoc,
1616  const char* endDoc,
1617  Value& root,
1618  bool collectComments = true);
1619 
1622  bool parse(Aws::IStream& is, Value& root, bool collectComments = true);
1623 
1633  AWS_JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead")
1634  Aws::String getFormatedErrorMessages() const;
1635 
1644  Aws::String getFormattedErrorMessages() const;
1645 
1653  Aws::Vector<StructuredError> getStructuredErrors() const;
1654 
1661  bool pushError(const Value& value, const Aws::String& message);
1662 
1670  bool pushError(const Value& value, const Aws::String& message, const Value& extra);
1671 
1676  bool good() const;
1677 
1678 private:
1679  enum TokenType {
1680  tokenEndOfStream = 0,
1681  tokenObjectBegin,
1682  tokenObjectEnd,
1683  tokenArrayBegin,
1684  tokenArrayEnd,
1685  tokenString,
1686  tokenNumber,
1687  tokenTrue,
1688  tokenFalse,
1689  tokenNull,
1690  tokenArraySeparator,
1691  tokenMemberSeparator,
1692  tokenComment,
1693  tokenError
1694  };
1695 
1696  class Token {
1697  public:
1698  TokenType type_;
1699  Location start_;
1700  Location end_;
1701  };
1702 
1703  class ErrorInfo {
1704  public:
1705  Token token_;
1706  Aws::String message_;
1707  Location extra_;
1708  };
1709 
1710  typedef Aws::Deque<ErrorInfo> Errors;
1711 
1712  bool readToken(Token& token);
1713  void skipSpaces();
1714  bool match(Location pattern, int patternLength);
1715  bool readComment();
1716  bool readCStyleComment();
1717  bool readCppStyleComment();
1718  bool readString();
1719  void readNumber();
1720  bool readValue();
1721  bool readObject(Token& token);
1722  bool readArray(Token& token);
1723  bool decodeNumber(Token& token);
1724  bool decodeNumber(Token& token, Value& decoded);
1725  bool decodeString(Token& token);
1726  bool decodeString(Token& token, Aws::String& decoded);
1727  bool decodeDouble(Token& token);
1728  bool decodeDouble(Token& token, Value& decoded);
1729  bool decodeUnicodeCodePoint(Token& token,
1730  Location& current,
1731  Location end,
1732  unsigned int& unicode);
1733  bool decodeUnicodeEscapeSequence(Token& token,
1734  Location& current,
1735  Location end,
1736  unsigned int& unicode);
1737  bool addError(const Aws::String& message, Token& token, Location extra = 0);
1738  bool recoverFromError(TokenType skipUntilToken);
1739  bool addErrorAndRecover(const Aws::String& message,
1740  Token& token,
1741  TokenType skipUntilToken);
1742  void skipUntilSpace();
1743  Value& currentValue();
1744  Char getNextChar();
1745  void
1746  getLocationLineAndColumn(Location location, int& line, int& column) const;
1747  Aws::String getLocationLineAndColumn(Location location) const;
1748  void addComment(Location begin, Location end, CommentPlacement placement);
1749  void skipCommentTokens(Token& token);
1750 
1751  typedef Aws::Stack<Value*> Nodes;
1752  Nodes nodes_;
1753  Errors errors_;
1754  Aws::String document_;
1755  Location begin_;
1756  Location end_;
1757  Location current_;
1758  Location lastValueEnd_;
1759  Value* lastValue_;
1760  Aws::String commentsBefore_;
1761  Features features_;
1762  bool collectComments_;
1763 };
1764 
1790 
1791 } // namespace Json
1792 } // namespace External
1793 } // namespace Aws
1794 
1795 #if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1796 #pragma warning(pop)
1797 #endif // if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1798 
1799 #endif // AWS_CPPTL_JSON_READER_H_INCLUDED
1800 
1801 // //////////////////////////////////////////////////////////////////////
1802 // End of content of file: include/json/reader.h
1803 // //////////////////////////////////////////////////////////////////////
1804 
1805 
1806 
1807 
1808 
1809 
1810 // //////////////////////////////////////////////////////////////////////
1811 // Beginning of content of file: include/json/writer.h
1812 // //////////////////////////////////////////////////////////////////////
1813 
1814 // Copyright 2007-2010 Baptiste Lepilleur
1815 // Distributed under MIT license, or public domain if desired and
1816 // recognized in your jurisdiction.
1817 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
1818 
1819 #ifndef AWS_JSON_WRITER_H_INCLUDED
1820 #define AWS_JSON_WRITER_H_INCLUDED
1821 
1822 #if !defined(AWS_JSON_IS_AMALGAMATION)
1823 #include <value.h>
1824 #endif // if !defined(AWS_JSON_IS_AMALGAMATION)
1825 
1826 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
1827 // be used by...
1828 #if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1829 #pragma warning(push)
1830 #pragma warning(disable : 4251)
1831 #endif // if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1832 
1833 namespace Aws {
1834 namespace External {
1835 namespace Json {
1836 
1837 class Value;
1838 
1853 protected:
1854  Aws::OStream& sout_; // not owned; will not delete
1855 public:
1857  enum class CommentStyle {
1858  None,
1859  Most,
1860  All
1861  };
1862 
1864  StreamWriter(Aws::OStream* sout);
1865  virtual ~StreamWriter();
1869  virtual int write(Value const& root) = 0;
1870 
1874  public:
1875  virtual ~Factory();
1877  virtual StreamWriter* newStreamWriter(Aws::OStream* sout) const = 0;
1878  }; // Factory
1879 }; // StreamWriter
1880 
1882 Aws::String writeString(Value const& root, StreamWriter::Factory const& factory);
1883 
1884 
1900 public:
1901  // Note: We cannot add data-members to this class without a major version bump.
1902  // So these might as well be completely exposed.
1903 
1915 
1917 
1919  StreamWriter* newStreamWriter(Aws::OStream* sout) const;
1920 };
1921 
1936 {
1937 public:
1938  // Note: We cannot add data-members to this class without a major version bump.
1939  // So these might as well be completely exposed.
1940 
1959 
1961  : dropNullPlaceholders_(false)
1962  , omitEndingLineFeed_(false)
1963  , enableYAMLCompatibility_(false)
1964  {}
1965  virtual StreamWriter* newStreamWriter(Aws::OStream*) const;
1966 };
1967 
1972 public:
1973  virtual ~Writer();
1974 
1975  virtual Aws::String write(const Value& root) = 0;
1976 };
1977 
1988 public:
1989  FastWriter();
1990  virtual ~FastWriter() {}
1991 
1992  void enableYAMLCompatibility();
1993 
1999  void dropNullPlaceholders();
2000 
2001  void omitEndingLineFeed();
2002 
2003 public: // overridden from Writer
2004  virtual Aws::String write(const Value& root);
2005 
2006 private:
2007  void writeValue(const Value& value);
2008 
2009  Aws::String document_;
2010  bool yamlCompatiblityEnabled_;
2011  bool dropNullPlaceholders_;
2012  bool omitEndingLineFeed_;
2013 };
2014 
2040 public:
2041  StyledWriter();
2042  virtual ~StyledWriter() {}
2043 
2044 public: // overridden from Writer
2049  virtual Aws::String write(const Value& root);
2050 
2051 private:
2052  void writeValue(const Value& value);
2053  void writeArrayValue(const Value& value);
2054  bool isMultineArray(const Value& value);
2055  void pushValue(const Aws::String& value);
2056  void writeIndent();
2057  void writeWithIndent(const Aws::String& value);
2058  void indent();
2059  void unindent();
2060  void writeCommentBeforeValue(const Value& root);
2061  void writeCommentAfterValueOnSameLine(const Value& root);
2062  bool hasCommentForValue(const Value& value);
2063  static Aws::String normalizeEOL(const Aws::String& text);
2064 
2065  typedef Aws::Vector<Aws::String> ChildValues;
2066 
2067  ChildValues childValues_;
2068  Aws::String document_;
2069  Aws::String indentString_;
2070  int rightMargin_;
2071  int indentSize_;
2072  bool addChildValues_;
2073 };
2074 
2102 public:
2103  StyledStreamWriter(Aws::String indentation = "\t");
2105 
2106 public:
2113  void write(Aws::OStream& out, const Value& root);
2114 
2115 private:
2116  void writeValue(const Value& value);
2117  void writeArrayValue(const Value& value);
2118  bool isMultineArray(const Value& value);
2119  void pushValue(const Aws::String& value);
2120  void writeIndent();
2121  void writeWithIndent(const Aws::String& value);
2122  void indent();
2123  void unindent();
2124  void writeCommentBeforeValue(const Value& root);
2125  void writeCommentAfterValueOnSameLine(const Value& root);
2126  bool hasCommentForValue(const Value& value);
2127  static Aws::String normalizeEOL(const Aws::String& text);
2128 
2129  typedef Aws::Vector<Aws::String> ChildValues;
2130 
2131  ChildValues childValues_;
2132  Aws::OStream* document_;
2133  Aws::String indentString_;
2134  int rightMargin_;
2135  Aws::String indentation_;
2136  bool addChildValues_ : 1;
2137  bool indented_ : 1;
2138 };
2139 
2140 #if defined(AWS_JSON_HAS_INT64)
2143 #endif // if defined(AWS_JSON_HAS_INT64)
2146 Aws::String AWS_JSON_API valueToString(double value);
2148 Aws::String AWS_JSON_API valueToQuotedString(const char* value);
2149 
2153 
2154 } // namespace Json
2155 } // namespace External
2156 } // namespace Aws
2157 
2158 #if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
2159 #pragma warning(pop)
2160 #endif // if defined(AWS_JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
2161 
2162 #endif // AWS_JSON_WRITER_H_INCLUDED
2163 
2164 // //////////////////////////////////////////////////////////////////////
2165 // End of content of file: include/json/writer.h
2166 // //////////////////////////////////////////////////////////////////////
2167 
2168 
2169 
2170 
2171 
2172 
2173 // //////////////////////////////////////////////////////////////////////
2174 // Beginning of content of file: include/json/assertions.h
2175 // //////////////////////////////////////////////////////////////////////
2176 
2177 // Copyright 2007-2010 Baptiste Lepilleur
2178 // Distributed under MIT license, or public domain if desired and
2179 // recognized in your jurisdiction.
2180 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
2181 
2182 #ifndef AWS_CPPTL_JSON_ASSERTIONS_H_INCLUDED
2183 #define AWS_CPPTL_JSON_ASSERTIONS_H_INCLUDED
2184 
2185 #include <stdlib.h>
2186 #include <sstream>
2187 
2188 #if !defined(AWS_JSON_IS_AMALGAMATION)
2189 #include <config.h>
2190 #endif // if !defined(AWS_JSON_IS_AMALGAMATION)
2191 
2192 #if JSON_USE_EXCEPTION
2193 #include <stdexcept>
2194 #define AWS_JSON_ASSERT(condition) \
2195  assert(condition); // @todo <= change this into an exception throw
2196 #define AWS_JSON_FAIL_MESSAGE(message) do{Aws::OStringStream oss; oss << message; throw std::runtime_error(oss.str());}while(0)
2197 //#define AWS_JSON_FAIL_MESSAGE(message) throw std::runtime_error(message)
2198 #else // JSON_USE_EXCEPTION
2199 #define AWS_JSON_ASSERT(condition) assert(condition);
2200 
2201 // The call to assert() will show the failure message in debug builds. In
2202 // release bugs we abort, for a core-dump or debugger.
2203 #define AWS_JSON_FAIL_MESSAGE(message) \
2204  { \
2205  Aws::OStringStream oss; \
2206  oss << message; \
2207  assert(false && oss.str().c_str()); \
2208  abort(); \
2209  }
2210 
2211 
2212 #endif
2213 
2214 #define AWS_JSON_ASSERT_MESSAGE(condition, message) \
2215  if (!(condition)) { \
2216  AWS_JSON_FAIL_MESSAGE(message); \
2217  }
2218 
2219 #endif // AWS_CPPTL_JSON_ASSERTIONS_H_INCLUDED
2220 
2221 // //////////////////////////////////////////////////////////////////////
2222 // End of content of file: include/json/assertions.h
2223 // //////////////////////////////////////////////////////////////////////
2224 
2225 
2226 
2227 
2228 
2229 #endif //ifndef AWS_JSON_AMALGATED_H_INCLUDED
Aws::String AWS_JSON_API valueToQuotedString(const char *value)
CommentStyle
Decide whether to write comments.
Definition: json.h:1857
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
Definition: json.h:552
const char * c_str() const
Definition: json.h:476
Experimental and untested: represents an element of the "path" to access a node.
Definition: json.h:921
void swap(Aws::External::Json::Value &a, Aws::External::Json::Value &b)
Specialize std::swap() for Json::Value.
Definition: json.h:1502
Configuration passed to reader and writer. This configuration object can be used to force the Reader ...
Definition: json.h:334
difference_type operator-(const SelfType &other) const
Definition: json.h:1342
#define AWS_JSON_API
Definition: json.h:182
ValueConstIterator const_iterator
Definition: json.h:520
Writes a Value in JSON format in a human friendly way.
Definition: json.h:2039
#define AWS_JSONCPP_DEPRECATED(message)
Definition: json.h:209
bool omitEndingLineFeed_
Do not add at end of document. Normally, we add an extra newline, just because. ...
Definition: json.h:1950
bool dropNullPlaceholders_
Drop the "null" string from the writer&#39;s output for nullValues. Strictly speaking, this is not valid JSON. But when the output is being fed to a browser&#39;s Javascript, it makes for smaller output and the browser can handle the output just fine.
Definition: json.h:1946
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
Definition: json.h:2101
a comment placed on the line before a value
Definition: json.h:444
Int64 LargestInt
Definition: json.h:230
bool enableYAMLCompatibility_
Add a space after &#39;:&#39;. If indentation is non-empty, we surround colon with whitespace, e.g. " : " This will add back the trailing space when there is no indentation. This seems dubious when the entire document is on a single line, but we leave this here to repduce the behavior of the old FastWriter.
Definition: json.h:1958
Represents a JSON value.
Definition: json.h:511
bool operator!=(const SelfType &other) const
Definition: json.h:1340
const Char * Location
Definition: json.h:1556
STL namespace.
std::vector< T, Aws::Allocator< T > > Vector
Definition: AWSVector.h:27
std::bidirectional_iterator_tag iterator_category
Definition: json.h:1325
Json::UInt64 UInt64
Definition: json.h:524
unsigned long long int UInt64
Definition: json.h:228
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition: AWSMap.h:28
Iterator for object and array value.
Definition: json.h:1441
std::basic_istream< char, std::char_traits< char > > IStream
Definition: AWSStreamFwd.h:30
Json::ArrayIndex ArrayIndex
Definition: json.h:529
Outputs a Value in JSON format without formatting (not human friendly).
Definition: json.h:1987
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value.
Definition: json.h:535
bool allowComments_
true if comments are allowed. Default: true.
Definition: json.h:357
a comment just after a value on the same line
Definition: json.h:445
Aws::Vector< Aws::String > Members
Definition: json.h:518
array value (ordered list)
Definition: json.h:439
const iterator for object and array value.
Definition: json.h:1387
Json::LargestUInt LargestUInt
Definition: json.h:528
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
Definition: json.h:544
A simple abstract factory.
Definition: json.h:1873
pointer operator->() const
Definition: json.h:1492
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
Definition: json.h:550
unsigned int UInt
Definition: json.h:216
ValueIterator iterator
Definition: json.h:519
UTF-8 string value.
Definition: json.h:437
Aws::String writeString(Value const &root, StreamWriter::Factory const &factory)
Write into stringstream, then return string, for convenience.
Lightweight wrapper to tag static string.
Definition: json.h:470
base class for Value iterators.
Definition: json.h:1323
Aws::String AWS_JSON_API valueToString(Int value)
std::basic_ostream< char, std::char_traits< char > > OStream
Definition: AWSStreamFwd.h:31
An error tagged with where in the JSON text it was encountered.
Definition: json.h:1564
AWS_JSON_API Aws::OStream & operator<<(Aws::OStream &, const Value &root)
Output using the StyledStreamWriter.
Aws::String indentation_
Write in human-friendly style.
Definition: json.h:1914
std::deque< T, Aws::Allocator< T > > Deque
Definition: AWSDeque.h:27
Aws::Map< CZString, Value > ObjectValues
Definition: json.h:584
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value.
Definition: json.h:533
AWS_JSON_API Aws::IStream & operator>>(Aws::IStream &, Value &)
Read from &#39;sin&#39; into &#39;root&#39;.
Experimental and untested: represents a "path" to access a node.
Definition: json.h:952
std::stack< T, Deque< T > > Stack
Definition: AWSStack.h:29
reference operator*() const
Definition: json.h:1490
Json::LargestInt LargestInt
Definition: json.h:527
signed integer value
Definition: json.h:434
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value.
Definition: json.h:537
static const Value & null
Definition: json.h:531
bool operator==(const SelfType &other) const
Definition: json.h:1338
StreamWriter::CommentStyle cs_
How to write comments. Default: All.
Definition: json.h:1907
Build a StreamWriter implementation. Comments are not written, and most whitespace is omitted...
Definition: json.h:1935
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
long long int Int64
Definition: json.h:227
object value (collection of name/value pairs).
Definition: json.h:440
bool allowNumericKeys_
true if numeric object key are allowed. Default: false.
Definition: json.h:367
bool allowDroppedNullPlaceholders_
true if dropped null placeholders are allowed. Default: false.
Definition: json.h:364
UInt64 LargestUInt
Definition: json.h:231
StaticString(const char *czstring)
Definition: json.h:472
ValueType
Type of the value held by a Value object.
Definition: json.h:432
Abstract class for writers.
Definition: json.h:1971
unsigned integer value
Definition: json.h:435
&#39;null&#39; value
Definition: json.h:433
unsigned int ArrayIndex
Definition: json.h:277
static const Int minInt
Minimum signed int value that can be stored in a Json::Value.
Definition: json.h:540
Json::Int64 Int64
Definition: json.h:525
Build a StreamWriter implementation.
Definition: json.h:1899
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value.
Definition: json.h:542
JSON (JavaScript Object Notation).
void swap(Value &other)
Swap everything.
Unserialize a JSON document into a Value.
Definition: json.h:1553