mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Handle empty Json values:
* Replace Json::Value::isNull() and Json::Value::empty with operator bool()
This commit is contained in:
committed by
Nik Bougalis
parent
a5a9242f4e
commit
9111ad1a9d
@@ -822,28 +822,20 @@ Value::size () const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Value::empty () const
|
||||
Value::operator bool () const
|
||||
{
|
||||
if (isNull ())
|
||||
return true;
|
||||
return false;
|
||||
|
||||
if (isString ()) {
|
||||
if (isString ())
|
||||
{
|
||||
auto s = asCString();
|
||||
return !(s && strlen(s));
|
||||
return s && strlen(s);
|
||||
}
|
||||
|
||||
return (isArray () || isObject ()) && ! size ();
|
||||
return ! (isArray () || isObject ()) || size ();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Value::operator! () const
|
||||
{
|
||||
return isNull ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Value::clear ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user