Changeset 73 in dev for BasicCompiler_Common/Type.h
- Timestamp:
- Mar 16, 2007, 11:07:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/Type.h
r71 r73 4 4 5 5 class Type{ 6 static const int basicTypeList[]; 7 static const string basicTypeNameList[]; 8 9 6 10 int basicType; 7 11 union{ … … 10 14 }; 11 15 12 static const int basicTypeList[];13 static const string basicTypeNameList[];14 15 16 public: 16 17 18 static bool StringToBasicType( const string &typeName, int &basicType ); 19 static bool StringToType( const string &typeName, Type &type ); 20 21 Type(): 22 basicType( DEF_NON ), 23 index( -1 ){} 17 24 Type( int basicType ): 18 25 basicType( basicType ), … … 31 38 index( type.index ){} 32 39 33 int BasicType() const40 int GetBasicType() const 34 41 { 42 #ifdef _DEBUG 43 if( basicType<-10000 ){ 44 DebugBreak(); 45 } 46 #endif 35 47 return basicType; 36 48 } … … 44 56 } 45 57 58 void SetBasicType( int basicType ){ 59 this->basicType = basicType; 60 } 61 void SetIndex( LONG_PTR index ){ 62 this->index = index; 63 } 64 void SetNull(){ 65 SetBasicType( DEF_NON ); 66 } 67 void SetType( int basicType, LONG_PTR index ){ 68 SetBasicType( basicType ); 69 SetIndex( index ); 70 } 71 void SetType( int basicType, CClass *pClass ){ 72 SetBasicType( basicType ); 73 this->pClass = pClass; 74 } 75 46 76 void PtrLevelUp(){ 47 77 PTR_LEVEL_UP( basicType ); 48 78 } 49 79 50 bool Equals( const Type &type ) const 51 { 52 if( basicType == type.basicType ){ 53 if( NATURAL_TYPE( basicType ) == DEF_OBJECT 54 || NATURAL_TYPE( basicType ) == DEF_STRUCT ){ 80 bool Equals( const Type &type ) const; 55 81 56 if( index == type.index ){ 57 return true; 58 } 82 bool IsNull() const; 83 bool IsPointer() const; 84 bool IsSigned() const; 85 bool IsNaturalWhole() const; 86 bool IsWhole() const; 87 bool IsReal() const; 88 bool Is64() const; 89 bool IsProcPtr() const; 90 bool IsStruct() const; 59 91 60 }61 else{62 return true;63 }64 }65 return false;66 }67 68 bool IsPointer() const69 {70 if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC71 || ( basicType & FLAG_PTR ) ){72 return true;73 }74 75 return false;76 }77 78 79 80 static bool StringToBasicType( const string &typeName, int &basicType );81 static bool StringToType( const string &typeName, Type &type );82 92 }; 83 93
Note:
See TracChangeset
for help on using the changeset viewer.