Oxygine  1
2g game engine
json.h
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 Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim 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
19 The JsonCpp Authors, and is 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 and The JsonCpp Authors
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 // End of content of file: LICENSE
69 // //////////////////////////////////////////////////////////////////////
70 
71 
72 
73 
74 
75 #ifndef JSON_AMALGATED_H_INCLUDED
76 # define JSON_AMALGATED_H_INCLUDED
77 #define JSON_IS_AMALGAMATION
80 
81 // //////////////////////////////////////////////////////////////////////
82 // Beginning of content of file: include/json/version.h
83 // //////////////////////////////////////////////////////////////////////
84 
85 // DO NOT EDIT. This file (and "version") is generated by CMake.
86 // Run CMake configure step to update it.
87 #ifndef JSON_VERSION_H_INCLUDED
88 # define JSON_VERSION_H_INCLUDED
89 
90 # define JSONCPP_VERSION_STRING "1.8.3"
91 # define JSONCPP_VERSION_MAJOR 1
92 # define JSONCPP_VERSION_MINOR 8
93 # define JSONCPP_VERSION_PATCH 3
94 # define JSONCPP_VERSION_QUALIFIER
95 # define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
96 
97 #ifdef JSONCPP_USING_SECURE_MEMORY
98 #undef JSONCPP_USING_SECURE_MEMORY
99 #endif
100 #define JSONCPP_USING_SECURE_MEMORY 0
101 // If non-zero, the library zeroes any memory that it has allocated before
102 // it frees its memory.
103 
104 #endif // JSON_VERSION_H_INCLUDED
105 
106 // //////////////////////////////////////////////////////////////////////
107 // End of content of file: include/json/version.h
108 // //////////////////////////////////////////////////////////////////////
109 
110 
111 
112 #define JSONCPP_NO_LOCALE_SUPPORT
113 
114 
115 // //////////////////////////////////////////////////////////////////////
116 // Beginning of content of file: include/json/config.h
117 // //////////////////////////////////////////////////////////////////////
118 
119 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
120 // Distributed under MIT license, or public domain if desired and
121 // recognized in your jurisdiction.
122 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
123 
124 #ifndef JSON_CONFIG_H_INCLUDED
125 #define JSON_CONFIG_H_INCLUDED
126 #include <stddef.h>
127 #include <string> //typedef String
128 #include <stdint.h> //typedef int64_t, uint64_t
129 
131 //# define JSON_IN_CPPTL 1
132 
134 //# define JSON_USE_CPPTL 1
138 //# define JSON_USE_CPPTL_SMALLMAP 1
139 
140 // If non-zero, the library uses exceptions to report bad input instead of C
141 // assertion macros. The default is to use exceptions.
142 #ifndef JSON_USE_EXCEPTION
143 #define JSON_USE_EXCEPTION 1
144 #endif
145 
149 // #define JSON_IS_AMALGAMATION
150 
151 #ifdef JSON_IN_CPPTL
152 #include <cpptl/config.h>
153 #ifndef JSON_USE_CPPTL
154 #define JSON_USE_CPPTL 1
155 #endif
156 #endif
157 
158 #ifdef JSON_IN_CPPTL
159 #define JSON_API CPPTL_API
160 #elif defined(JSON_DLL_BUILD)
161 #if defined(_MSC_VER) || defined(__MINGW32__)
162 #define JSON_API __declspec(dllexport)
163 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
164 #endif // if defined(_MSC_VER)
165 #elif defined(JSON_DLL)
166 #if defined(_MSC_VER) || defined(__MINGW32__)
167 #define JSON_API __declspec(dllimport)
168 #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
169 #endif // if defined(_MSC_VER)
170 #endif // ifdef JSON_IN_CPPTL
171 #if !defined(JSON_API)
172 #define JSON_API
173 #endif
174 
175 // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
176 // integer
177 // Storages, and 64 bits integer support is disabled.
178 // #define JSON_NO_INT64 1
179 
180 #if defined(_MSC_VER) // MSVC
181 # if _MSC_VER <= 1200 // MSVC 6
182 // Microsoft Visual Studio 6 only support conversion from __int64 to double
183 // (no conversion from unsigned __int64).
184 # define JSON_USE_INT64_DOUBLE_CONVERSION 1
185 // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
186 // characters in the debug information)
187 // All projects I've ever seen with VS6 were using this globally (not bothering
188 // with pragma push/pop).
189 # pragma warning(disable : 4786)
190 # endif // MSVC 6
191 
192 # if _MSC_VER >= 1500 // MSVC 2008
193 # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
195 # endif
196 
197 #endif // defined(_MSC_VER)
198 
199 // In c++11 the override keyword allows you to explicity define that a function
200 // is intended to override the base-class version. This makes the code more
201 // managable and fixes a set of common hard-to-find bugs.
202 #if __cplusplus >= 201103L
203 # define JSONCPP_OVERRIDE override
204 # define JSONCPP_NOEXCEPT noexcept
205 #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
206 # define JSONCPP_OVERRIDE override
207 # define JSONCPP_NOEXCEPT throw()
208 #elif defined(_MSC_VER) && _MSC_VER >= 1900
209 # define JSONCPP_OVERRIDE override
210 # define JSONCPP_NOEXCEPT noexcept
211 #else
212 # define JSONCPP_OVERRIDE
213 # define JSONCPP_NOEXCEPT throw()
214 #endif
215 
216 #ifndef JSON_HAS_RVALUE_REFERENCES
217 
218 #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
219 #define JSON_HAS_RVALUE_REFERENCES 1
220 #endif // MSVC >= 2010
221 
222 #ifdef __clang__
223 #if __has_feature(cxx_rvalue_references)
224 #define JSON_HAS_RVALUE_REFERENCES 1
225 #endif // has_feature
226 
227 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
228 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
229 #define JSON_HAS_RVALUE_REFERENCES 1
230 #endif // GXX_EXPERIMENTAL
231 
232 #endif // __clang__ || __GNUC__
233 
234 #endif // not defined JSON_HAS_RVALUE_REFERENCES
235 
236 #ifndef JSON_HAS_RVALUE_REFERENCES
237 #define JSON_HAS_RVALUE_REFERENCES 0
238 #endif
239 
240 #ifdef __clang__
241 # if __has_extension(attribute_deprecated_with_message)
242 # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
243 # endif
244 #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
245 # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
246 # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
247 # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
248 # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
249 # endif // GNUC version
250 #endif // __clang__ || __GNUC__
251 
252 #if !defined(JSONCPP_DEPRECATED)
253 #define JSONCPP_DEPRECATED(message)
254 #endif // if !defined(JSONCPP_DEPRECATED)
255 
256 #if __GNUC__ >= 6
257 # define JSON_USE_INT64_DOUBLE_CONVERSION 1
258 #endif
259 
260 #if !defined(JSON_IS_AMALGAMATION)
261 
262 # include "version.h"
263 
264 # if JSONCPP_USING_SECURE_MEMORY
265 # include "allocator.h" //typedef Allocator
266 # endif
267 
268 #endif // if !defined(JSON_IS_AMALGAMATION)
269 
270 namespace Json
271 {
272  typedef int Int;
273  typedef unsigned int UInt;
274 #if defined(JSON_NO_INT64)
275  typedef int LargestInt;
276  typedef unsigned int LargestUInt;
277 #undef JSON_HAS_INT64
278 #else // if defined(JSON_NO_INT64)
279 // For Microsoft Visual use specific types as long long is not supported
280 #if defined(_MSC_VER) // Microsoft Visual Studio
281  typedef __int64 Int64;
282  typedef unsigned __int64 UInt64;
283 #else // if defined(_MSC_VER) // Other platforms, use long long
284  typedef int64_t Int64;
285  typedef uint64_t UInt64;
286 #endif // if defined(_MSC_VER)
287  typedef Int64 LargestInt;
288  typedef UInt64 LargestUInt;
289 #define JSON_HAS_INT64
290 #endif // if defined(JSON_NO_INT64)
291 #if JSONCPP_USING_SECURE_MEMORY
292 #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
293 #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
294 #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
295 #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
296 #define JSONCPP_ISTREAM std::istream
297 #else
298 #define JSONCPP_STRING std::string
299 #define JSONCPP_OSTRINGSTREAM std::ostringstream
300 #define JSONCPP_OSTREAM std::ostream
301 #define JSONCPP_ISTRINGSTREAM std::istringstream
302 #define JSONCPP_ISTREAM std::istream
303 #endif // if JSONCPP_USING_SECURE_MEMORY
304 } // end namespace Json
305 
306 #endif // JSON_CONFIG_H_INCLUDED
307 
308 // //////////////////////////////////////////////////////////////////////
309 // End of content of file: include/json/config.h
310 // //////////////////////////////////////////////////////////////////////
311 
312 
313 
314 
315 
316 
317 // //////////////////////////////////////////////////////////////////////
318 // Beginning of content of file: include/json/forwards.h
319 // //////////////////////////////////////////////////////////////////////
320 
321 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
322 // Distributed under MIT license, or public domain if desired and
323 // recognized in your jurisdiction.
324 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
325 
326 #ifndef JSON_FORWARDS_H_INCLUDED
327 #define JSON_FORWARDS_H_INCLUDED
328 
329 #if !defined(JSON_IS_AMALGAMATION)
330 #include "config.h"
331 #endif // if !defined(JSON_IS_AMALGAMATION)
332 
333 namespace Json
334 {
335 
336 // writer.h
337  class FastWriter;
338  class StyledWriter;
339 
340 // reader.h
341  class Reader;
342 
343 // features.h
344  class Features;
345 
346 // value.h
347  typedef unsigned int ArrayIndex;
348  class StaticString;
349  class Path;
350  class PathArgument;
351  class Value;
352  class ValueIteratorBase;
353  class ValueIterator;
354  class ValueConstIterator;
355 
356 } // namespace Json
357 
358 #endif // JSON_FORWARDS_H_INCLUDED
359 
360 // //////////////////////////////////////////////////////////////////////
361 // End of content of file: include/json/forwards.h
362 // //////////////////////////////////////////////////////////////////////
363 
364 
365 
366 
367 
368 
369 // //////////////////////////////////////////////////////////////////////
370 // Beginning of content of file: include/json/features.h
371 // //////////////////////////////////////////////////////////////////////
372 
373 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
374 // Distributed under MIT license, or public domain if desired and
375 // recognized in your jurisdiction.
376 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
377 
378 #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
379 #define CPPTL_JSON_FEATURES_H_INCLUDED
380 
381 #if !defined(JSON_IS_AMALGAMATION)
382 #include "forwards.h"
383 #endif // if !defined(JSON_IS_AMALGAMATION)
384 
385 #pragma pack(push, 8)
386 
387 namespace Json
388 {
389 
394  class JSON_API Features
395  {
396  public:
403  static Features all();
404 
411  static Features strictMode();
412 
415  Features();
416 
419 
423 
426 
429  };
430 
431 } // namespace Json
432 
433 #pragma pack(pop)
434 
435 #endif // CPPTL_JSON_FEATURES_H_INCLUDED
436 
437 // //////////////////////////////////////////////////////////////////////
438 // End of content of file: include/json/features.h
439 // //////////////////////////////////////////////////////////////////////
440 
441 
442 
443 
444 
445 
446 // //////////////////////////////////////////////////////////////////////
447 // Beginning of content of file: include/json/value.h
448 // //////////////////////////////////////////////////////////////////////
449 
450 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
451 // Distributed under MIT license, or public domain if desired and
452 // recognized in your jurisdiction.
453 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
454 
455 #ifndef CPPTL_JSON_H_INCLUDED
456 #define CPPTL_JSON_H_INCLUDED
457 
458 #if !defined(JSON_IS_AMALGAMATION)
459 #include "forwards.h"
460 #endif // if !defined(JSON_IS_AMALGAMATION)
461 #include <string>
462 #include <vector>
463 #include <exception>
464 
465 #ifndef JSON_USE_CPPTL_SMALLMAP
466 #include <map>
467 #else
468 #include <cpptl/smallmap.h>
469 #endif
470 #ifdef JSON_USE_CPPTL
471 #include <cpptl/forwards.h>
472 #endif
473 
474 //Conditional NORETURN attribute on the throw functions would:
475 // a) suppress false positives from static code analysis
476 // b) possibly improve optimization opportunities.
477 #if !defined(JSONCPP_NORETURN)
478 # if defined(_MSC_VER)
479 # define JSONCPP_NORETURN __declspec(noreturn)
480 # elif defined(__GNUC__)
481 # define JSONCPP_NORETURN __attribute__ ((__noreturn__))
482 # else
483 # define JSONCPP_NORETURN
484 # endif
485 #endif
486 
487 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
488 // be used by...
489 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
490 #pragma warning(push)
491 #pragma warning(disable : 4251)
492 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
493 
494 #pragma pack(push, 8)
495 
498 namespace Json
499 {
500 
505  class JSON_API Exception : public std::exception
506  {
507  public:
508  Exception(JSONCPP_STRING const& msg);
509  ~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
510  char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
511  protected:
512  JSONCPP_STRING msg_;
513  };
514 
521  class JSON_API RuntimeError : public Exception
522  {
523  public:
524  RuntimeError(JSONCPP_STRING const& msg);
525  };
526 
533  class JSON_API LogicError : public Exception
534  {
535  public:
536  LogicError(JSONCPP_STRING const& msg);
537  };
538 
540  JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg);
542  JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg);
543 
547  {
548  nullValue = 0,
556  };
557 
559  {
565  };
566 
567 //# ifdef JSON_USE_CPPTL
568 // typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
569 // typedef CppTL::AnyEnumerator<const Value &> EnumValues;
570 //# endif
571 
586  class JSON_API StaticString
587  {
588  public:
589  explicit StaticString(const char* czstring) : c_str_(czstring) {}
590 
591  operator const char* () const { return c_str_; }
592 
593  const char* c_str() const { return c_str_; }
594 
595  private:
596  const char* c_str_;
597  };
598 
633  class JSON_API Value
634  {
635  friend class ValueIteratorBase;
636  public:
637  typedef std::vector<JSONCPP_STRING> Members;
638  typedef ValueIterator iterator;
640  typedef Json::UInt UInt;
641  typedef Json::Int Int;
642 #if defined(JSON_HAS_INT64)
643  typedef Json::UInt64 UInt64;
644  typedef Json::Int64 Int64;
645 #endif // defined(JSON_HAS_INT64)
646  typedef Json::LargestInt LargestInt;
647  typedef Json::LargestUInt LargestUInt;
648  typedef Json::ArrayIndex ArrayIndex;
649 
650  static const Value& null;
651  static const Value& nullRef;
652  static Value const& nullSingleton();
653 
655  static const LargestInt minLargestInt;
657  static const LargestInt maxLargestInt;
659  static const LargestUInt maxLargestUInt;
660 
662  static const Int minInt;
664  static const Int maxInt;
666  static const UInt maxUInt;
667 
668 #if defined(JSON_HAS_INT64)
669  static const Int64 minInt64;
672  static const Int64 maxInt64;
674  static const UInt64 maxUInt64;
675 #endif // defined(JSON_HAS_INT64)
676 
677  private:
678 #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
679  class CZString
680  {
681  public:
682  enum DuplicationPolicy
683  {
684  noDuplication = 0,
685  duplicate,
686  duplicateOnCopy
687  };
688  CZString(ArrayIndex index);
689  CZString(char const* str, unsigned length, DuplicationPolicy allocate);
690  CZString(CZString const& other);
691 #if JSON_HAS_RVALUE_REFERENCES
692  CZString(CZString&& other);
693 #endif
694  ~CZString();
695  CZString& operator=(const CZString& other);
696 
697 #if JSON_HAS_RVALUE_REFERENCES
698  CZString& operator=(CZString&& other);
699 #endif
700 
701  bool operator<(CZString const& other) const;
702  bool operator==(CZString const& other) const;
703  ArrayIndex index() const;
704  //const char* c_str() const; ///< \deprecated
705  char const* data() const;
706  unsigned length() const;
707  bool isStaticString() const;
708 
709  private:
710  void swap(CZString& other);
711 
712  struct StringStorage
713  {
714  unsigned policy_: 2;
715  unsigned length_: 30; // 1GB max
716  };
717 
718  char const* cstr_; // actually, a prefixed string, unless policy is noDup
719  union
720  {
721  ArrayIndex index_;
722  StringStorage storage_;
723  };
724  };
725 
726  public:
727 #ifndef JSON_USE_CPPTL_SMALLMAP
728  typedef std::map<CZString, Value> ObjectValues;
729 #else
730  typedef CppTL::SmallMap<CZString, Value> ObjectValues;
731 #endif // ifndef JSON_USE_CPPTL_SMALLMAP
732 #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
733 
734  public:
750  Value(ValueType type = nullValue);
751  Value(Int value);
752  Value(UInt value);
753 #if defined(JSON_HAS_INT64)
754  Value(Int64 value);
755  Value(UInt64 value);
756 #endif // if defined(JSON_HAS_INT64)
757  Value(double value);
758  Value(const char* value);
759  Value(const char* begin, const char* end);
760 
775  Value(const StaticString& value);
776  Value(const JSONCPP_STRING& value);
777 #ifdef JSON_USE_CPPTL
778  Value(const CppTL::ConstString& value);
779 #endif
780  Value(bool value);
782  Value(const Value& other);
783 #if JSON_HAS_RVALUE_REFERENCES
784  Value(Value&& other);
786 #endif
787  ~Value();
788 
791  Value& operator=(Value other);
792 
794  void swap(Value& other);
796  void swapPayload(Value& other);
797 
799  void copy(const Value& other);
801  void copyPayload(const Value& other);
802 
803  ValueType type() const;
804 
806  bool operator<(const Value& other) const;
807  bool operator<=(const Value& other) const;
808  bool operator>=(const Value& other) const;
809  bool operator>(const Value& other) const;
810  bool operator==(const Value& other) const;
811  bool operator!=(const Value& other) const;
812  int compare(const Value& other) const;
813 
814  const char* asCString() const;
815 #if JSONCPP_USING_SECURE_MEMORY
816  unsigned getCStringLength() const; //Allows you to understand the length of the CString
817 #endif
818  JSONCPP_STRING asString() const;
819 
822  bool getString(
823  char const** begin, char const** end) const;
824 #ifdef JSON_USE_CPPTL
825  CppTL::ConstString asConstString() const;
826 #endif
827  Int asInt() const;
828  UInt asUInt() const;
829 #if defined(JSON_HAS_INT64)
830  Int64 asInt64() const;
831  UInt64 asUInt64() const;
832 #endif // if defined(JSON_HAS_INT64)
833  LargestInt asLargestInt() const;
834  LargestUInt asLargestUInt() const;
835  float asFloat() const;
836  double asDouble() const;
837  bool asBool() const;
838 
839  bool isNull() const;
840  bool isBool() const;
841  bool isInt() const;
842  bool isInt64() const;
843  bool isUInt() const;
844  bool isUInt64() const;
845  bool isIntegral() const;
846  bool isDouble() const;
847  bool isNumeric() const;
848  bool isString() const;
849  bool isArray() const;
850  bool isObject() const;
851 
852  bool isConvertibleTo(ValueType other) const;
853 
855  ArrayIndex size() const;
856 
859  bool empty() const;
860 
862  bool operator!() const;
863 
867  void clear();
868 
874  void resize(ArrayIndex size);
875 
882  Value& operator[](ArrayIndex index);
883 
890  Value& operator[](int index);
891 
895  const Value& operator[](ArrayIndex index) const;
896 
900  const Value& operator[](int index) const;
901 
905  Value get(ArrayIndex index, const Value& defaultValue) const;
907  bool isValidIndex(ArrayIndex index) const;
911  Value& append(const Value& value);
912 
913 #if JSON_HAS_RVALUE_REFERENCES
914  Value& append(Value&& value);
915 #endif
916 
920  Value& operator[](const char* key);
923  const Value& operator[](const char* key) const;
926  Value& operator[](const JSONCPP_STRING& key);
930  const Value& operator[](const JSONCPP_STRING& key) const;
943  Value& operator[](const StaticString& key);
944 #ifdef JSON_USE_CPPTL
945  Value& operator[](const CppTL::ConstString& key);
949  const Value& operator[](const CppTL::ConstString& key) const;
950 #endif
951  Value get(const char* key, const Value& defaultValue) const;
957  Value get(const char* begin, const char* end, const Value& defaultValue) const;
961  Value get(const JSONCPP_STRING& key, const Value& defaultValue) const;
962 #ifdef JSON_USE_CPPTL
963  Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
966 #endif
967  Value const* find(char const* begin, char const* end) const;
974  Value const* demand(char const* begin, char const* end);
982  JSONCPP_DEPRECATED("")
983  Value removeMember(const char* key);
987  JSONCPP_DEPRECATED("")
988  Value removeMember(const JSONCPP_STRING& key);
991  bool removeMember(const char* key, Value* removed);
998  bool removeMember(JSONCPP_STRING const& key, Value* removed);
1000  bool removeMember(const char* begin, const char* end, Value* removed);
1007  bool removeIndex(ArrayIndex i, Value* removed);
1008 
1011  bool isMember(const char* key) const;
1014  bool isMember(const JSONCPP_STRING& key) const;
1016  bool isMember(const char* begin, const char* end) const;
1017 #ifdef JSON_USE_CPPTL
1018  bool isMember(const CppTL::ConstString& key) const;
1020 #endif
1021 
1027  Members getMemberNames() const;
1028 
1029  //# ifdef JSON_USE_CPPTL
1030  // EnumMemberNames enumMemberNames() const;
1031  // EnumValues enumValues() const;
1032  //# endif
1033 
1035  JSONCPP_DEPRECATED("Use setComment(JSONCPP_STRING const&) instead.")
1036  void setComment(const char* comment, CommentPlacement placement);
1038  void setComment(const char* comment, size_t len, CommentPlacement placement);
1040  void setComment(const JSONCPP_STRING& comment, CommentPlacement placement);
1041  bool hasComment(CommentPlacement placement) const;
1043  JSONCPP_STRING getComment(CommentPlacement placement) const;
1044 
1045  JSONCPP_STRING toStyledString() const;
1046 
1047  const_iterator begin() const;
1048  const_iterator end() const;
1049 
1050  iterator begin();
1051  iterator end();
1052 
1053  // Accessors for the [start, limit) range of bytes within the JSON text from
1054  // which this value was parsed, if any.
1055  void setOffsetStart(ptrdiff_t start);
1056  void setOffsetLimit(ptrdiff_t limit);
1057  ptrdiff_t getOffsetStart() const;
1058  ptrdiff_t getOffsetLimit() const;
1059 
1060  private:
1061  void initBasic(ValueType type, bool allocated = false);
1062 
1063  Value& resolveReference(const char* key);
1064  Value& resolveReference(const char* key, const char* end);
1065 
1066  struct CommentInfo
1067  {
1068  CommentInfo();
1069  ~CommentInfo();
1070 
1071  void setComment(const char* text, size_t len);
1072 
1073  char* comment_;
1074  };
1075 
1076  // struct MemberNamesTransform
1077  //{
1078  // typedef const char *result_type;
1079  // const char *operator()( const CZString &name ) const
1080  // {
1081  // return name.c_str();
1082  // }
1083  //};
1084 
1085  union ValueHolder
1086  {
1087  LargestInt int_;
1088  LargestUInt uint_;
1089  double real_;
1090  bool bool_;
1091  char* string_; // actually ptr to unsigned, followed by str, unless !allocated_
1092  ObjectValues* map_;
1093  } value_;
1094  ValueType type_ : 8;
1095  unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
1096  // If not allocated_, string_ must be null-terminated.
1097  CommentInfo* comments_;
1098 
1099  // [start, limit) byte offsets in the source JSON text from which this Value
1100  // was extracted.
1101  ptrdiff_t start_;
1102  ptrdiff_t limit_;
1103  };
1104 
1108  class JSON_API PathArgument
1109  {
1110  public:
1111  friend class Path;
1112 
1113  PathArgument();
1114  PathArgument(ArrayIndex index);
1115  PathArgument(const char* key);
1116  PathArgument(const JSONCPP_STRING& key);
1117 
1118  private:
1119  enum Kind
1120  {
1121  kindNone = 0,
1122  kindIndex,
1123  kindKey
1124  };
1125  JSONCPP_STRING key_;
1126  ArrayIndex index_;
1127  Kind kind_;
1128  };
1129 
1141  class JSON_API Path
1142  {
1143  public:
1144  Path(const JSONCPP_STRING& path,
1145  const PathArgument& a1 = PathArgument(),
1146  const PathArgument& a2 = PathArgument(),
1147  const PathArgument& a3 = PathArgument(),
1148  const PathArgument& a4 = PathArgument(),
1149  const PathArgument& a5 = PathArgument());
1150 
1151  const Value& resolve(const Value& root) const;
1152  Value resolve(const Value& root, const Value& defaultValue) const;
1155  Value& make(Value& root) const;
1156 
1157  private:
1158  typedef std::vector<const PathArgument*> InArgs;
1159  typedef std::vector<PathArgument> Args;
1160 
1161  void makePath(const JSONCPP_STRING& path, const InArgs& in);
1162  void addPathInArg(const JSONCPP_STRING& path,
1163  const InArgs& in,
1164  InArgs::const_iterator& itInArg,
1165  PathArgument::Kind kind);
1166  void invalidPath(const JSONCPP_STRING& path, int location);
1167 
1168  Args args_;
1169  };
1170 
1174  class JSON_API ValueIteratorBase
1175  {
1176  public:
1177  typedef std::bidirectional_iterator_tag iterator_category;
1178  typedef unsigned int size_t;
1179  typedef int difference_type;
1180  typedef ValueIteratorBase SelfType;
1181 
1182  bool operator==(const SelfType& other) const { return isEqual(other); }
1183 
1184  bool operator!=(const SelfType& other) const { return !isEqual(other); }
1185 
1186  difference_type operator-(const SelfType& other) const
1187  {
1188  return other.computeDistance(*this);
1189  }
1190 
1193  Value key() const;
1194 
1196  UInt index() const;
1197 
1201  JSONCPP_STRING name() const;
1202 
1206  JSONCPP_DEPRECATED("Use `key = name();` instead.")
1207  char const* memberName() const;
1211  char const* memberName(char const** end) const;
1212 
1213  protected:
1214  Value& deref() const;
1215 
1216  void increment();
1217 
1218  void decrement();
1219 
1220  difference_type computeDistance(const SelfType& other) const;
1221 
1222  bool isEqual(const SelfType& other) const;
1223 
1224  void copy(const SelfType& other);
1225 
1226  private:
1227  Value::ObjectValues::iterator current_;
1228  // Indicates that iterator is for a null value.
1229  bool isNull_;
1230 
1231  public:
1232  // For some reason, BORLAND needs these at the end, rather
1233  // than earlier. No idea why.
1235  explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
1236  };
1237 
1241  class JSON_API ValueConstIterator : public ValueIteratorBase
1242  {
1243  friend class Value;
1244 
1245  public:
1246  typedef const Value value_type;
1247  //typedef unsigned int size_t;
1248  //typedef int difference_type;
1249  typedef const Value& reference;
1250  typedef const Value* pointer;
1251  typedef ValueConstIterator SelfType;
1252 
1254  ValueConstIterator(ValueIterator const& other);
1255 
1256  private:
1259  explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
1260  public:
1261  SelfType& operator=(const ValueIteratorBase& other);
1262 
1263  SelfType operator++(int)
1264  {
1265  SelfType temp(*this);
1266  ++*this;
1267  return temp;
1268  }
1269 
1270  SelfType operator--(int)
1271  {
1272  SelfType temp(*this);
1273  --*this;
1274  return temp;
1275  }
1276 
1277  SelfType& operator--()
1278  {
1279  decrement();
1280  return *this;
1281  }
1282 
1283  SelfType& operator++()
1284  {
1285  increment();
1286  return *this;
1287  }
1288 
1289  reference operator*() const { return deref(); }
1290 
1291  pointer operator->() const { return &deref(); }
1292  };
1293 
1296  class JSON_API ValueIterator : public ValueIteratorBase
1297  {
1298  friend class Value;
1299 
1300  public:
1301  typedef Value value_type;
1302  typedef unsigned int size_t;
1303  typedef int difference_type;
1304  typedef Value& reference;
1305  typedef Value* pointer;
1306  typedef ValueIterator SelfType;
1307 
1308  ValueIterator();
1309  explicit ValueIterator(const ValueConstIterator& other);
1310  ValueIterator(const ValueIterator& other);
1311 
1312  private:
1315  explicit ValueIterator(const Value::ObjectValues::iterator& current);
1316  public:
1317  SelfType& operator=(const SelfType& other);
1318 
1319  SelfType operator++(int)
1320  {
1321  SelfType temp(*this);
1322  ++*this;
1323  return temp;
1324  }
1325 
1326  SelfType operator--(int)
1327  {
1328  SelfType temp(*this);
1329  --*this;
1330  return temp;
1331  }
1332 
1333  SelfType& operator--()
1334  {
1335  decrement();
1336  return *this;
1337  }
1338 
1339  SelfType& operator++()
1340  {
1341  increment();
1342  return *this;
1343  }
1344 
1345  reference operator*() const { return deref(); }
1346 
1347  pointer operator->() const { return &deref(); }
1348  };
1349 
1350 } // namespace Json
1351 
1352 
1353 namespace std
1354 {
1356  template<>
1357  inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
1358 }
1359 
1360 #pragma pack(pop)
1361 
1362 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1363 #pragma warning(pop)
1364 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1365 
1366 #endif // CPPTL_JSON_H_INCLUDED
1367 
1368 // //////////////////////////////////////////////////////////////////////
1369 // End of content of file: include/json/value.h
1370 // //////////////////////////////////////////////////////////////////////
1371 
1372 
1373 
1374 
1375 
1376 
1377 // //////////////////////////////////////////////////////////////////////
1378 // Beginning of content of file: include/json/reader.h
1379 // //////////////////////////////////////////////////////////////////////
1380 
1381 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
1382 // Distributed under MIT license, or public domain if desired and
1383 // recognized in your jurisdiction.
1384 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
1385 
1386 #ifndef CPPTL_JSON_READER_H_INCLUDED
1387 #define CPPTL_JSON_READER_H_INCLUDED
1388 
1389 #if !defined(JSON_IS_AMALGAMATION)
1390 #include "features.h"
1391 #include "value.h"
1392 #endif // if !defined(JSON_IS_AMALGAMATION)
1393 #include <deque>
1394 #include <iosfwd>
1395 #include <stack>
1396 #include <string>
1397 #include <istream>
1398 
1399 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
1400 // be used by...
1401 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1402 #pragma warning(push)
1403 #pragma warning(disable : 4251)
1404 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1405 
1406 #pragma pack(push, 8)
1407 
1408 namespace Json
1409 {
1410 
1416  class /*JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead")*/ JSON_API Reader
1417  {
1418  public:
1419  typedef char Char;
1420  typedef const Char* Location;
1421 
1429  {
1430  ptrdiff_t offset_start;
1431  ptrdiff_t offset_limit;
1432  JSONCPP_STRING message;
1433  };
1434 
1438  Reader();
1439 
1443  Reader(const Features& features);
1444 
1459  bool
1460  parse(const std::string& document, Value& root, bool collectComments = true);
1461 
1480  bool parse(const char* beginDoc,
1481  const char* endDoc,
1482  Value& root,
1483  bool collectComments = true);
1484 
1487  bool parse(JSONCPP_ISTREAM& is, Value& root, bool collectComments = true);
1488 
1498  JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
1499  JSONCPP_STRING getFormatedErrorMessages() const;
1500 
1509  JSONCPP_STRING getFormattedErrorMessages() const;
1510 
1518  std::vector<StructuredError> getStructuredErrors() const;
1519 
1526  bool pushError(const Value& value, const JSONCPP_STRING& message);
1527 
1535  bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
1536 
1541  bool good() const;
1542 
1543  private:
1544  enum TokenType
1545  {
1546  tokenEndOfStream = 0,
1547  tokenObjectBegin,
1548  tokenObjectEnd,
1549  tokenArrayBegin,
1550  tokenArrayEnd,
1551  tokenString,
1552  tokenNumber,
1553  tokenTrue,
1554  tokenFalse,
1555  tokenNull,
1556  tokenArraySeparator,
1557  tokenMemberSeparator,
1558  tokenComment,
1559  tokenError
1560  };
1561 
1562  class Token
1563  {
1564  public:
1565  TokenType type_;
1566  Location start_;
1567  Location end_;
1568  };
1569 
1570  class ErrorInfo
1571  {
1572  public:
1573  Token token_;
1574  JSONCPP_STRING message_;
1575  Location extra_;
1576  };
1577 
1578  typedef std::deque<ErrorInfo> Errors;
1579 
1580  bool readToken(Token& token);
1581  void skipSpaces();
1582  bool match(Location pattern, int patternLength);
1583  bool readComment();
1584  bool readCStyleComment();
1585  bool readCppStyleComment();
1586  bool readString();
1587  void readNumber();
1588  bool readValue();
1589  bool readObject(Token& token);
1590  bool readArray(Token& token);
1591  bool decodeNumber(Token& token);
1592  bool decodeNumber(Token& token, Value& decoded);
1593  bool decodeString(Token& token);
1594  bool decodeString(Token& token, JSONCPP_STRING& decoded);
1595  bool decodeDouble(Token& token);
1596  bool decodeDouble(Token& token, Value& decoded);
1597  bool decodeUnicodeCodePoint(Token& token,
1598  Location& current,
1599  Location end,
1600  unsigned int& unicode);
1601  bool decodeUnicodeEscapeSequence(Token& token,
1602  Location& current,
1603  Location end,
1604  unsigned int& unicode);
1605  bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
1606  bool recoverFromError(TokenType skipUntilToken);
1607  bool addErrorAndRecover(const JSONCPP_STRING& message,
1608  Token& token,
1609  TokenType skipUntilToken);
1610  void skipUntilSpace();
1611  Value& currentValue();
1612  Char getNextChar();
1613  void
1614  getLocationLineAndColumn(Location location, int& line, int& column) const;
1615  JSONCPP_STRING getLocationLineAndColumn(Location location) const;
1616  void addComment(Location begin, Location end, CommentPlacement placement);
1617  void skipCommentTokens(Token& token);
1618 
1619  static bool containsNewLine(Location begin, Location end);
1620  static JSONCPP_STRING normalizeEOL(Location begin, Location end);
1621 
1622  typedef std::stack<Value*> Nodes;
1623  Nodes nodes_;
1624  Errors errors_;
1625  JSONCPP_STRING document_;
1626  Location begin_;
1627  Location end_;
1628  Location current_;
1629  Location lastValueEnd_;
1630  Value* lastValue_;
1631  JSONCPP_STRING commentsBefore_;
1632  Features features_;
1633  bool collectComments_;
1634  }; // Reader
1635 
1638  class JSON_API CharReader
1639  {
1640  public:
1641  virtual ~CharReader() {}
1659  virtual bool parse(
1660  char const* beginDoc, char const* endDoc,
1661  Value* root, JSONCPP_STRING* errs) = 0;
1662 
1663  class JSON_API Factory
1664  {
1665  public:
1666  virtual ~Factory() {}
1670  virtual CharReader* newCharReader() const = 0;
1671  }; // Factory
1672  }; // CharReader
1673 
1686  class JSON_API CharReaderBuilder : public CharReader::Factory
1687  {
1688  public:
1689  // Note: We use a Json::Value so that we can add data-members to this class
1690  // without a major version bump.
1728 
1730  ~CharReaderBuilder() JSONCPP_OVERRIDE;
1731 
1732  CharReader* newCharReader() const JSONCPP_OVERRIDE;
1733 
1737  bool validate(Json::Value* invalid) const;
1738 
1741  Value& operator[](JSONCPP_STRING key);
1742 
1748  static void setDefaults(Json::Value* settings);
1754  static void strictMode(Json::Value* settings);
1755  };
1756 
1761  bool JSON_API parseFromStream(
1762  CharReader::Factory const&,
1763  JSONCPP_ISTREAM&,
1764  Value* root, std::string* errs);
1765 
1790  JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
1791 
1792 } // namespace Json
1793 
1794 #pragma pack(pop)
1795 
1796 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1797 #pragma warning(pop)
1798 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1799 
1800 #endif // CPPTL_JSON_READER_H_INCLUDED
1801 
1802 // //////////////////////////////////////////////////////////////////////
1803 // End of content of file: include/json/reader.h
1804 // //////////////////////////////////////////////////////////////////////
1805 
1806 
1807 
1808 
1809 
1810 
1811 // //////////////////////////////////////////////////////////////////////
1812 // Beginning of content of file: include/json/writer.h
1813 // //////////////////////////////////////////////////////////////////////
1814 
1815 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
1816 // Distributed under MIT license, or public domain if desired and
1817 // recognized in your jurisdiction.
1818 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
1819 
1820 #ifndef JSON_WRITER_H_INCLUDED
1821 #define JSON_WRITER_H_INCLUDED
1822 
1823 #if !defined(JSON_IS_AMALGAMATION)
1824 #include "value.h"
1825 #endif // if !defined(JSON_IS_AMALGAMATION)
1826 #include <vector>
1827 #include <string>
1828 #include <ostream>
1829 
1830 // Disable warning C4251: <data member>: <type> needs to have dll-interface to
1831 // be used by...
1832 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1833 #pragma warning(push)
1834 #pragma warning(disable : 4251)
1835 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
1836 
1837 #pragma pack(push, 8)
1838 
1839 namespace Json
1840 {
1841 
1842  class Value;
1843 
1857  class JSON_API StreamWriter
1858  {
1859  protected:
1860  JSONCPP_OSTREAM* sout_; // not owned; will not delete
1861  public:
1862  StreamWriter();
1863  virtual ~StreamWriter();
1870  virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0;
1871 
1874  class JSON_API Factory
1875  {
1876  public:
1877  virtual ~Factory();
1881  virtual StreamWriter* newStreamWriter() const = 0;
1882  }; // Factory
1883  }; // StreamWriter
1884 
1888  JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, Value const& root);
1889 
1890 
1907  {
1908  public:
1909  // Note: We use a Json::Value so that we can add data-members to this class
1910  // without a major version bump.
1933 
1935  ~StreamWriterBuilder() JSONCPP_OVERRIDE;
1936 
1940  StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
1941 
1945  bool validate(Json::Value* invalid) const;
1948  Value& operator[](JSONCPP_STRING key);
1949 
1955  static void setDefaults(Json::Value* settings);
1956  };
1957 
1961  class /*JSONCPP_DEPRECATED("Use StreamWriter instead")*/ JSON_API Writer
1962  {
1963  public:
1964  virtual ~Writer();
1965 
1966  virtual JSONCPP_STRING write(const Value& root) = 0;
1967  };
1968 
1978  class /*JSONCPP_DEPRECATED("Use StreamWriterBuilder instead")*/ JSON_API FastWriter : public Writer
1979  {
1980 
1981  public:
1982  FastWriter();
1983  ~FastWriter() JSONCPP_OVERRIDE {}
1984 
1985  void enableYAMLCompatibility();
1986 
1992  void dropNullPlaceholders();
1993 
1994  void omitEndingLineFeed();
1995 
1996  public: // overridden from Writer
1997  JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
1998 
1999  private:
2000  void writeValue(const Value& value);
2001 
2002  JSONCPP_STRING document_;
2003  bool yamlCompatiblityEnabled_;
2004  bool dropNullPlaceholders_;
2005  bool omitEndingLineFeed_;
2006  };
2007 
2032  class /*JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") */ JSON_API StyledWriter : public Writer
2033  {
2034  public:
2035  StyledWriter();
2036  ~StyledWriter() JSONCPP_OVERRIDE {}
2037 
2038  public: // overridden from Writer
2043  JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
2044 
2045  private:
2046  void writeValue(const Value& value);
2047  void writeArrayValue(const Value& value);
2048  bool isMultineArray(const Value& value);
2049  void pushValue(const JSONCPP_STRING& value);
2050  void writeIndent();
2051  void writeWithIndent(const JSONCPP_STRING& value);
2052  void indent();
2053  void unindent();
2054  void writeCommentBeforeValue(const Value& root);
2055  void writeCommentAfterValueOnSameLine(const Value& root);
2056  bool hasCommentForValue(const Value& value);
2057  static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
2058 
2059  typedef std::vector<JSONCPP_STRING> ChildValues;
2060 
2061  ChildValues childValues_;
2062  JSONCPP_STRING document_;
2063  JSONCPP_STRING indentString_;
2064  unsigned int rightMargin_;
2065  unsigned int indentSize_;
2066  bool addChildValues_;
2067  };
2068 
2094  class /*JSONCPP_DEPRECATED("Use StreamWriterBuilder instead")*/ JSON_API StyledStreamWriter
2095  {
2096  public:
2100  StyledStreamWriter(JSONCPP_STRING indentation = "\t");
2101  ~StyledStreamWriter() {}
2102 
2103  public:
2110  void write(JSONCPP_OSTREAM& out, const Value& root);
2111 
2112  private:
2113  void writeValue(const Value& value);
2114  void writeArrayValue(const Value& value);
2115  bool isMultineArray(const Value& value);
2116  void pushValue(const JSONCPP_STRING& value);
2117  void writeIndent();
2118  void writeWithIndent(const JSONCPP_STRING& value);
2119  void indent();
2120  void unindent();
2121  void writeCommentBeforeValue(const Value& root);
2122  void writeCommentAfterValueOnSameLine(const Value& root);
2123  bool hasCommentForValue(const Value& value);
2124  static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
2125 
2126  typedef std::vector<JSONCPP_STRING> ChildValues;
2127 
2128  ChildValues childValues_;
2129  JSONCPP_OSTREAM* document_;
2130  JSONCPP_STRING indentString_;
2131  unsigned int rightMargin_;
2132  JSONCPP_STRING indentation_;
2133  bool addChildValues_ : 1;
2134  bool indented_ : 1;
2135  };
2136 
2137 #if defined(JSON_HAS_INT64)
2138  JSONCPP_STRING JSON_API valueToString(Int value);
2139  JSONCPP_STRING JSON_API valueToString(UInt value);
2140 #endif // if defined(JSON_HAS_INT64)
2141  JSONCPP_STRING JSON_API valueToString(LargestInt value);
2142  JSONCPP_STRING JSON_API valueToString(LargestUInt value);
2143  JSONCPP_STRING JSON_API valueToString(double value);
2144  JSONCPP_STRING JSON_API valueToString(bool value);
2145  JSONCPP_STRING JSON_API valueToQuotedString(const char* value);
2146 
2149  JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
2150 
2151 } // namespace Json
2152 
2153 #pragma pack(pop)
2154 
2155 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
2156 #pragma warning(pop)
2157 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
2158 
2159 #endif // JSON_WRITER_H_INCLUDED
2160 
2161 // //////////////////////////////////////////////////////////////////////
2162 // End of content of file: include/json/writer.h
2163 // //////////////////////////////////////////////////////////////////////
2164 
2165 
2166 
2167 
2168 
2169 
2170 // //////////////////////////////////////////////////////////////////////
2171 // Beginning of content of file: include/json/assertions.h
2172 // //////////////////////////////////////////////////////////////////////
2173 
2174 // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2175 // Distributed under MIT license, or public domain if desired and
2176 // recognized in your jurisdiction.
2177 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
2178 
2179 #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
2180 #define CPPTL_JSON_ASSERTIONS_H_INCLUDED
2181 
2182 #include <stdlib.h>
2183 #include <sstream>
2184 
2185 #if !defined(JSON_IS_AMALGAMATION)
2186 #include "config.h"
2187 #endif // if !defined(JSON_IS_AMALGAMATION)
2188 
2193 #if JSON_USE_EXCEPTION
2194 
2195 // @todo <= add detail about condition in exception
2196 # define JSON_ASSERT(condition) \
2197  {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
2198 
2199 # define JSON_FAIL_MESSAGE(message) \
2200  { \
2201  JSONCPP_OSTRINGSTREAM oss; oss << message; \
2202  Json::throwLogicError(oss.str()); \
2203  abort(); \
2204  }
2205 
2206 #else // JSON_USE_EXCEPTION
2207 
2208 # define JSON_ASSERT(condition) assert(condition)
2209 
2210 // The call to assert() will show the failure message in debug builds. In
2211 // release builds we abort, for a core-dump or debugger.
2212 # define JSON_FAIL_MESSAGE(message) \
2213  { \
2214  JSONCPP_OSTRINGSTREAM oss; oss << message; \
2215  assert(false && oss.str().c_str()); \
2216  abort(); \
2217  }
2218 
2219 
2220 #endif
2221 
2222 #define JSON_ASSERT_MESSAGE(condition, message) \
2223  if (!(condition)) { \
2224  JSON_FAIL_MESSAGE(message); \
2225  }
2226 
2227 #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
2228 
2229 // //////////////////////////////////////////////////////////////////////
2230 // End of content of file: include/json/assertions.h
2231 // //////////////////////////////////////////////////////////////////////
2232 
2233 
2234 
2235 
2236 
2237 #endif //ifndef JSON_AMALGATED_H_INCLUDED
Outputs a Value in JSON format without formatting (not human friendly).
Definition: json.h:1978
A simple abstract factory.
Definition: json.h:1874
Writes a Value in JSON format in a human friendly way.
Definition: json.h:2032
static const Value & null
We regret this reference to a global instance; prefer the simpler Value().
Definition: json.h:650
static const Int64 maxInt64
Maximum signed 64 bits int value that can be stored in a Json::Value.
Definition: json.h:672
base class for Value iterators.
Definition: json.h:1174
array value (ordered list)
Definition: json.h:554
static const Value & nullRef
just a kludge for binary-compatibility; same as null
Definition: json.h:651
JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const &msg)
used internally
unsigned integer value
Definition: json.h:550
Json::Value settings_
Definition: json.h:1727
root value)
Definition: json.h:564
Definition: json.h:1857
Definition: json.h:533
object value (collection of name/value pairs).
Definition: json.h:555
bool JSON_API parseFromStream(CharReader::Factory const &, JSONCPP_ISTREAM &, Value *root, std::string *errs)
static const Int maxInt
Maximum signed int value that can be stored in a Json::Value.
Definition: json.h:664
Definition: json.h:1353
Lightweight wrapper to tag static string.
Definition: json.h:586
static const UInt maxUInt
Maximum unsigned int value that can be stored in a Json::Value.
Definition: json.h:666
An error tagged with where in the JSON text it was encountered.
Definition: json.h:1428
const iterator for object and array value.
Definition: json.h:1241
Experimental and untested: represents an element of the "path" to access a node.
Definition: json.h:1108
static const LargestInt minLargestInt
Minimum signed integer value that can be stored in a Json::Value.
Definition: json.h:655
&#39;null&#39; value
Definition: json.h:548
bool allowComments_
true if comments are allowed. Default: true.
Definition: json.h:418
CommentPlacement
Definition: json.h:558
JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const &msg)
used internally
bool allowNumericKeys_
true if numeric object key are allowed. Default: false.
Definition: json.h:428
JSON (JavaScript Object Notation).
Definition: json-forwards.h:237
bool allowDroppedNullPlaceholders_
true if dropped null placeholders are allowed. Default: false.
Definition: json.h:425
void swap(Value &other)
Swap everything.
Experimental and untested: represents a "path" to access a node.
Definition: json.h:1141
static const UInt64 maxUInt64
Maximum unsigned 64 bits int value that can be stored in a Json::Value.
Definition: json.h:674
double value
Definition: json.h:551
JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience. A StreamWriter will be created from the...
Definition: json.h:1638
Json::Value settings_
Definition: json.h:1932
Abstract class for writers.
Definition: json.h:1961
Represents a JSON value.
Definition: json.h:633
JSON_API JSONCPP_OSTREAM & operator<<(JSONCPP_OSTREAM &, const Value &root)
Output using the StyledStreamWriter.
static const Int minInt
Minimum signed int value that can be stored in a Json::Value.
Definition: json.h:662
Definition: json.h:521
Definition: json.h:562
Unserialize a JSON document into a Value.
Definition: json.h:1416
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
Definition: json.h:2094
Iterator for object and array value.
Definition: json.h:1296
ValueType
Type of the value held by a Value object.
Definition: json.h:546
bool strictRoot_
Definition: json.h:422
bool value
Definition: json.h:553
signed integer value
Definition: json.h:549
Build a CharReader implementation.
Definition: json.h:1686
Definition: json.h:1663
Configuration passed to reader and writer. This configuration object can be used to force the Reader ...
Definition: json.h:394
a comment placed on the line before a value
Definition: json.h:560
UTF-8 string value.
Definition: json.h:552
a comment just after a value on the same line
Definition: json.h:561
Build a StreamWriter implementation.
Definition: json.h:1906
Definition: json.h:505
static const LargestInt maxLargestInt
Maximum signed integer value that can be stored in a Json::Value.
Definition: json.h:657
static const LargestUInt maxLargestUInt
Maximum unsigned integer value that can be stored in a Json::Value.
Definition: json.h:659