Fixed JSON bool evaluations.
This commit is contained in:
parent
935d5635e5
commit
a36ce260ac
1 changed files with 3 additions and 3 deletions
|
@ -286,9 +286,9 @@ JSON::Value::operator std::string(){
|
|||
/// Automatic conversion to bool.
|
||||
/// Returns true if there is anything meaningful stored into this value.
|
||||
JSON::Value::operator bool(){
|
||||
if (myType == STRING){return strVal == "";}
|
||||
if (myType == INTEGER){return intVal == 0;}
|
||||
if (myType == BOOL){return intVal == 0;}
|
||||
if (myType == STRING){return strVal != "";}
|
||||
if (myType == INTEGER){return intVal != 0;}
|
||||
if (myType == BOOL){return intVal != 0;}
|
||||
if (myType == OBJECT){return size() > 0;}
|
||||
if (myType == ARRAY){return size() > 0;}
|
||||
if (myType == EMPTY){return false;}
|
||||
|
|
Loading…
Add table
Reference in a new issue