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