/* * This file is part of the Cforall project * * $Id: BasicType.cc,v 1.10 2005/08/29 20:59:25 rcbilson Exp $ * */ #include #include "Type.h" BasicType::BasicType( const Type::Qualifiers &tq, Kind bt ) : Type( tq ), kind( bt ) { } void BasicType::print( std::ostream &os, int indent ) const { static const char *kindNames[] = { "bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int", "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int", "long long unsigned int", "float", "double", "long double", "float complex", "double complex", "long double complex", "float imaginary", "double imaginary", "long double imaginary" }; Type::print( os, indent ); os << kindNames[ kind ] << ' '; } bool BasicType::isInteger() const { switch( kind ) { case Bool: case Char: case SignedChar: case UnsignedChar: case ShortSignedInt: case ShortUnsignedInt: case SignedInt: case UnsignedInt: case LongSignedInt: case LongUnsignedInt: case LongLongSignedInt: case LongLongUnsignedInt: return true; case Float: case Double: case LongDouble: case FloatComplex: case DoubleComplex: case LongDoubleComplex: case FloatImaginary: case DoubleImaginary: case LongDoubleImaginary: return false; case NUMBER_OF_BASIC_TYPES: assert( false ); } assert( false ); return false; }