language/duchain
integraltype.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INTEGRALTYPE_H
00022 #define INTEGRALTYPE_H
00023
00024 #include "abstracttype.h"
00025 #include "typesystemdata.h"
00026
00027 namespace KDevelop
00028 {
00029 class IntegralTypeData;
00030 class IndexedString;
00031
00038 class KDEVPLATFORMLANGUAGE_EXPORT IntegralType: public AbstractType
00039 {
00040 public:
00041 typedef TypePtr<IntegralType> Ptr;
00042
00048 enum CommonIntegralTypes {
00049 TypeVoid,
00050 TypeNone,
00051 TypeNull,
00052 TypeChar,
00053 TypeBoolean,
00054 TypeByte,
00055 TypeSbyte,
00056 TypeShort,
00057 TypeInt,
00058 TypeLong,
00059 TypeFloat,
00060 TypeDouble,
00061 TypeWchar_t,
00062 TypeString,
00063 TypeMixed,
00064 TypeLanguageSpecific = 200
00065 };
00066
00068 IntegralType(uint type = TypeNone);
00070 IntegralType(const IntegralType& rhs);
00072 IntegralType(IntegralTypeData& data);
00074 virtual ~IntegralType();
00075
00081 uint dataType() const;
00082
00088 void setDataType(uint dataType);
00089
00090 virtual QString toString() const;
00091
00092 virtual uint hash() const;
00093
00094 virtual WhichType whichType() const;
00095
00096 virtual AbstractType* clone() const;
00097
00098 virtual bool equals(const AbstractType* rhs) const;
00099
00100 enum {
00101 Identity = 2
00102 };
00103
00104 typedef IntegralTypeData Data;
00105
00106 protected:
00107 virtual void accept0 (TypeVisitor *v) const;
00108
00109 TYPE_DECLARE_DATA(IntegralType)
00110 };
00111
00112 template<>
00113 inline IntegralType* fastCast<IntegralType*>(AbstractType* from) {
00114 if(!from || from->whichType() != AbstractType::TypeIntegral)
00115 return 0;
00116 else
00117 return static_cast<IntegralType*>(from);
00118 }
00119
00120 }
00121
00122 #endif
00123
00124