diff options
author | montellese <montellese@xbmc.org> | 2011-01-28 14:08:12 +0100 |
---|---|---|
committer | montellese <montellese@xbmc.org> | 2011-04-01 20:35:50 +0200 |
commit | 0158bd9ab97f4a4fa8d7770f4137905a3503b224 (patch) | |
tree | c457e66ff0e2eb2a7e2121e3e2d7719dfc8c73cc /lib/jsoncpp/include | |
parent | 97b5e9f770405d37ce0f6ca95f538e80fefe18aa (diff) |
JSONRPC: update of jsoncpp library to latest revision
Diffstat (limited to 'lib/jsoncpp/include')
-rw-r--r-- | lib/jsoncpp/include/json/autolink.h | 5 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/config.h | 39 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/features.h | 5 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/forwards.h | 12 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/json.h | 5 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/reader.h | 5 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/value.h | 119 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/writer.h | 13 |
8 files changed, 156 insertions, 47 deletions
diff --git a/lib/jsoncpp/include/json/autolink.h b/lib/jsoncpp/include/json/autolink.h index 37c9258ed5..02328d1f1a 100644 --- a/lib/jsoncpp/include/json/autolink.h +++ b/lib/jsoncpp/include/json/autolink.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef JSON_AUTOLINK_H_INCLUDED # define JSON_AUTOLINK_H_INCLUDED diff --git a/lib/jsoncpp/include/json/config.h b/lib/jsoncpp/include/json/config.h index 5d334cbc5e..55f0583e60 100644 --- a/lib/jsoncpp/include/json/config.h +++ b/lib/jsoncpp/include/json/config.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef JSON_CONFIG_H_INCLUDED # define JSON_CONFIG_H_INCLUDED @@ -40,4 +45,38 @@ # define JSON_API # endif +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 +// Microsoft Visual Studio 6 only support conversion from __int64 to double +// (no conversion from unsigned __int64). +#define JSON_USE_INT64_DOUBLE_CONVERSION 1 +#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 + + +namespace Json { + typedef int Int; + typedef unsigned int UInt; +# if defined(JSON_NO_INT64) + typedef int LargestInt; + typedef unsigned int LargestUInt; +# undef JSON_HAS_INT64 +# else // if defined(JSON_NO_INT64) + // For Microsoft Visual use specific types as long long is not supported +# if defined(_MSC_VER) // Microsoft Visual Studio + typedef __int64 Int64; + typedef unsigned __int64 UInt64; +# else // if defined(_MSC_VER) // Other platforms, use long long + typedef long long int Int64; + typedef unsigned long long int UInt64; +# endif // if defined(_MSC_VER) + typedef Int64 LargestInt; + typedef UInt64 LargestUInt; +# define JSON_HAS_INT64 +# endif // if defined(JSON_NO_INT64) +} // end namespace Json + + #endif // JSON_CONFIG_H_INCLUDED diff --git a/lib/jsoncpp/include/json/features.h b/lib/jsoncpp/include/json/features.h index 5a9adec118..fd8e3509a2 100644 --- a/lib/jsoncpp/include/json/features.h +++ b/lib/jsoncpp/include/json/features.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef CPPTL_JSON_FEATURES_H_INCLUDED # define CPPTL_JSON_FEATURES_H_INCLUDED diff --git a/lib/jsoncpp/include/json/forwards.h b/lib/jsoncpp/include/json/forwards.h index ee76071c12..dd32fa0578 100644 --- a/lib/jsoncpp/include/json/forwards.h +++ b/lib/jsoncpp/include/json/forwards.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef JSON_FORWARDS_H_INCLUDED # define JSON_FORWARDS_H_INCLUDED @@ -5,14 +10,18 @@ namespace Json { + // writer.h class FastWriter; - class Reader; class StyledWriter; + // reader.h + class Reader; + // features.h class Features; // value.h + typedef unsigned int ArrayIndex; class StaticString; class Path; class PathArgument; @@ -21,7 +30,6 @@ namespace Json { class ValueIterator; class ValueConstIterator; #ifdef JSON_VALUE_USE_INTERNAL_MAP - class ValueAllocator; class ValueMapAllocator; class ValueInternalLink; class ValueInternalArray; diff --git a/lib/jsoncpp/include/json/json.h b/lib/jsoncpp/include/json/json.h index c71ed65abf..da5fc967eb 100644 --- a/lib/jsoncpp/include/json/json.h +++ b/lib/jsoncpp/include/json/json.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef JSON_JSON_H_INCLUDED # define JSON_JSON_H_INCLUDED diff --git a/lib/jsoncpp/include/json/reader.h b/lib/jsoncpp/include/json/reader.h index ee1d6a2444..62232ea372 100644 --- a/lib/jsoncpp/include/json/reader.h +++ b/lib/jsoncpp/include/json/reader.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef CPPTL_JSON_READER_H_INCLUDED # define CPPTL_JSON_READER_H_INCLUDED diff --git a/lib/jsoncpp/include/json/value.h b/lib/jsoncpp/include/json/value.h index ce3d3cd0e9..14464e4991 100644 --- a/lib/jsoncpp/include/json/value.h +++ b/lib/jsoncpp/include/json/value.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef CPPTL_JSON_H_INCLUDED # define CPPTL_JSON_H_INCLUDED @@ -117,17 +122,40 @@ namespace Json { # endif public: typedef std::vector<std::string> Members; - typedef int Int; - typedef unsigned int UInt; typedef ValueIterator iterator; typedef ValueConstIterator const_iterator; - typedef UInt ArrayIndex; + typedef Json::UInt UInt; + typedef Json::Int Int; +# if defined(JSON_HAS_INT64) + typedef Json::UInt64 UInt64; + typedef Json::Int64 Int64; +#endif // defined(JSON_HAS_INT64) + typedef Json::LargestInt LargestInt; + typedef Json::LargestUInt LargestUInt; + typedef Json::ArrayIndex ArrayIndex; static const Value null; - static const Int minInt; + /// Minimum signed integer value that can be stored in a Json::Value. + static const LargestInt minLargestInt; + /// Maximum signed integer value that can be stored in a Json::Value. + static const LargestInt maxLargestInt; + /// Maximum unsigned integer value that can be stored in a Json::Value. + static const LargestUInt maxLargestUInt; + + /// Minimum signed int value that can be stored in a Json::Value. + static const Int minInt; + /// Maximum signed int value that can be stored in a Json::Value. static const Int maxInt; + /// Maximum unsigned int value that can be stored in a Json::Value. static const UInt maxUInt; + /// Minimum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 minInt64; + /// Maximum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 maxInt64; + /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. + static const UInt64 maxUInt64; + private: #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION # ifndef JSON_VALUE_USE_INTERNAL_MAP @@ -140,20 +168,20 @@ namespace Json { duplicate, duplicateOnCopy }; - CZString( int index ); + CZString( ArrayIndex index ); CZString( const char *cstr, DuplicationPolicy allocate ); CZString( const CZString &other ); ~CZString(); CZString &operator =( const CZString &other ); bool operator<( const CZString &other ) const; bool operator==( const CZString &other ) const; - int index() const; + ArrayIndex index() const; const char *c_str() const; bool isStaticString() const; private: void swap( CZString &other ); const char *cstr_; - int index_; + ArrayIndex index_; }; public: @@ -184,8 +212,13 @@ namespace Json { Value( ValueType type = nullValue ); Value( Int value ); Value( UInt value ); +#if defined(JSON_HAS_INT64) + Value( Int64 value ); + Value( UInt64 value ); +#endif // if defined(JSON_HAS_INT64) Value( double value ); Value( const char *value ); + Value( const char *beginValue, const char *endValue ); /** \brief Constructs a value from a static string. * Like other value string constructor but do not duplicate the string for @@ -230,6 +263,11 @@ namespace Json { # endif Int asInt() const; UInt asUInt() const; + Int64 asInt64() const; + UInt64 asUInt64() const; + LargestInt asLargestInt() const; + LargestUInt asLargestUInt() const; + float asFloat() const; double asDouble() const; bool asBool() const; @@ -247,7 +285,7 @@ namespace Json { bool isConvertibleTo( ValueType other ) const; /// Number of values in array or object - UInt size() const; + ArrayIndex size() const; /// \brief Return true if empty array, empty object, or null; /// otherwise, false. @@ -266,24 +304,38 @@ namespace Json { /// May only be called on nullValue or arrayValue. /// \pre type() is arrayValue or nullValue /// \post type() is arrayValue - void resize( UInt size ); + void resize( ArrayIndex size ); /// Access an array element (zero based index ). /// If the array contains less than index element, then null value are inserted /// in the array so that its size is index+1. /// (You may need to say 'value[0u]' to get your compiler to distinguish /// this from the operator[] which takes a string.) - Value &operator[]( UInt index ); - /// Access an array element (zero based index ) + Value &operator[]( ArrayIndex index ); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value &operator[]( int index ); + + /// Access an array element (zero based index ) /// (You may need to say 'value[0u]' to get your compiler to distinguish /// this from the operator[] which takes a string.) - const Value &operator[]( UInt index ) const; - /// If the array contains at least index+1 elements, returns the element value, + const Value &operator[]( ArrayIndex index ) const; + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value &operator[]( int index ) const; + + /// If the array contains at least index+1 elements, returns the element value, /// otherwise returns defaultValue. - Value get( UInt index, + Value get( ArrayIndex index, const Value &defaultValue ) const; /// Return true if index < size(). - bool isValidIndex( UInt index ) const; + bool isValidIndex( ArrayIndex index ) const; /// \brief Append value to array at the end. /// /// Equivalent to jsonvalue[jsonvalue.size()] = value; @@ -423,8 +475,8 @@ namespace Json { union ValueHolder { - Int int_; - UInt uint_; + LargestInt int_; + LargestUInt uint_; double real_; bool bool_; char *string_; @@ -453,7 +505,7 @@ namespace Json { friend class Path; PathArgument(); - PathArgument( Value::UInt index ); + PathArgument( ArrayIndex index ); PathArgument( const char *key ); PathArgument( const std::string &key ); @@ -465,7 +517,7 @@ namespace Json { kindKey }; std::string key_; - Value::UInt index_; + ArrayIndex index_; Kind kind_; }; @@ -512,26 +564,7 @@ namespace Json { Args args_; }; - /** \brief Allocator to customize member name and string value memory management done by Value. - * - * - makeMemberName() and releaseMemberName() are called to respectively duplicate and - * free an Json::objectValue member name. - * - duplicateStringValue() and releaseStringValue() are called similarly to - * duplicate and free a Json::stringValue value. - */ - class ValueAllocator - { - public: - enum { unknown = (unsigned)-1 }; - virtual ~ValueAllocator(); - - virtual char *makeMemberName( const char *memberName ) = 0; - virtual void releaseMemberName( char *memberName ) = 0; - virtual char *duplicateStringValue( const char *value, - unsigned int length = unknown ) = 0; - virtual void releaseStringValue( char *value ) = 0; - }; #ifdef JSON_VALUE_USE_INTERNAL_MAP /** \brief Allocator to customize Value internal map. @@ -784,7 +817,7 @@ namespace Json { PageIndex pageCount_; }; - /** \brief Allocator to customize Value internal array. + /** \brief Experimental: do not use. Allocator to customize Value internal array. * Below is an example of a simple implementation (actual implementation use * memory pool). \code @@ -872,7 +905,7 @@ public: // overridden from ValueArrayAllocator #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP - /** \brief Experimental and untested: base class for Value iterators. + /** \brief base class for Value iterators. * */ class ValueIteratorBase @@ -909,7 +942,7 @@ public: // overridden from ValueArrayAllocator Value key() const; /// Return the index of the referenced Value. -1 if it is not an arrayValue. - Value::UInt index() const; + UInt index() const; /// Return the member name of the referenced Value. "" if it is not an objectValue. const char *memberName() const; @@ -942,7 +975,7 @@ public: // overridden from ValueArrayAllocator #endif }; - /** \brief Experimental and untested: const iterator for object and array value. + /** \brief const iterator for object and array value. * */ class ValueConstIterator : public ValueIteratorBase @@ -1001,7 +1034,7 @@ public: // overridden from ValueArrayAllocator }; - /** \brief Experimental and untested: iterator for object and array value. + /** \brief Iterator for object and array value. */ class ValueIterator : public ValueIteratorBase { diff --git a/lib/jsoncpp/include/json/writer.h b/lib/jsoncpp/include/json/writer.h index cfa92c6ae4..2ee13ded93 100644 --- a/lib/jsoncpp/include/json/writer.h +++ b/lib/jsoncpp/include/json/writer.h @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #ifndef JSON_WRITER_H_INCLUDED # define JSON_WRITER_H_INCLUDED @@ -157,8 +162,12 @@ namespace Json { bool addChildValues_; }; - std::string JSON_API valueToString( Value::Int value ); - std::string JSON_API valueToString( Value::UInt value ); +# if defined(JSON_HAS_INT64) + std::string JSON_API valueToString( Int value ); + std::string JSON_API valueToString( UInt value ); +# endif // if defined(JSON_HAS_INT64) + std::string JSON_API valueToString( LargestInt value ); + std::string JSON_API valueToString( LargestUInt value ); std::string JSON_API valueToString( double value ); std::string JSON_API valueToString( bool value ); std::string JSON_API valueToQuotedString( const char *value ); |