mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-23 00:07:58 +02:00
Value::compare() is now const and has an actual implementation with unit tests.
This commit is contained in:
@@ -524,35 +524,16 @@ Value::type() const
|
||||
|
||||
|
||||
int
|
||||
Value::compare( const Value &other )
|
||||
Value::compare( const Value &other ) const
|
||||
{
|
||||
/*
|
||||
int typeDelta = other.type_ - type_;
|
||||
switch ( type_ )
|
||||
{
|
||||
case nullValue:
|
||||
|
||||
return other.type_ == type_;
|
||||
case intValue:
|
||||
if ( other.type_.isNumeric()
|
||||
case uintValue:
|
||||
case realValue:
|
||||
case booleanValue:
|
||||
break;
|
||||
case stringValue,
|
||||
break;
|
||||
case arrayValue:
|
||||
delete value_.array_;
|
||||
break;
|
||||
case objectValue:
|
||||
delete value_.map_;
|
||||
default:
|
||||
JSON_ASSERT_UNREACHABLE;
|
||||
}
|
||||
*/
|
||||
return 0; // unreachable
|
||||
if ( *this < other )
|
||||
return -1;
|
||||
if ( *this > other )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Value::operator <( const Value &other ) const
|
||||
{
|
||||
@@ -594,7 +575,7 @@ Value::operator <( const Value &other ) const
|
||||
default:
|
||||
JSON_ASSERT_UNREACHABLE;
|
||||
}
|
||||
return 0; // unreachable
|
||||
return false; // unreachable
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -656,7 +637,7 @@ Value::operator ==( const Value &other ) const
|
||||
default:
|
||||
JSON_ASSERT_UNREACHABLE;
|
||||
}
|
||||
return 0; // unreachable
|
||||
return false; // unreachable
|
||||
}
|
||||
|
||||
bool
|
||||
|
Reference in New Issue
Block a user