bool FundamentalValue::Equals(const Value* other) const { if(other->GetType() != GetType()) { return false; } switch(GetType()) { case TYPE_BOOLEAN: { bool lhs, rhs; return GetAsBoolean(&lhs) && other->GetAsBoolean(&rhs) && lhs==rhs; } case TYPE_INTEGER: { int lhs, rhs; return GetAsInteger(&lhs) && other->GetAsInteger(&rhs) && lhs==rhs; } case TYPE_DOUBLE: { double lhs, rhs; return GetAsDouble(&lhs) && other->GetAsDouble(&rhs) && lhs==rhs; } default: NOTREACHED(); return false; } }
bool DataFieldFloat::SetAsBoolean(bool Value){ bool res = GetAsBoolean(); if (res != Value){ if (Value) SetAsFloat(1.0); else SetAsFloat(0.0); } return(res); }
void DataFieldBoolean::Dec(void) { SetAsBoolean(!GetAsBoolean()); }
Definition::operator bool() { bool b; GetAsBoolean(b); return b; }