Browse Source

Space::to_bool() return true now when a string/object or table is non empty

htmlparserlistener
Tomasz Sowa 1 year ago
parent
commit
5eff9a5f4f
  1. 27
      src/space/space.cpp

27
src/space/space.cpp

@ -827,8 +827,31 @@ bool Space::to_bool() const
if( type == type_bool )
return value.value_bool;
long long val = to_long_long();
return (val != 0) ? true : false;
if( type == type_long )
return value.value_long != 0;
if( type == type_float )
return value.value_float != 0.0f;
if( type == type_double )
return value.value_double != 0.0;
if( type == type_long_double )
return value.value_long_double != 0.0L;
if( type == type_string )
return !value.value_string.empty();
if( type == type_wstring )
return !value.value_wstring.empty();
if( type == type_table )
return !value.value_table.empty();
if( type == type_object )
return !value.value_object.empty();
return false;
}
short Space::to_short() const

Loading…
Cancel
Save