Changeset 73 in dev for BasicCompiler_Common/Type.h


Ignore:
Timestamp:
Mar 16, 2007, 11:07:14 PM (17 years ago)
Author:
dai_9181
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Type.h

    r71 r73  
    44
    55class Type{
     6    static const int basicTypeList[];
     7    static const string basicTypeNameList[];
     8
     9
    610    int basicType;
    711    union{
     
    1014    };
    1115
    12     static const int basicTypeList[];
    13     static const string basicTypeNameList[];
    14 
    1516public:
    1617
     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 ){}
    1724    Type( int basicType ):
    1825      basicType( basicType ),
     
    3138      index( type.index ){}
    3239
    33     int BasicType() const
     40    int GetBasicType() const
    3441    {
     42#ifdef _DEBUG
     43        if( basicType<-10000 ){
     44            DebugBreak();
     45        }
     46#endif
    3547        return basicType;
    3648    }
     
    4456    }
    4557
     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
    4676    void PtrLevelUp(){
    4777        PTR_LEVEL_UP( basicType );
    4878    }
    4979
    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;
    5581
    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;
    5991
    60             }
    61             else{
    62                 return true;
    63             }
    64         }
    65         return false;
    66     }
    67 
    68     bool IsPointer() const
    69     {
    70         if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC
    71             || ( 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 );
    8292};
    8393
Note: See TracChangeset for help on using the changeset viewer.