mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-05-21 20:26:35 +02:00
Added empty() operator-bang and isNull()
This commit is contained in:
parent
1aa20f9e58
commit
208a781e47
@ -233,6 +233,7 @@ namespace Json {
|
|||||||
double asDouble() const;
|
double asDouble() const;
|
||||||
bool asBool() const;
|
bool asBool() const;
|
||||||
|
|
||||||
|
bool isNull() const;
|
||||||
bool isBool() const;
|
bool isBool() const;
|
||||||
bool isInt() const;
|
bool isInt() const;
|
||||||
bool isUInt() const;
|
bool isUInt() const;
|
||||||
@ -248,7 +249,14 @@ namespace Json {
|
|||||||
/// Number of values in array or object
|
/// Number of values in array or object
|
||||||
UInt size() const;
|
UInt size() const;
|
||||||
|
|
||||||
/// Removes all object members and array elements.
|
/// \brief Return true if empty array, empty object, or null;
|
||||||
|
/// otherwise, false.
|
||||||
|
bool empty() const;
|
||||||
|
|
||||||
|
/// Return isNull()
|
||||||
|
bool operator!() const;
|
||||||
|
|
||||||
|
/// Remove all object members and array elements.
|
||||||
/// \pre type() is arrayValue, objectValue, or nullValue
|
/// \pre type() is arrayValue, objectValue, or nullValue
|
||||||
/// \post type() is unchanged
|
/// \post type() is unchanged
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -888,6 +888,23 @@ Value::size() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Value::empty() const
|
||||||
|
{
|
||||||
|
if ( isNull() || isArray() || isObject() )
|
||||||
|
return size() == 0u;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Value::operator!() const
|
||||||
|
{
|
||||||
|
return isNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Value::clear()
|
Value::clear()
|
||||||
{
|
{
|
||||||
@ -1217,6 +1234,13 @@ Value::getMemberNames() const
|
|||||||
//# endif
|
//# endif
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Value::isNull() const
|
||||||
|
{
|
||||||
|
return type_ == nullValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Value::isBool() const
|
Value::isBool() const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user