source: dev/BasicCompiler_Common/Type.h@ 74

Last change on this file since 74 was 73, checked in by dai_9181, 17 years ago

Parameterクラスを適用。32bit側は動くようになったので、64bitのほうを調整する。

File size: 1.8 KB
Line 
1
2#ifndef _ACTIVEBASIC_COMPILER_TYPE_H
3#define _ACTIVEBASIC_COMPILER_TYPE_H
4
5class Type{
6 static const int basicTypeList[];
7 static const string basicTypeNameList[];
8
9
10 int basicType;
11 union{
12 LONG_PTR index;
13 CClass *pClass;
14 };
15
16public:
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 ){}
24 Type( int basicType ):
25 basicType( basicType ),
26 index( -1 ){}
27
28 Type( int basicType, LONG_PTR index ):
29 basicType( basicType ),
30 index( index ){}
31
32 Type( int basicType, CClass &objClass ):
33 basicType( basicType ),
34 index( (LONG_PTR)&objClass ){}
35
36 Type( const Type &type ):
37 basicType( type.basicType ),
38 index( type.index ){}
39
40 int GetBasicType() const
41 {
42#ifdef _DEBUG
43 if( basicType<-10000 ){
44 DebugBreak();
45 }
46#endif
47 return basicType;
48 }
49 LONG_PTR GetIndex() const
50 {
51 return index;
52 }
53 const CClass &GetClass() const
54 {
55 return *pClass;
56 }
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
76 void PtrLevelUp(){
77 PTR_LEVEL_UP( basicType );
78 }
79
80 bool Equals( const Type &type ) const;
81
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;
91
92};
93
94#endif //_ACTIVEBASIC_COMPILER_TYPE_H
Note: See TracBrowser for help on using the repository browser.