rt300@13: /// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/). rt300@13: /// It is intented to be used with #include rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: LICENSE rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: /* rt300@13: The JsonCpp library's source code, including accompanying documentation, rt300@13: tests and demonstration applications, are licensed under the following rt300@13: conditions... rt300@13: rt300@13: The author (Baptiste Lepilleur) explicitly disclaims copyright in all rt300@13: jurisdictions which recognize such a disclaimer. In such jurisdictions, rt300@13: this software is released into the Public Domain. rt300@13: rt300@13: In jurisdictions which do not recognize Public Domain property (e.g. Germany as of rt300@13: 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is rt300@13: released under the terms of the MIT License (see below). rt300@13: rt300@13: In jurisdictions which recognize Public Domain property, the user of this rt300@13: software may choose to accept it either as 1) Public Domain, 2) under the rt300@13: conditions of the MIT License (see below), or 3) under the terms of dual rt300@13: Public Domain/MIT License conditions described here, as they choose. rt300@13: rt300@13: The MIT License is about as close to Public Domain as a license can get, and is rt300@13: described in clear, concise terms at: rt300@13: rt300@13: http://en.wikipedia.org/wiki/MIT_License rt300@13: rt300@13: The full text of the MIT License follows: rt300@13: rt300@13: ======================================================================== rt300@13: Copyright (c) 2007-2010 Baptiste Lepilleur rt300@13: rt300@13: Permission is hereby granted, free of charge, to any person rt300@13: obtaining a copy of this software and associated documentation rt300@13: files (the "Software"), to deal in the Software without rt300@13: restriction, including without limitation the rights to use, copy, rt300@13: modify, merge, publish, distribute, sublicense, and/or sell copies rt300@13: of the Software, and to permit persons to whom the Software is rt300@13: furnished to do so, subject to the following conditions: rt300@13: rt300@13: The above copyright notice and this permission notice shall be rt300@13: included in all copies or substantial portions of the Software. rt300@13: rt300@13: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, rt300@13: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF rt300@13: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND rt300@13: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS rt300@13: BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN rt300@13: ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN rt300@13: CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE rt300@13: SOFTWARE. rt300@13: ======================================================================== rt300@13: (END LICENSE TEXT) rt300@13: rt300@13: The MIT license is compatible with both the GPL and commercial rt300@13: software, affording one all of the rights of Public Domain with the rt300@13: minor nuisance of being required to keep the above copyright notice rt300@13: and license text in the source code. Note also that by accepting the rt300@13: Public Domain "license" you can re-license your copy using whatever rt300@13: license you like. rt300@13: rt300@13: */ rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: LICENSE rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: #ifndef JSON_AMALGATED_H_INCLUDED rt300@13: # define JSON_AMALGATED_H_INCLUDED rt300@13: /// If defined, indicates that the source file is amalgated rt300@13: /// to prevent private header inclusion. rt300@13: #define JSON_IS_AMALGAMATION rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: include/json/config.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: // Copyright 2007-2010 Baptiste Lepilleur rt300@13: // Distributed under MIT license, or public domain if desired and rt300@13: // recognized in your jurisdiction. rt300@13: // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE rt300@13: rt300@13: #ifndef JSON_CONFIG_H_INCLUDED rt300@13: # define JSON_CONFIG_H_INCLUDED rt300@13: rt300@13: /// If defined, indicates that json library is embedded in CppTL library. rt300@13: //# define JSON_IN_CPPTL 1 rt300@13: rt300@13: /// If defined, indicates that json may leverage CppTL library rt300@13: //# define JSON_USE_CPPTL 1 rt300@13: /// If defined, indicates that cpptl vector based map should be used instead of std::map rt300@13: /// as Value container. rt300@13: //# define JSON_USE_CPPTL_SMALLMAP 1 rt300@13: /// If defined, indicates that Json specific container should be used rt300@13: /// (hash table & simple deque container with customizable allocator). rt300@13: /// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332 rt300@13: //# define JSON_VALUE_USE_INTERNAL_MAP 1 rt300@13: /// Force usage of standard new/malloc based allocator instead of memory pool based allocator. rt300@13: /// The memory pools allocator used optimization (initializing Value and ValueInternalLink rt300@13: /// as if it was a POD) that may cause some validation tool to report errors. rt300@13: /// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. rt300@13: //# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 rt300@13: rt300@13: /// If defined, indicates that Json use exception to report invalid type manipulation rt300@13: /// instead of C assert macro. rt300@13: # define JSON_USE_EXCEPTION 1 rt300@13: rt300@13: /// If defined, indicates that the source file is amalgated rt300@13: /// to prevent private header inclusion. rt300@13: /// Remarks: it is automatically defined in the generated amalgated header. rt300@13: // #define JSON_IS_AMALGAMATION rt300@13: rt300@13: rt300@13: # ifdef JSON_IN_CPPTL rt300@13: # include rt300@13: # ifndef JSON_USE_CPPTL rt300@13: # define JSON_USE_CPPTL 1 rt300@13: # endif rt300@13: # endif rt300@13: rt300@13: # ifdef JSON_IN_CPPTL rt300@13: # define JSON_API CPPTL_API rt300@13: # elif defined(JSON_DLL_BUILD) rt300@13: # define JSON_API __declspec(dllexport) rt300@13: # elif defined(JSON_DLL) rt300@13: # define JSON_API __declspec(dllimport) rt300@13: # else rt300@13: # define JSON_API rt300@13: # endif rt300@13: rt300@13: // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer rt300@13: // Storages, and 64 bits integer support is disabled. rt300@13: // #define JSON_NO_INT64 1 rt300@13: rt300@13: #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 rt300@13: // Microsoft Visual Studio 6 only support conversion from __int64 to double rt300@13: // (no conversion from unsigned __int64). rt300@13: #define JSON_USE_INT64_DOUBLE_CONVERSION 1 rt300@13: #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 rt300@13: rt300@13: #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 rt300@13: /// Indicates that the following function is deprecated. rt300@13: # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) rt300@13: #endif rt300@13: rt300@13: #if !defined(JSONCPP_DEPRECATED) rt300@13: # define JSONCPP_DEPRECATED(message) rt300@13: #endif // if !defined(JSONCPP_DEPRECATED) rt300@13: rt300@13: namespace Json { rt300@13: typedef int Int; rt300@13: typedef unsigned int UInt; rt300@13: # if defined(JSON_NO_INT64) rt300@13: typedef int LargestInt; rt300@13: typedef unsigned int LargestUInt; rt300@13: # undef JSON_HAS_INT64 rt300@13: # else // if defined(JSON_NO_INT64) rt300@13: // For Microsoft Visual use specific types as long long is not supported rt300@13: # if defined(_MSC_VER) // Microsoft Visual Studio rt300@13: typedef __int64 Int64; rt300@13: typedef unsigned __int64 UInt64; rt300@13: # else // if defined(_MSC_VER) // Other platforms, use long long rt300@13: typedef long long int Int64; rt300@13: typedef unsigned long long int UInt64; rt300@13: # endif // if defined(_MSC_VER) rt300@13: typedef Int64 LargestInt; rt300@13: typedef UInt64 LargestUInt; rt300@13: # define JSON_HAS_INT64 rt300@13: # endif // if defined(JSON_NO_INT64) rt300@13: } // end namespace Json rt300@13: rt300@13: rt300@13: #endif // JSON_CONFIG_H_INCLUDED rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: include/json/config.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: include/json/forwards.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: // Copyright 2007-2010 Baptiste Lepilleur rt300@13: // Distributed under MIT license, or public domain if desired and rt300@13: // recognized in your jurisdiction. rt300@13: // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE rt300@13: rt300@13: #ifndef JSON_FORWARDS_H_INCLUDED rt300@13: # define JSON_FORWARDS_H_INCLUDED rt300@13: rt300@13: #if !defined(JSON_IS_AMALGAMATION) rt300@13: # include "config.h" rt300@13: #endif // if !defined(JSON_IS_AMALGAMATION) rt300@13: rt300@13: namespace Json { rt300@13: rt300@13: // writer.h rt300@13: class FastWriter; rt300@13: class StyledWriter; rt300@13: rt300@13: // reader.h rt300@13: class Reader; rt300@13: rt300@13: // features.h rt300@13: class Features; rt300@13: rt300@13: // value.h rt300@13: typedef unsigned int ArrayIndex; rt300@13: class StaticString; rt300@13: class Path; rt300@13: class PathArgument; rt300@13: class Value; rt300@13: class ValueIteratorBase; rt300@13: class ValueIterator; rt300@13: class ValueConstIterator; rt300@13: #ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: class ValueMapAllocator; rt300@13: class ValueInternalLink; rt300@13: class ValueInternalArray; rt300@13: class ValueInternalMap; rt300@13: #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: rt300@13: } // namespace Json rt300@13: rt300@13: rt300@13: #endif // JSON_FORWARDS_H_INCLUDED rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: include/json/forwards.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: include/json/features.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: // Copyright 2007-2010 Baptiste Lepilleur rt300@13: // Distributed under MIT license, or public domain if desired and rt300@13: // recognized in your jurisdiction. rt300@13: // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE rt300@13: rt300@13: #ifndef CPPTL_JSON_FEATURES_H_INCLUDED rt300@13: # define CPPTL_JSON_FEATURES_H_INCLUDED rt300@13: rt300@13: #if !defined(JSON_IS_AMALGAMATION) rt300@13: # include "forwards.h" rt300@13: #endif // if !defined(JSON_IS_AMALGAMATION) rt300@13: rt300@13: namespace Json { rt300@13: rt300@13: /** \brief Configuration passed to reader and writer. rt300@13: * This configuration object can be used to force the Reader or Writer rt300@13: * to behave in a standard conforming way. rt300@13: */ rt300@13: class JSON_API Features rt300@13: { rt300@13: public: rt300@13: /** \brief A configuration that allows all features and assumes all strings are UTF-8. rt300@13: * - C & C++ comments are allowed rt300@13: * - Root object can be any JSON value rt300@13: * - Assumes Value strings are encoded in UTF-8 rt300@13: */ rt300@13: static Features all(); rt300@13: rt300@13: /** \brief A configuration that is strictly compatible with the JSON specification. rt300@13: * - Comments are forbidden. rt300@13: * - Root object must be either an array or an object value. rt300@13: * - Assumes Value strings are encoded in UTF-8 rt300@13: */ rt300@13: static Features strictMode(); rt300@13: rt300@13: /** \brief Initialize the configuration like JsonConfig::allFeatures; rt300@13: */ rt300@13: Features(); rt300@13: rt300@13: /// \c true if comments are allowed. Default: \c true. rt300@13: bool allowComments_; rt300@13: rt300@13: /// \c true if root must be either an array or an object value. Default: \c false. rt300@13: bool strictRoot_; rt300@13: }; rt300@13: rt300@13: } // namespace Json rt300@13: rt300@13: #endif // CPPTL_JSON_FEATURES_H_INCLUDED rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: include/json/features.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: include/json/value.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: // Copyright 2007-2010 Baptiste Lepilleur rt300@13: // Distributed under MIT license, or public domain if desired and rt300@13: // recognized in your jurisdiction. rt300@13: // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE rt300@13: rt300@13: #ifndef CPPTL_JSON_H_INCLUDED rt300@13: # define CPPTL_JSON_H_INCLUDED rt300@13: rt300@13: #if !defined(JSON_IS_AMALGAMATION) rt300@13: # include "forwards.h" rt300@13: #endif // if !defined(JSON_IS_AMALGAMATION) rt300@13: # include rt300@13: # include rt300@13: rt300@13: # ifndef JSON_USE_CPPTL_SMALLMAP rt300@13: # include rt300@13: # else rt300@13: # include rt300@13: # endif rt300@13: # ifdef JSON_USE_CPPTL rt300@13: # include rt300@13: # endif rt300@13: rt300@13: /** \brief JSON (JavaScript Object Notation). rt300@13: */ rt300@13: namespace Json { rt300@13: rt300@13: /** \brief Type of the value held by a Value object. rt300@13: */ rt300@13: enum ValueType rt300@13: { rt300@13: nullValue = 0, ///< 'null' value rt300@13: intValue, ///< signed integer value rt300@13: uintValue, ///< unsigned integer value rt300@13: realValue, ///< double value rt300@13: stringValue, ///< UTF-8 string value rt300@13: booleanValue, ///< bool value rt300@13: arrayValue, ///< array value (ordered list) rt300@13: objectValue ///< object value (collection of name/value pairs). rt300@13: }; rt300@13: rt300@13: enum CommentPlacement rt300@13: { rt300@13: commentBefore = 0, ///< a comment placed on the line before a value rt300@13: commentAfterOnSameLine, ///< a comment just after a value on the same line rt300@13: commentAfter, ///< a comment on the line after a value (only make sense for root value) rt300@13: numberOfCommentPlacement rt300@13: }; rt300@13: rt300@13: //# ifdef JSON_USE_CPPTL rt300@13: // typedef CppTL::AnyEnumerator EnumMemberNames; rt300@13: // typedef CppTL::AnyEnumerator EnumValues; rt300@13: //# endif rt300@13: rt300@13: /** \brief Lightweight wrapper to tag static string. rt300@13: * rt300@13: * Value constructor and objectValue member assignement takes advantage of the rt300@13: * StaticString and avoid the cost of string duplication when storing the rt300@13: * string or the member name. rt300@13: * rt300@13: * Example of usage: rt300@13: * \code rt300@13: * Json::Value aValue( StaticString("some text") ); rt300@13: * Json::Value object; rt300@13: * static const StaticString code("code"); rt300@13: * object[code] = 1234; rt300@13: * \endcode rt300@13: */ rt300@13: class JSON_API StaticString rt300@13: { rt300@13: public: rt300@13: explicit StaticString( const char *czstring ) rt300@13: : str_( czstring ) rt300@13: { rt300@13: } rt300@13: rt300@13: operator const char *() const rt300@13: { rt300@13: return str_; rt300@13: } rt300@13: rt300@13: const char *c_str() const rt300@13: { rt300@13: return str_; rt300@13: } rt300@13: rt300@13: private: rt300@13: const char *str_; rt300@13: }; rt300@13: rt300@13: /** \brief Represents a JSON value. rt300@13: * rt300@13: * This class is a discriminated union wrapper that can represents a: rt300@13: * - signed integer [range: Value::minInt - Value::maxInt] rt300@13: * - unsigned integer (range: 0 - Value::maxUInt) rt300@13: * - double rt300@13: * - UTF-8 string rt300@13: * - boolean rt300@13: * - 'null' rt300@13: * - an ordered list of Value rt300@13: * - collection of name/value pairs (javascript object) rt300@13: * rt300@13: * The type of the held value is represented by a #ValueType and rt300@13: * can be obtained using type(). rt300@13: * rt300@13: * values of an #objectValue or #arrayValue can be accessed using operator[]() methods. rt300@13: * Non const methods will automatically create the a #nullValue element rt300@13: * if it does not exist. rt300@13: * The sequence of an #arrayValue will be automatically resize and initialized rt300@13: * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. rt300@13: * rt300@13: * The get() methods can be used to obtanis default value in the case the required element rt300@13: * does not exist. rt300@13: * rt300@13: * It is possible to iterate over the list of a #objectValue values using rt300@13: * the getMemberNames() method. rt300@13: */ rt300@13: class JSON_API Value rt300@13: { rt300@13: friend class ValueIteratorBase; rt300@13: # ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: friend class ValueInternalLink; rt300@13: friend class ValueInternalMap; rt300@13: # endif rt300@13: public: rt300@13: typedef std::vector Members; rt300@13: typedef ValueIterator iterator; rt300@13: typedef ValueConstIterator const_iterator; rt300@13: typedef Json::UInt UInt; rt300@13: typedef Json::Int Int; rt300@13: # if defined(JSON_HAS_INT64) rt300@13: typedef Json::UInt64 UInt64; rt300@13: typedef Json::Int64 Int64; rt300@13: #endif // defined(JSON_HAS_INT64) rt300@13: typedef Json::LargestInt LargestInt; rt300@13: typedef Json::LargestUInt LargestUInt; rt300@13: typedef Json::ArrayIndex ArrayIndex; rt300@13: rt300@13: static const Value null; rt300@13: /// Minimum signed integer value that can be stored in a Json::Value. rt300@13: static const LargestInt minLargestInt; rt300@13: /// Maximum signed integer value that can be stored in a Json::Value. rt300@13: static const LargestInt maxLargestInt; rt300@13: /// Maximum unsigned integer value that can be stored in a Json::Value. rt300@13: static const LargestUInt maxLargestUInt; rt300@13: rt300@13: /// Minimum signed int value that can be stored in a Json::Value. rt300@13: static const Int minInt; rt300@13: /// Maximum signed int value that can be stored in a Json::Value. rt300@13: static const Int maxInt; rt300@13: /// Maximum unsigned int value that can be stored in a Json::Value. rt300@13: static const UInt maxUInt; rt300@13: rt300@13: /// Minimum signed 64 bits int value that can be stored in a Json::Value. rt300@13: static const Int64 minInt64; rt300@13: /// Maximum signed 64 bits int value that can be stored in a Json::Value. rt300@13: static const Int64 maxInt64; rt300@13: /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. rt300@13: static const UInt64 maxUInt64; rt300@13: rt300@13: private: rt300@13: #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION rt300@13: # ifndef JSON_VALUE_USE_INTERNAL_MAP rt300@13: class CZString rt300@13: { rt300@13: public: rt300@13: enum DuplicationPolicy rt300@13: { rt300@13: noDuplication = 0, rt300@13: duplicate, rt300@13: duplicateOnCopy rt300@13: }; rt300@13: CZString( ArrayIndex index ); rt300@13: CZString( const char *cstr, DuplicationPolicy allocate ); rt300@13: CZString( const CZString &other ); rt300@13: ~CZString(); rt300@13: CZString &operator =( const CZString &other ); rt300@13: bool operator<( const CZString &other ) const; rt300@13: bool operator==( const CZString &other ) const; rt300@13: ArrayIndex index() const; rt300@13: const char *c_str() const; rt300@13: bool isStaticString() const; rt300@13: private: rt300@13: void swap( CZString &other ); rt300@13: const char *cstr_; rt300@13: ArrayIndex index_; rt300@13: }; rt300@13: rt300@13: public: rt300@13: # ifndef JSON_USE_CPPTL_SMALLMAP rt300@13: typedef std::map ObjectValues; rt300@13: # else rt300@13: typedef CppTL::SmallMap ObjectValues; rt300@13: # endif // ifndef JSON_USE_CPPTL_SMALLMAP rt300@13: # endif // ifndef JSON_VALUE_USE_INTERNAL_MAP rt300@13: #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION rt300@13: rt300@13: public: rt300@13: /** \brief Create a default Value of the given type. rt300@13: rt300@13: This is a very useful constructor. rt300@13: To create an empty array, pass arrayValue. rt300@13: To create an empty object, pass objectValue. rt300@13: Another Value can then be set to this one by assignment. rt300@13: This is useful since clear() and resize() will not alter types. rt300@13: rt300@13: Examples: rt300@13: \code rt300@13: Json::Value null_value; // null rt300@13: Json::Value arr_value(Json::arrayValue); // [] rt300@13: Json::Value obj_value(Json::objectValue); // {} rt300@13: \endcode rt300@13: */ rt300@13: Value( ValueType type = nullValue ); rt300@13: Value( Int value ); rt300@13: Value( UInt value ); rt300@13: #if defined(JSON_HAS_INT64) rt300@13: Value( Int64 value ); rt300@13: Value( UInt64 value ); rt300@13: #endif // if defined(JSON_HAS_INT64) rt300@13: Value( double value ); rt300@13: Value( const char *value ); rt300@13: Value( const char *beginValue, const char *endValue ); rt300@13: /** \brief Constructs a value from a static string. rt300@13: rt300@13: * Like other value string constructor but do not duplicate the string for rt300@13: * internal storage. The given string must remain alive after the call to this rt300@13: * constructor. rt300@13: * Example of usage: rt300@13: * \code rt300@13: * Json::Value aValue( StaticString("some text") ); rt300@13: * \endcode rt300@13: */ rt300@13: Value( const StaticString &value ); rt300@13: Value( const std::string &value ); rt300@13: # ifdef JSON_USE_CPPTL rt300@13: Value( const CppTL::ConstString &value ); rt300@13: # endif rt300@13: Value( bool value ); rt300@13: Value( const Value &other ); rt300@13: ~Value(); rt300@13: rt300@13: Value &operator=( const Value &other ); rt300@13: /// Swap values. rt300@13: /// \note Currently, comments are intentionally not swapped, for rt300@13: /// both logic and efficiency. rt300@13: void swap( Value &other ); rt300@13: rt300@13: ValueType type() const; rt300@13: rt300@13: bool operator <( const Value &other ) const; rt300@13: bool operator <=( const Value &other ) const; rt300@13: bool operator >=( const Value &other ) const; rt300@13: bool operator >( const Value &other ) const; rt300@13: rt300@13: bool operator ==( const Value &other ) const; rt300@13: bool operator !=( const Value &other ) const; rt300@13: rt300@13: int compare( const Value &other ) const; rt300@13: rt300@13: const char *asCString() const; rt300@13: std::string asString() const; rt300@13: # ifdef JSON_USE_CPPTL rt300@13: CppTL::ConstString asConstString() const; rt300@13: # endif rt300@13: Int asInt() const; rt300@13: UInt asUInt() const; rt300@13: Int64 asInt64() const; rt300@13: UInt64 asUInt64() const; rt300@13: LargestInt asLargestInt() const; rt300@13: LargestUInt asLargestUInt() const; rt300@13: float asFloat() const; rt300@13: double asDouble() const; rt300@13: bool asBool() const; rt300@13: rt300@13: bool isNull() const; rt300@13: bool isBool() const; rt300@13: bool isInt() const; rt300@13: bool isUInt() const; rt300@13: bool isIntegral() const; rt300@13: bool isDouble() const; rt300@13: bool isNumeric() const; rt300@13: bool isString() const; rt300@13: bool isArray() const; rt300@13: bool isObject() const; rt300@13: rt300@13: bool isConvertibleTo( ValueType other ) const; rt300@13: rt300@13: /// Number of values in array or object rt300@13: ArrayIndex size() const; rt300@13: rt300@13: /// \brief Return true if empty array, empty object, or null; rt300@13: /// otherwise, false. rt300@13: bool empty() const; rt300@13: rt300@13: /// Return isNull() rt300@13: bool operator!() const; rt300@13: rt300@13: /// Remove all object members and array elements. rt300@13: /// \pre type() is arrayValue, objectValue, or nullValue rt300@13: /// \post type() is unchanged rt300@13: void clear(); rt300@13: rt300@13: /// Resize the array to size elements. rt300@13: /// New elements are initialized to null. rt300@13: /// May only be called on nullValue or arrayValue. rt300@13: /// \pre type() is arrayValue or nullValue rt300@13: /// \post type() is arrayValue rt300@13: void resize( ArrayIndex size ); rt300@13: rt300@13: /// Access an array element (zero based index ). rt300@13: /// If the array contains less than index element, then null value are inserted rt300@13: /// in the array so that its size is index+1. rt300@13: /// (You may need to say 'value[0u]' to get your compiler to distinguish rt300@13: /// this from the operator[] which takes a string.) rt300@13: Value &operator[]( ArrayIndex index ); rt300@13: rt300@13: /// Access an array element (zero based index ). rt300@13: /// If the array contains less than index element, then null value are inserted rt300@13: /// in the array so that its size is index+1. rt300@13: /// (You may need to say 'value[0u]' to get your compiler to distinguish rt300@13: /// this from the operator[] which takes a string.) rt300@13: Value &operator[]( int index ); rt300@13: rt300@13: /// Access an array element (zero based index ) rt300@13: /// (You may need to say 'value[0u]' to get your compiler to distinguish rt300@13: /// this from the operator[] which takes a string.) rt300@13: const Value &operator[]( ArrayIndex index ) const; rt300@13: rt300@13: /// Access an array element (zero based index ) rt300@13: /// (You may need to say 'value[0u]' to get your compiler to distinguish rt300@13: /// this from the operator[] which takes a string.) rt300@13: const Value &operator[]( int index ) const; rt300@13: rt300@13: /// If the array contains at least index+1 elements, returns the element value, rt300@13: /// otherwise returns defaultValue. rt300@13: Value get( ArrayIndex index, rt300@13: const Value &defaultValue ) const; rt300@13: /// Return true if index < size(). rt300@13: bool isValidIndex( ArrayIndex index ) const; rt300@13: /// \brief Append value to array at the end. rt300@13: /// rt300@13: /// Equivalent to jsonvalue[jsonvalue.size()] = value; rt300@13: Value &append( const Value &value ); rt300@13: rt300@13: /// Access an object value by name, create a null member if it does not exist. rt300@13: Value &operator[]( const char *key ); rt300@13: /// Access an object value by name, returns null if there is no member with that name. rt300@13: const Value &operator[]( const char *key ) const; rt300@13: /// Access an object value by name, create a null member if it does not exist. rt300@13: Value &operator[]( const std::string &key ); rt300@13: /// Access an object value by name, returns null if there is no member with that name. rt300@13: const Value &operator[]( const std::string &key ) const; rt300@13: /** \brief Access an object value by name, create a null member if it does not exist. rt300@13: rt300@13: * If the object as no entry for that name, then the member name used to store rt300@13: * the new entry is not duplicated. rt300@13: * Example of use: rt300@13: * \code rt300@13: * Json::Value object; rt300@13: * static const StaticString code("code"); rt300@13: * object[code] = 1234; rt300@13: * \endcode rt300@13: */ rt300@13: Value &operator[]( const StaticString &key ); rt300@13: # ifdef JSON_USE_CPPTL rt300@13: /// Access an object value by name, create a null member if it does not exist. rt300@13: Value &operator[]( const CppTL::ConstString &key ); rt300@13: /// Access an object value by name, returns null if there is no member with that name. rt300@13: const Value &operator[]( const CppTL::ConstString &key ) const; rt300@13: # endif rt300@13: /// Return the member named key if it exist, defaultValue otherwise. rt300@13: Value get( const char *key, rt300@13: const Value &defaultValue ) const; rt300@13: /// Return the member named key if it exist, defaultValue otherwise. rt300@13: Value get( const std::string &key, rt300@13: const Value &defaultValue ) const; rt300@13: # ifdef JSON_USE_CPPTL rt300@13: /// Return the member named key if it exist, defaultValue otherwise. rt300@13: Value get( const CppTL::ConstString &key, rt300@13: const Value &defaultValue ) const; rt300@13: # endif rt300@13: /// \brief Remove and return the named member. rt300@13: /// rt300@13: /// Do nothing if it did not exist. rt300@13: /// \return the removed Value, or null. rt300@13: /// \pre type() is objectValue or nullValue rt300@13: /// \post type() is unchanged rt300@13: Value removeMember( const char* key ); rt300@13: /// Same as removeMember(const char*) rt300@13: Value removeMember( const std::string &key ); rt300@13: rt300@13: /// Return true if the object has a member named key. rt300@13: bool isMember( const char *key ) const; rt300@13: /// Return true if the object has a member named key. rt300@13: bool isMember( const std::string &key ) const; rt300@13: # ifdef JSON_USE_CPPTL rt300@13: /// Return true if the object has a member named key. rt300@13: bool isMember( const CppTL::ConstString &key ) const; rt300@13: # endif rt300@13: rt300@13: /// \brief Return a list of the member names. rt300@13: /// rt300@13: /// If null, return an empty list. rt300@13: /// \pre type() is objectValue or nullValue rt300@13: /// \post if type() was nullValue, it remains nullValue rt300@13: Members getMemberNames() const; rt300@13: rt300@13: //# ifdef JSON_USE_CPPTL rt300@13: // EnumMemberNames enumMemberNames() const; rt300@13: // EnumValues enumValues() const; rt300@13: //# endif rt300@13: rt300@13: /// Comments must be //... or /* ... */ rt300@13: void setComment( const char *comment, rt300@13: CommentPlacement placement ); rt300@13: /// Comments must be //... or /* ... */ rt300@13: void setComment( const std::string &comment, rt300@13: CommentPlacement placement ); rt300@13: bool hasComment( CommentPlacement placement ) const; rt300@13: /// Include delimiters and embedded newlines. rt300@13: std::string getComment( CommentPlacement placement ) const; rt300@13: rt300@13: std::string toStyledString() const; rt300@13: rt300@13: const_iterator begin() const; rt300@13: const_iterator end() const; rt300@13: rt300@13: iterator begin(); rt300@13: iterator end(); rt300@13: rt300@13: private: rt300@13: Value &resolveReference( const char *key, rt300@13: bool isStatic ); rt300@13: rt300@13: # ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: inline bool isItemAvailable() const rt300@13: { rt300@13: return itemIsUsed_ == 0; rt300@13: } rt300@13: rt300@13: inline void setItemUsed( bool isUsed = true ) rt300@13: { rt300@13: itemIsUsed_ = isUsed ? 1 : 0; rt300@13: } rt300@13: rt300@13: inline bool isMemberNameStatic() const rt300@13: { rt300@13: return memberNameIsStatic_ == 0; rt300@13: } rt300@13: rt300@13: inline void setMemberNameIsStatic( bool isStatic ) rt300@13: { rt300@13: memberNameIsStatic_ = isStatic ? 1 : 0; rt300@13: } rt300@13: # endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: rt300@13: private: rt300@13: struct CommentInfo rt300@13: { rt300@13: CommentInfo(); rt300@13: ~CommentInfo(); rt300@13: rt300@13: void setComment( const char *text ); rt300@13: rt300@13: char *comment_; rt300@13: }; rt300@13: rt300@13: //struct MemberNamesTransform rt300@13: //{ rt300@13: // typedef const char *result_type; rt300@13: // const char *operator()( const CZString &name ) const rt300@13: // { rt300@13: // return name.c_str(); rt300@13: // } rt300@13: //}; rt300@13: rt300@13: union ValueHolder rt300@13: { rt300@13: LargestInt int_; rt300@13: LargestUInt uint_; rt300@13: double real_; rt300@13: bool bool_; rt300@13: char *string_; rt300@13: # ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: ValueInternalArray *array_; rt300@13: ValueInternalMap *map_; rt300@13: #else rt300@13: ObjectValues *map_; rt300@13: # endif rt300@13: } value_; rt300@13: ValueType type_ : 8; rt300@13: int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. rt300@13: # ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container. rt300@13: int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. rt300@13: # endif rt300@13: CommentInfo *comments_; rt300@13: }; rt300@13: rt300@13: rt300@13: /** \brief Experimental and untested: represents an element of the "path" to access a node. rt300@13: */ rt300@13: class PathArgument rt300@13: { rt300@13: public: rt300@13: friend class Path; rt300@13: rt300@13: PathArgument(); rt300@13: PathArgument( ArrayIndex index ); rt300@13: PathArgument( const char *key ); rt300@13: PathArgument( const std::string &key ); rt300@13: rt300@13: private: rt300@13: enum Kind rt300@13: { rt300@13: kindNone = 0, rt300@13: kindIndex, rt300@13: kindKey rt300@13: }; rt300@13: std::string key_; rt300@13: ArrayIndex index_; rt300@13: Kind kind_; rt300@13: }; rt300@13: rt300@13: /** \brief Experimental and untested: represents a "path" to access a node. rt300@13: * rt300@13: * Syntax: rt300@13: * - "." => root node rt300@13: * - ".[n]" => elements at index 'n' of root node (an array value) rt300@13: * - ".name" => member named 'name' of root node (an object value) rt300@13: * - ".name1.name2.name3" rt300@13: * - ".[0][1][2].name1[3]" rt300@13: * - ".%" => member name is provided as parameter rt300@13: * - ".[%]" => index is provied as parameter rt300@13: */ rt300@13: class Path rt300@13: { rt300@13: public: rt300@13: Path( const std::string &path, rt300@13: const PathArgument &a1 = PathArgument(), rt300@13: const PathArgument &a2 = PathArgument(), rt300@13: const PathArgument &a3 = PathArgument(), rt300@13: const PathArgument &a4 = PathArgument(), rt300@13: const PathArgument &a5 = PathArgument() ); rt300@13: rt300@13: const Value &resolve( const Value &root ) const; rt300@13: Value resolve( const Value &root, rt300@13: const Value &defaultValue ) const; rt300@13: /// Creates the "path" to access the specified node and returns a reference on the node. rt300@13: Value &make( Value &root ) const; rt300@13: rt300@13: private: rt300@13: typedef std::vector InArgs; rt300@13: typedef std::vector Args; rt300@13: rt300@13: void makePath( const std::string &path, rt300@13: const InArgs &in ); rt300@13: void addPathInArg( const std::string &path, rt300@13: const InArgs &in, rt300@13: InArgs::const_iterator &itInArg, rt300@13: PathArgument::Kind kind ); rt300@13: void invalidPath( const std::string &path, rt300@13: int location ); rt300@13: rt300@13: Args args_; rt300@13: }; rt300@13: rt300@13: rt300@13: rt300@13: #ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: /** \brief Allocator to customize Value internal map. rt300@13: * Below is an example of a simple implementation (default implementation actually rt300@13: * use memory pool for speed). rt300@13: * \code rt300@13: class DefaultValueMapAllocator : public ValueMapAllocator rt300@13: { rt300@13: public: // overridden from ValueMapAllocator rt300@13: virtual ValueInternalMap *newMap() rt300@13: { rt300@13: return new ValueInternalMap(); rt300@13: } rt300@13: rt300@13: virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) rt300@13: { rt300@13: return new ValueInternalMap( other ); rt300@13: } rt300@13: rt300@13: virtual void destructMap( ValueInternalMap *map ) rt300@13: { rt300@13: delete map; rt300@13: } rt300@13: rt300@13: virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) rt300@13: { rt300@13: return new ValueInternalLink[size]; rt300@13: } rt300@13: rt300@13: virtual void releaseMapBuckets( ValueInternalLink *links ) rt300@13: { rt300@13: delete [] links; rt300@13: } rt300@13: rt300@13: virtual ValueInternalLink *allocateMapLink() rt300@13: { rt300@13: return new ValueInternalLink(); rt300@13: } rt300@13: rt300@13: virtual void releaseMapLink( ValueInternalLink *link ) rt300@13: { rt300@13: delete link; rt300@13: } rt300@13: }; rt300@13: * \endcode rt300@13: */ rt300@13: class JSON_API ValueMapAllocator rt300@13: { rt300@13: public: rt300@13: virtual ~ValueMapAllocator(); rt300@13: virtual ValueInternalMap *newMap() = 0; rt300@13: virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0; rt300@13: virtual void destructMap( ValueInternalMap *map ) = 0; rt300@13: virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0; rt300@13: virtual void releaseMapBuckets( ValueInternalLink *links ) = 0; rt300@13: virtual ValueInternalLink *allocateMapLink() = 0; rt300@13: virtual void releaseMapLink( ValueInternalLink *link ) = 0; rt300@13: }; rt300@13: rt300@13: /** \brief ValueInternalMap hash-map bucket chain link (for internal use only). rt300@13: * \internal previous_ & next_ allows for bidirectional traversal. rt300@13: */ rt300@13: class JSON_API ValueInternalLink rt300@13: { rt300@13: public: rt300@13: enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture. rt300@13: enum InternalFlags { rt300@13: flagAvailable = 0, rt300@13: flagUsed = 1 rt300@13: }; rt300@13: rt300@13: ValueInternalLink(); rt300@13: rt300@13: ~ValueInternalLink(); rt300@13: rt300@13: Value items_[itemPerLink]; rt300@13: char *keys_[itemPerLink]; rt300@13: ValueInternalLink *previous_; rt300@13: ValueInternalLink *next_; rt300@13: }; rt300@13: rt300@13: rt300@13: /** \brief A linked page based hash-table implementation used internally by Value. rt300@13: * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked rt300@13: * list in each bucket to handle collision. There is an addional twist in that rt300@13: * each node of the collision linked list is a page containing a fixed amount of rt300@13: * value. This provides a better compromise between memory usage and speed. rt300@13: * rt300@13: * Each bucket is made up of a chained list of ValueInternalLink. The last rt300@13: * link of a given bucket can be found in the 'previous_' field of the following bucket. rt300@13: * The last link of the last bucket is stored in tailLink_ as it has no following bucket. rt300@13: * Only the last link of a bucket may contains 'available' item. The last link always rt300@13: * contains at least one element unless is it the bucket one very first link. rt300@13: */ rt300@13: class JSON_API ValueInternalMap rt300@13: { rt300@13: friend class ValueIteratorBase; rt300@13: friend class Value; rt300@13: public: rt300@13: typedef unsigned int HashKey; rt300@13: typedef unsigned int BucketIndex; rt300@13: rt300@13: # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION rt300@13: struct IteratorState rt300@13: { rt300@13: IteratorState() rt300@13: : map_(0) rt300@13: , link_(0) rt300@13: , itemIndex_(0) rt300@13: , bucketIndex_(0) rt300@13: { rt300@13: } rt300@13: ValueInternalMap *map_; rt300@13: ValueInternalLink *link_; rt300@13: BucketIndex itemIndex_; rt300@13: BucketIndex bucketIndex_; rt300@13: }; rt300@13: # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION rt300@13: rt300@13: ValueInternalMap(); rt300@13: ValueInternalMap( const ValueInternalMap &other ); rt300@13: ValueInternalMap &operator =( const ValueInternalMap &other ); rt300@13: ~ValueInternalMap(); rt300@13: rt300@13: void swap( ValueInternalMap &other ); rt300@13: rt300@13: BucketIndex size() const; rt300@13: rt300@13: void clear(); rt300@13: rt300@13: bool reserveDelta( BucketIndex growth ); rt300@13: rt300@13: bool reserve( BucketIndex newItemCount ); rt300@13: rt300@13: const Value *find( const char *key ) const; rt300@13: rt300@13: Value *find( const char *key ); rt300@13: rt300@13: Value &resolveReference( const char *key, rt300@13: bool isStatic ); rt300@13: rt300@13: void remove( const char *key ); rt300@13: rt300@13: void doActualRemove( ValueInternalLink *link, rt300@13: BucketIndex index, rt300@13: BucketIndex bucketIndex ); rt300@13: rt300@13: ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex ); rt300@13: rt300@13: Value &setNewItem( const char *key, rt300@13: bool isStatic, rt300@13: ValueInternalLink *link, rt300@13: BucketIndex index ); rt300@13: rt300@13: Value &unsafeAdd( const char *key, rt300@13: bool isStatic, rt300@13: HashKey hashedKey ); rt300@13: rt300@13: HashKey hash( const char *key ) const; rt300@13: rt300@13: int compare( const ValueInternalMap &other ) const; rt300@13: rt300@13: private: rt300@13: void makeBeginIterator( IteratorState &it ) const; rt300@13: void makeEndIterator( IteratorState &it ) const; rt300@13: static bool equals( const IteratorState &x, const IteratorState &other ); rt300@13: static void increment( IteratorState &iterator ); rt300@13: static void incrementBucket( IteratorState &iterator ); rt300@13: static void decrement( IteratorState &iterator ); rt300@13: static const char *key( const IteratorState &iterator ); rt300@13: static const char *key( const IteratorState &iterator, bool &isStatic ); rt300@13: static Value &value( const IteratorState &iterator ); rt300@13: static int distance( const IteratorState &x, const IteratorState &y ); rt300@13: rt300@13: private: rt300@13: ValueInternalLink *buckets_; rt300@13: ValueInternalLink *tailLink_; rt300@13: BucketIndex bucketsSize_; rt300@13: BucketIndex itemCount_; rt300@13: }; rt300@13: rt300@13: /** \brief A simplified deque implementation used internally by Value. rt300@13: * \internal rt300@13: * It is based on a list of fixed "page", each page contains a fixed number of items. rt300@13: * Instead of using a linked-list, a array of pointer is used for fast item look-up. rt300@13: * Look-up for an element is as follow: rt300@13: * - compute page index: pageIndex = itemIndex / itemsPerPage rt300@13: * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage] rt300@13: * rt300@13: * Insertion is amortized constant time (only the array containing the index of pointers rt300@13: * need to be reallocated when items are appended). rt300@13: */ rt300@13: class JSON_API ValueInternalArray rt300@13: { rt300@13: friend class Value; rt300@13: friend class ValueIteratorBase; rt300@13: public: rt300@13: enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo. rt300@13: typedef Value::ArrayIndex ArrayIndex; rt300@13: typedef unsigned int PageIndex; rt300@13: rt300@13: # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION rt300@13: struct IteratorState // Must be a POD rt300@13: { rt300@13: IteratorState() rt300@13: : array_(0) rt300@13: , currentPageIndex_(0) rt300@13: , currentItemIndex_(0) rt300@13: { rt300@13: } rt300@13: ValueInternalArray *array_; rt300@13: Value **currentPageIndex_; rt300@13: unsigned int currentItemIndex_; rt300@13: }; rt300@13: # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION rt300@13: rt300@13: ValueInternalArray(); rt300@13: ValueInternalArray( const ValueInternalArray &other ); rt300@13: ValueInternalArray &operator =( const ValueInternalArray &other ); rt300@13: ~ValueInternalArray(); rt300@13: void swap( ValueInternalArray &other ); rt300@13: rt300@13: void clear(); rt300@13: void resize( ArrayIndex newSize ); rt300@13: rt300@13: Value &resolveReference( ArrayIndex index ); rt300@13: rt300@13: Value *find( ArrayIndex index ) const; rt300@13: rt300@13: ArrayIndex size() const; rt300@13: rt300@13: int compare( const ValueInternalArray &other ) const; rt300@13: rt300@13: private: rt300@13: static bool equals( const IteratorState &x, const IteratorState &other ); rt300@13: static void increment( IteratorState &iterator ); rt300@13: static void decrement( IteratorState &iterator ); rt300@13: static Value &dereference( const IteratorState &iterator ); rt300@13: static Value &unsafeDereference( const IteratorState &iterator ); rt300@13: static int distance( const IteratorState &x, const IteratorState &y ); rt300@13: static ArrayIndex indexOf( const IteratorState &iterator ); rt300@13: void makeBeginIterator( IteratorState &it ) const; rt300@13: void makeEndIterator( IteratorState &it ) const; rt300@13: void makeIterator( IteratorState &it, ArrayIndex index ) const; rt300@13: rt300@13: void makeIndexValid( ArrayIndex index ); rt300@13: rt300@13: Value **pages_; rt300@13: ArrayIndex size_; rt300@13: PageIndex pageCount_; rt300@13: }; rt300@13: rt300@13: /** \brief Experimental: do not use. Allocator to customize Value internal array. rt300@13: * Below is an example of a simple implementation (actual implementation use rt300@13: * memory pool). rt300@13: \code rt300@13: class DefaultValueArrayAllocator : public ValueArrayAllocator rt300@13: { rt300@13: public: // overridden from ValueArrayAllocator rt300@13: virtual ~DefaultValueArrayAllocator() rt300@13: { rt300@13: } rt300@13: rt300@13: virtual ValueInternalArray *newArray() rt300@13: { rt300@13: return new ValueInternalArray(); rt300@13: } rt300@13: rt300@13: virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) rt300@13: { rt300@13: return new ValueInternalArray( other ); rt300@13: } rt300@13: rt300@13: virtual void destruct( ValueInternalArray *array ) rt300@13: { rt300@13: delete array; rt300@13: } rt300@13: rt300@13: virtual void reallocateArrayPageIndex( Value **&indexes, rt300@13: ValueInternalArray::PageIndex &indexCount, rt300@13: ValueInternalArray::PageIndex minNewIndexCount ) rt300@13: { rt300@13: ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1; rt300@13: if ( minNewIndexCount > newIndexCount ) rt300@13: newIndexCount = minNewIndexCount; rt300@13: void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount ); rt300@13: if ( !newIndexes ) rt300@13: throw std::bad_alloc(); rt300@13: indexCount = newIndexCount; rt300@13: indexes = static_cast( newIndexes ); rt300@13: } rt300@13: virtual void releaseArrayPageIndex( Value **indexes, rt300@13: ValueInternalArray::PageIndex indexCount ) rt300@13: { rt300@13: if ( indexes ) rt300@13: free( indexes ); rt300@13: } rt300@13: rt300@13: virtual Value *allocateArrayPage() rt300@13: { rt300@13: return static_cast( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) ); rt300@13: } rt300@13: rt300@13: virtual void releaseArrayPage( Value *value ) rt300@13: { rt300@13: if ( value ) rt300@13: free( value ); rt300@13: } rt300@13: }; rt300@13: \endcode rt300@13: */ rt300@13: class JSON_API ValueArrayAllocator rt300@13: { rt300@13: public: rt300@13: virtual ~ValueArrayAllocator(); rt300@13: virtual ValueInternalArray *newArray() = 0; rt300@13: virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0; rt300@13: virtual void destructArray( ValueInternalArray *array ) = 0; rt300@13: /** \brief Reallocate array page index. rt300@13: * Reallocates an array of pointer on each page. rt300@13: * \param indexes [input] pointer on the current index. May be \c NULL. rt300@13: * [output] pointer on the new index of at least rt300@13: * \a minNewIndexCount pages. rt300@13: * \param indexCount [input] current number of pages in the index. rt300@13: * [output] number of page the reallocated index can handle. rt300@13: * \b MUST be >= \a minNewIndexCount. rt300@13: * \param minNewIndexCount Minimum number of page the new index must be able to rt300@13: * handle. rt300@13: */ rt300@13: virtual void reallocateArrayPageIndex( Value **&indexes, rt300@13: ValueInternalArray::PageIndex &indexCount, rt300@13: ValueInternalArray::PageIndex minNewIndexCount ) = 0; rt300@13: virtual void releaseArrayPageIndex( Value **indexes, rt300@13: ValueInternalArray::PageIndex indexCount ) = 0; rt300@13: virtual Value *allocateArrayPage() = 0; rt300@13: virtual void releaseArrayPage( Value *value ) = 0; rt300@13: }; rt300@13: #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP rt300@13: rt300@13: rt300@13: /** \brief base class for Value iterators. rt300@13: * rt300@13: */ rt300@13: class ValueIteratorBase rt300@13: { rt300@13: public: rt300@13: typedef unsigned int size_t; rt300@13: typedef int difference_type; rt300@13: typedef ValueIteratorBase SelfType; rt300@13: rt300@13: ValueIteratorBase(); rt300@13: #ifndef JSON_VALUE_USE_INTERNAL_MAP rt300@13: explicit ValueIteratorBase( const Value::ObjectValues::iterator ¤t ); rt300@13: #else rt300@13: ValueIteratorBase( const ValueInternalArray::IteratorState &state ); rt300@13: ValueIteratorBase( const ValueInternalMap::IteratorState &state ); rt300@13: #endif rt300@13: rt300@13: bool operator ==( const SelfType &other ) const rt300@13: { rt300@13: return isEqual( other ); rt300@13: } rt300@13: rt300@13: bool operator !=( const SelfType &other ) const rt300@13: { rt300@13: return !isEqual( other ); rt300@13: } rt300@13: rt300@13: difference_type operator -( const SelfType &other ) const rt300@13: { rt300@13: return computeDistance( other ); rt300@13: } rt300@13: rt300@13: /// Return either the index or the member name of the referenced value as a Value. rt300@13: Value key() const; rt300@13: rt300@13: /// Return the index of the referenced Value. -1 if it is not an arrayValue. rt300@13: UInt index() const; rt300@13: rt300@13: /// Return the member name of the referenced Value. "" if it is not an objectValue. rt300@13: const char *memberName() const; rt300@13: rt300@13: protected: rt300@13: Value &deref() const; rt300@13: rt300@13: void increment(); rt300@13: rt300@13: void decrement(); rt300@13: rt300@13: difference_type computeDistance( const SelfType &other ) const; rt300@13: rt300@13: bool isEqual( const SelfType &other ) const; rt300@13: rt300@13: void copy( const SelfType &other ); rt300@13: rt300@13: private: rt300@13: #ifndef JSON_VALUE_USE_INTERNAL_MAP rt300@13: Value::ObjectValues::iterator current_; rt300@13: // Indicates that iterator is for a null value. rt300@13: bool isNull_; rt300@13: #else rt300@13: union rt300@13: { rt300@13: ValueInternalArray::IteratorState array_; rt300@13: ValueInternalMap::IteratorState map_; rt300@13: } iterator_; rt300@13: bool isArray_; rt300@13: #endif rt300@13: }; rt300@13: rt300@13: /** \brief const iterator for object and array value. rt300@13: * rt300@13: */ rt300@13: class ValueConstIterator : public ValueIteratorBase rt300@13: { rt300@13: friend class Value; rt300@13: public: rt300@13: typedef unsigned int size_t; rt300@13: typedef int difference_type; rt300@13: typedef const Value &reference; rt300@13: typedef const Value *pointer; rt300@13: typedef ValueConstIterator SelfType; rt300@13: rt300@13: ValueConstIterator(); rt300@13: private: rt300@13: /*! \internal Use by Value to create an iterator. rt300@13: */ rt300@13: #ifndef JSON_VALUE_USE_INTERNAL_MAP rt300@13: explicit ValueConstIterator( const Value::ObjectValues::iterator ¤t ); rt300@13: #else rt300@13: ValueConstIterator( const ValueInternalArray::IteratorState &state ); rt300@13: ValueConstIterator( const ValueInternalMap::IteratorState &state ); rt300@13: #endif rt300@13: public: rt300@13: SelfType &operator =( const ValueIteratorBase &other ); rt300@13: rt300@13: SelfType operator++( int ) rt300@13: { rt300@13: SelfType temp( *this ); rt300@13: ++*this; rt300@13: return temp; rt300@13: } rt300@13: rt300@13: SelfType operator--( int ) rt300@13: { rt300@13: SelfType temp( *this ); rt300@13: --*this; rt300@13: return temp; rt300@13: } rt300@13: rt300@13: SelfType &operator--() rt300@13: { rt300@13: decrement(); rt300@13: return *this; rt300@13: } rt300@13: rt300@13: SelfType &operator++() rt300@13: { rt300@13: increment(); rt300@13: return *this; rt300@13: } rt300@13: rt300@13: reference operator *() const rt300@13: { rt300@13: return deref(); rt300@13: } rt300@13: }; rt300@13: rt300@13: rt300@13: /** \brief Iterator for object and array value. rt300@13: */ rt300@13: class ValueIterator : public ValueIteratorBase rt300@13: { rt300@13: friend class Value; rt300@13: public: rt300@13: typedef unsigned int size_t; rt300@13: typedef int difference_type; rt300@13: typedef Value &reference; rt300@13: typedef Value *pointer; rt300@13: typedef ValueIterator SelfType; rt300@13: rt300@13: ValueIterator(); rt300@13: ValueIterator( const ValueConstIterator &other ); rt300@13: ValueIterator( const ValueIterator &other ); rt300@13: private: rt300@13: /*! \internal Use by Value to create an iterator. rt300@13: */ rt300@13: #ifndef JSON_VALUE_USE_INTERNAL_MAP rt300@13: explicit ValueIterator( const Value::ObjectValues::iterator ¤t ); rt300@13: #else rt300@13: ValueIterator( const ValueInternalArray::IteratorState &state ); rt300@13: ValueIterator( const ValueInternalMap::IteratorState &state ); rt300@13: #endif rt300@13: public: rt300@13: rt300@13: SelfType &operator =( const SelfType &other ); rt300@13: rt300@13: SelfType operator++( int ) rt300@13: { rt300@13: SelfType temp( *this ); rt300@13: ++*this; rt300@13: return temp; rt300@13: } rt300@13: rt300@13: SelfType operator--( int ) rt300@13: { rt300@13: SelfType temp( *this ); rt300@13: --*this; rt300@13: return temp; rt300@13: } rt300@13: rt300@13: SelfType &operator--() rt300@13: { rt300@13: decrement(); rt300@13: return *this; rt300@13: } rt300@13: rt300@13: SelfType &operator++() rt300@13: { rt300@13: increment(); rt300@13: return *this; rt300@13: } rt300@13: rt300@13: reference operator *() const rt300@13: { rt300@13: return deref(); rt300@13: } rt300@13: }; rt300@13: rt300@13: rt300@13: } // namespace Json rt300@13: rt300@13: rt300@13: #endif // CPPTL_JSON_H_INCLUDED rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: include/json/value.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: include/json/reader.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: // Copyright 2007-2010 Baptiste Lepilleur rt300@13: // Distributed under MIT license, or public domain if desired and rt300@13: // recognized in your jurisdiction. rt300@13: // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE rt300@13: rt300@13: #ifndef CPPTL_JSON_READER_H_INCLUDED rt300@13: # define CPPTL_JSON_READER_H_INCLUDED rt300@13: rt300@13: #if !defined(JSON_IS_AMALGAMATION) rt300@13: # include "features.h" rt300@13: # include "value.h" rt300@13: #endif // if !defined(JSON_IS_AMALGAMATION) rt300@13: # include rt300@13: # include rt300@13: # include rt300@13: # include rt300@13: rt300@13: namespace Json { rt300@13: rt300@13: /** \brief Unserialize a JSON document into a Value. rt300@13: * rt300@13: */ rt300@13: class JSON_API Reader rt300@13: { rt300@13: public: rt300@13: typedef char Char; rt300@13: typedef const Char *Location; rt300@13: rt300@13: /** \brief Constructs a Reader allowing all features rt300@13: * for parsing. rt300@13: */ rt300@13: Reader(); rt300@13: rt300@13: /** \brief Constructs a Reader allowing the specified feature set rt300@13: * for parsing. rt300@13: */ rt300@13: Reader( const Features &features ); rt300@13: rt300@13: /** \brief Read a Value from a JSON document. rt300@13: * \param document UTF-8 encoded string containing the document to read. rt300@13: * \param root [out] Contains the root value of the document if it was rt300@13: * successfully parsed. rt300@13: * \param collectComments \c true to collect comment and allow writing them back during rt300@13: * serialization, \c false to discard comments. rt300@13: * This parameter is ignored if Features::allowComments_ rt300@13: * is \c false. rt300@13: * \return \c true if the document was successfully parsed, \c false if an error occurred. rt300@13: */ rt300@13: bool parse( const std::string &document, rt300@13: Value &root, rt300@13: bool collectComments = true ); rt300@13: rt300@13: /** \brief Read a Value from a JSON document. rt300@13: * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read. rt300@13: * \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read. rt300@13: \ Must be >= beginDoc. rt300@13: * \param root [out] Contains the root value of the document if it was rt300@13: * successfully parsed. rt300@13: * \param collectComments \c true to collect comment and allow writing them back during rt300@13: * serialization, \c false to discard comments. rt300@13: * This parameter is ignored if Features::allowComments_ rt300@13: * is \c false. rt300@13: * \return \c true if the document was successfully parsed, \c false if an error occurred. rt300@13: */ rt300@13: bool parse( const char *beginDoc, const char *endDoc, rt300@13: Value &root, rt300@13: bool collectComments = true ); rt300@13: rt300@13: /// \brief Parse from input stream. rt300@13: /// \see Json::operator>>(std::istream&, Json::Value&). rt300@13: bool parse( std::istream &is, rt300@13: Value &root, rt300@13: bool collectComments = true ); rt300@13: rt300@13: /** \brief Returns a user friendly string that list errors in the parsed document. rt300@13: * \return Formatted error message with the list of errors with their location in rt300@13: * the parsed document. An empty string is returned if no error occurred rt300@13: * during parsing. rt300@13: * \deprecated Use getFormattedErrorMessages() instead (typo fix). rt300@13: */ rt300@13: JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead") rt300@13: std::string getFormatedErrorMessages() const; rt300@13: rt300@13: /** \brief Returns a user friendly string that list errors in the parsed document. rt300@13: * \return Formatted error message with the list of errors with their location in rt300@13: * the parsed document. An empty string is returned if no error occurred rt300@13: * during parsing. rt300@13: */ rt300@13: std::string getFormattedErrorMessages() const; rt300@13: rt300@13: private: rt300@13: enum TokenType rt300@13: { rt300@13: tokenEndOfStream = 0, rt300@13: tokenObjectBegin, rt300@13: tokenObjectEnd, rt300@13: tokenArrayBegin, rt300@13: tokenArrayEnd, rt300@13: tokenString, rt300@13: tokenNumber, rt300@13: tokenTrue, rt300@13: tokenFalse, rt300@13: tokenNull, rt300@13: tokenArraySeparator, rt300@13: tokenMemberSeparator, rt300@13: tokenComment, rt300@13: tokenError rt300@13: }; rt300@13: rt300@13: class Token rt300@13: { rt300@13: public: rt300@13: TokenType type_; rt300@13: Location start_; rt300@13: Location end_; rt300@13: }; rt300@13: rt300@13: class ErrorInfo rt300@13: { rt300@13: public: rt300@13: Token token_; rt300@13: std::string message_; rt300@13: Location extra_; rt300@13: }; rt300@13: rt300@13: typedef std::deque Errors; rt300@13: rt300@13: bool expectToken( TokenType type, Token &token, const char *message ); rt300@13: bool readToken( Token &token ); rt300@13: void skipSpaces(); rt300@13: bool match( Location pattern, rt300@13: int patternLength ); rt300@13: bool readComment(); rt300@13: bool readCStyleComment(); rt300@13: bool readCppStyleComment(); rt300@13: bool readString(); rt300@13: void readNumber(); rt300@13: bool readValue(); rt300@13: bool readObject( Token &token ); rt300@13: bool readArray( Token &token ); rt300@13: bool decodeNumber( Token &token ); rt300@13: bool decodeString( Token &token ); rt300@13: bool decodeString( Token &token, std::string &decoded ); rt300@13: bool decodeDouble( Token &token ); rt300@13: bool decodeUnicodeCodePoint( Token &token, rt300@13: Location ¤t, rt300@13: Location end, rt300@13: unsigned int &unicode ); rt300@13: bool decodeUnicodeEscapeSequence( Token &token, rt300@13: Location ¤t, rt300@13: Location end, rt300@13: unsigned int &unicode ); rt300@13: bool addError( const std::string &message, rt300@13: Token &token, rt300@13: Location extra = 0 ); rt300@13: bool recoverFromError( TokenType skipUntilToken ); rt300@13: bool addErrorAndRecover( const std::string &message, rt300@13: Token &token, rt300@13: TokenType skipUntilToken ); rt300@13: void skipUntilSpace(); rt300@13: Value ¤tValue(); rt300@13: Char getNextChar(); rt300@13: void getLocationLineAndColumn( Location location, rt300@13: int &line, rt300@13: int &column ) const; rt300@13: std::string getLocationLineAndColumn( Location location ) const; rt300@13: void addComment( Location begin, rt300@13: Location end, rt300@13: CommentPlacement placement ); rt300@13: void skipCommentTokens( Token &token ); rt300@13: rt300@13: typedef std::stack Nodes; rt300@13: Nodes nodes_; rt300@13: Errors errors_; rt300@13: std::string document_; rt300@13: Location begin_; rt300@13: Location end_; rt300@13: Location current_; rt300@13: Location lastValueEnd_; rt300@13: Value *lastValue_; rt300@13: std::string commentsBefore_; rt300@13: Features features_; rt300@13: bool collectComments_; rt300@13: }; rt300@13: rt300@13: /** \brief Read from 'sin' into 'root'. rt300@13: rt300@13: Always keep comments from the input JSON. rt300@13: rt300@13: This can be used to read a file into a particular sub-object. rt300@13: For example: rt300@13: \code rt300@13: Json::Value root; rt300@13: cin >> root["dir"]["file"]; rt300@13: cout << root; rt300@13: \endcode rt300@13: Result: rt300@13: \verbatim rt300@13: { rt300@13: "dir": { rt300@13: "file": { rt300@13: // The input stream JSON would be nested here. rt300@13: } rt300@13: } rt300@13: } rt300@13: \endverbatim rt300@13: \throw std::exception on parse error. rt300@13: \see Json::operator<<() rt300@13: */ rt300@13: std::istream& operator>>( std::istream&, Value& ); rt300@13: rt300@13: } // namespace Json rt300@13: rt300@13: #endif // CPPTL_JSON_READER_H_INCLUDED rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: include/json/reader.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // Beginning of content of file: include/json/writer.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: // Copyright 2007-2010 Baptiste Lepilleur rt300@13: // Distributed under MIT license, or public domain if desired and rt300@13: // recognized in your jurisdiction. rt300@13: // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE rt300@13: rt300@13: #ifndef JSON_WRITER_H_INCLUDED rt300@13: # define JSON_WRITER_H_INCLUDED rt300@13: rt300@13: #if !defined(JSON_IS_AMALGAMATION) rt300@13: # include "value.h" rt300@13: #endif // if !defined(JSON_IS_AMALGAMATION) rt300@13: # include rt300@13: # include rt300@13: # include rt300@13: rt300@13: namespace Json { rt300@13: rt300@13: class Value; rt300@13: rt300@13: /** \brief Abstract class for writers. rt300@13: */ rt300@13: class JSON_API Writer rt300@13: { rt300@13: public: rt300@13: virtual ~Writer(); rt300@13: rt300@13: virtual std::string write( const Value &root ) = 0; rt300@13: }; rt300@13: rt300@13: /** \brief Outputs a Value in JSON format without formatting (not human friendly). rt300@13: * rt300@13: * The JSON document is written in a single line. It is not intended for 'human' consumption, rt300@13: * but may be usefull to support feature such as RPC where bandwith is limited. rt300@13: * \sa Reader, Value rt300@13: */ rt300@13: class JSON_API FastWriter : public Writer rt300@13: { rt300@13: public: rt300@13: FastWriter(); rt300@13: virtual ~FastWriter(){} rt300@13: rt300@13: void enableYAMLCompatibility(); rt300@13: rt300@13: public: // overridden from Writer rt300@13: virtual std::string write( const Value &root ); rt300@13: rt300@13: private: rt300@13: void writeValue( const Value &value ); rt300@13: rt300@13: std::string document_; rt300@13: bool yamlCompatiblityEnabled_; rt300@13: }; rt300@13: rt300@13: /** \brief Writes a Value in JSON format in a human friendly way. rt300@13: * rt300@13: * The rules for line break and indent are as follow: rt300@13: * - Object value: rt300@13: * - if empty then print {} without indent and line break rt300@13: * - if not empty the print '{', line break & indent, print one value per line rt300@13: * and then unindent and line break and print '}'. rt300@13: * - Array value: rt300@13: * - if empty then print [] without indent and line break rt300@13: * - if the array contains no object value, empty array or some other value types, rt300@13: * and all the values fit on one lines, then print the array on a single line. rt300@13: * - otherwise, it the values do not fit on one line, or the array contains rt300@13: * object or non empty array, then print one value per line. rt300@13: * rt300@13: * If the Value have comments then they are outputed according to their #CommentPlacement. rt300@13: * rt300@13: * \sa Reader, Value, Value::setComment() rt300@13: */ rt300@13: class JSON_API StyledWriter: public Writer rt300@13: { rt300@13: public: rt300@13: StyledWriter(); rt300@13: virtual ~StyledWriter(){} rt300@13: rt300@13: public: // overridden from Writer rt300@13: /** \brief Serialize a Value in JSON format. rt300@13: * \param root Value to serialize. rt300@13: * \return String containing the JSON document that represents the root value. rt300@13: */ rt300@13: virtual std::string write( const Value &root ); rt300@13: rt300@13: private: rt300@13: void writeValue( const Value &value ); rt300@13: void writeArrayValue( const Value &value ); rt300@13: bool isMultineArray( const Value &value ); rt300@13: void pushValue( const std::string &value ); rt300@13: void writeIndent(); rt300@13: void writeWithIndent( const std::string &value ); rt300@13: void indent(); rt300@13: void unindent(); rt300@13: void writeCommentBeforeValue( const Value &root ); rt300@13: void writeCommentAfterValueOnSameLine( const Value &root ); rt300@13: bool hasCommentForValue( const Value &value ); rt300@13: static std::string normalizeEOL( const std::string &text ); rt300@13: rt300@13: typedef std::vector ChildValues; rt300@13: rt300@13: ChildValues childValues_; rt300@13: std::string document_; rt300@13: std::string indentString_; rt300@13: int rightMargin_; rt300@13: int indentSize_; rt300@13: bool addChildValues_; rt300@13: }; rt300@13: rt300@13: /** \brief Writes a Value in JSON format in a human friendly way, rt300@13: to a stream rather than to a string. rt300@13: * rt300@13: * The rules for line break and indent are as follow: rt300@13: * - Object value: rt300@13: * - if empty then print {} without indent and line break rt300@13: * - if not empty the print '{', line break & indent, print one value per line rt300@13: * and then unindent and line break and print '}'. rt300@13: * - Array value: rt300@13: * - if empty then print [] without indent and line break rt300@13: * - if the array contains no object value, empty array or some other value types, rt300@13: * and all the values fit on one lines, then print the array on a single line. rt300@13: * - otherwise, it the values do not fit on one line, or the array contains rt300@13: * object or non empty array, then print one value per line. rt300@13: * rt300@13: * If the Value have comments then they are outputed according to their #CommentPlacement. rt300@13: * rt300@13: * \param indentation Each level will be indented by this amount extra. rt300@13: * \sa Reader, Value, Value::setComment() rt300@13: */ rt300@13: class JSON_API StyledStreamWriter rt300@13: { rt300@13: public: rt300@13: StyledStreamWriter( std::string indentation="\t" ); rt300@13: ~StyledStreamWriter(){} rt300@13: rt300@13: public: rt300@13: /** \brief Serialize a Value in JSON format. rt300@13: * \param out Stream to write to. (Can be ostringstream, e.g.) rt300@13: * \param root Value to serialize. rt300@13: * \note There is no point in deriving from Writer, since write() should not return a value. rt300@13: */ rt300@13: void write( std::ostream &out, const Value &root ); rt300@13: rt300@13: private: rt300@13: void writeValue( const Value &value ); rt300@13: void writeArrayValue( const Value &value ); rt300@13: bool isMultineArray( const Value &value ); rt300@13: void pushValue( const std::string &value ); rt300@13: void writeIndent(); rt300@13: void writeWithIndent( const std::string &value ); rt300@13: void indent(); rt300@13: void unindent(); rt300@13: void writeCommentBeforeValue( const Value &root ); rt300@13: void writeCommentAfterValueOnSameLine( const Value &root ); rt300@13: bool hasCommentForValue( const Value &value ); rt300@13: static std::string normalizeEOL( const std::string &text ); rt300@13: rt300@13: typedef std::vector ChildValues; rt300@13: rt300@13: ChildValues childValues_; rt300@13: std::ostream* document_; rt300@13: std::string indentString_; rt300@13: int rightMargin_; rt300@13: std::string indentation_; rt300@13: bool addChildValues_; rt300@13: }; rt300@13: rt300@13: # if defined(JSON_HAS_INT64) rt300@13: std::string JSON_API valueToString( Int value ); rt300@13: std::string JSON_API valueToString( UInt value ); rt300@13: # endif // if defined(JSON_HAS_INT64) rt300@13: std::string JSON_API valueToString( LargestInt value ); rt300@13: std::string JSON_API valueToString( LargestUInt value ); rt300@13: std::string JSON_API valueToString( double value ); rt300@13: std::string JSON_API valueToString( bool value ); rt300@13: std::string JSON_API valueToQuotedString( const char *value ); rt300@13: rt300@13: /// \brief Output using the StyledStreamWriter. rt300@13: /// \see Json::operator>>() rt300@13: std::ostream& operator<<( std::ostream&, const Value &root ); rt300@13: rt300@13: } // namespace Json rt300@13: rt300@13: rt300@13: rt300@13: #endif // JSON_WRITER_H_INCLUDED rt300@13: rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: // End of content of file: include/json/writer.h rt300@13: // ////////////////////////////////////////////////////////////////////// rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: rt300@13: #endif //ifndef JSON_AMALGATED_H_INCLUDED