Fixed a bunch of compilation errors when JSON_HAS_INT64 is set.

This commit is contained in:
Aaron Jacobs 2011-05-24 03:18:02 +00:00
parent e3d0eca9f4
commit f1053e7acb
2 changed files with 8 additions and 3 deletions

View File

@ -151,12 +151,14 @@ namespace Json {
/// Maximum unsigned int value that can be stored in a Json::Value. /// Maximum unsigned int value that can be stored in a Json::Value.
static const UInt maxUInt; static const UInt maxUInt;
# if defined(JSON_HAS_INT64)
/// Minimum signed 64 bits int value that can be stored in a Json::Value. /// Minimum signed 64 bits int value that can be stored in a Json::Value.
static const Int64 minInt64; static const Int64 minInt64;
/// Maximum signed 64 bits int value that can be stored in a Json::Value. /// Maximum signed 64 bits int value that can be stored in a Json::Value.
static const Int64 maxInt64; static const Int64 maxInt64;
/// Maximum unsigned 64 bits int value that can be stored in a Json::Value. /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
static const UInt64 maxUInt64; static const UInt64 maxUInt64;
#endif // defined(JSON_HAS_INT64)
private: private:
#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
@ -265,8 +267,10 @@ namespace Json {
# endif # endif
Int asInt() const; Int asInt() const;
UInt asUInt() const; UInt asUInt() const;
#if defined(JSON_HAS_INT64)
Int64 asInt64() const; Int64 asInt64() const;
UInt64 asUInt64() const; UInt64 asUInt64() const;
#endif // if defined(JSON_HAS_INT64)
LargestInt asLargestInt() const; LargestInt asLargestInt() const;
LargestUInt asLargestUInt() const; LargestUInt asLargestUInt() const;
float asFloat() const; float asFloat() const;

View File

@ -29,9 +29,11 @@ const Value Value::null;
const Int Value::minInt = Int( ~(UInt(-1)/2) ); const Int Value::minInt = Int( ~(UInt(-1)/2) );
const Int Value::maxInt = Int( UInt(-1)/2 ); const Int Value::maxInt = Int( UInt(-1)/2 );
const UInt Value::maxUInt = UInt(-1); const UInt Value::maxUInt = UInt(-1);
# if defined(JSON_HAS_INT64)
const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) ); const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) );
const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 ); const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 );
const UInt64 Value::maxUInt64 = UInt64(-1); const UInt64 Value::maxUInt64 = UInt64(-1);
#endif // defined(JSON_HAS_INT64)
const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) ); const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) );
const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 ); const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 );
const LargestUInt Value::maxLargestUInt = LargestUInt(-1); const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
@ -281,7 +283,6 @@ Value::Value( ValueType type )
} }
#if defined(JSON_HAS_INT64)
Value::Value( UInt value ) Value::Value( UInt value )
: type_( uintValue ) : type_( uintValue )
# ifdef JSON_VALUE_USE_INTERNAL_MAP # ifdef JSON_VALUE_USE_INTERNAL_MAP
@ -302,9 +303,8 @@ Value::Value( Int value )
value_.int_ = value; value_.int_ = value;
} }
#endif // if defined(JSON_HAS_INT64)
# if defined(JSON_HAS_INT64)
Value::Value( Int64 value ) Value::Value( Int64 value )
: type_( intValue ) : type_( intValue )
# ifdef JSON_VALUE_USE_INTERNAL_MAP # ifdef JSON_VALUE_USE_INTERNAL_MAP
@ -325,6 +325,7 @@ Value::Value( UInt64 value )
{ {
value_.uint_ = value; value_.uint_ = value;
} }
#endif // defined(JSON_HAS_INT64)
Value::Value( double value ) Value::Value( double value )
: type_( realValue ) : type_( realValue )