Пример #1
0
    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;
        }
    }
Пример #2
0
bool DataFieldFloat::SetAsBoolean(bool Value){
  bool res = GetAsBoolean();
  if (res != Value){
    if (Value)
      SetAsFloat(1.0);
    else
      SetAsFloat(0.0);
  }
  return(res);
}
Пример #3
0
void
DataFieldBoolean::Dec(void)
{
  SetAsBoolean(!GetAsBoolean());
}
Пример #4
0
Definition::operator bool()
{
    bool b;
    GetAsBoolean(b);
    return b;
}