Changeset 75 in dev for BasicCompiler_Common/Type.h


Ignore:
Timestamp:
Mar 20, 2007, 4:36:16 AM (17 years ago)
Author:
dai_9181
Message:

TYPEINFO→Typeへのリファクタリングを実施。64bitはほぼ完了。32bitが全般的に未完成。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Type.h

    r73 r75  
     1#pragma once
    12
    2 #ifndef _ACTIVEBASIC_COMPILER_TYPE_H
    3 #define _ACTIVEBASIC_COMPILER_TYPE_H
     3class CClass;
    44
    55class Type{
     
    1818    static bool StringToBasicType( const string &typeName, int &basicType );
    1919    static bool StringToType( const string &typeName, Type &type );
     20    static int GetBasicSize( int basicType );
    2021
    2122    Type():
     
    3031      index( index ){}
    3132
    32     Type( int basicType, CClass &objClass ):
     33    Type( int basicType, const CClass &objClass ):
    3334      basicType( basicType ),
    3435      index( (LONG_PTR)&objClass ){}
     
    3839      index( type.index ){}
    3940
    40     int GetBasicType() const
     41    __inline int GetBasicType() const
    4142    {
    42 #ifdef _DEBUG
    43         if( basicType<-10000 ){
    44             DebugBreak();
    45         }
    46 #endif
    4743        return basicType;
    4844    }
     
    6460    void SetNull(){
    6561        SetBasicType( DEF_NON );
     62        SetIndex( -1 );
    6663    }
    6764    void SetType( int basicType, LONG_PTR index ){
     
    7471    }
    7572
     73    int PtrLevel() const
     74    {
     75        return PTR_LEVEL( basicType );
     76    }
    7677    void PtrLevelUp(){
    7778        PTR_LEVEL_UP( basicType );
     79    }
     80    void PtrLevelDown(){
     81        PTR_LEVEL_DOWN( basicType );
    7882    }
    7983
    8084    bool Equals( const Type &type ) const;
    8185
     86    int GetBasicSize() const;
     87    int GetSize() const;
     88
    8289    bool IsNull() const;
     90
     91    bool IsByte() const;
     92    bool IsSByte() const;
     93    bool IsWord() const;
     94    bool IsInteger() const;
     95    bool IsDWord() const;
     96    bool IsLong() const;
     97    bool IsQWord() const;
     98    bool IsInt64() const;
     99    bool IsSingle() const;
     100    bool IsDouble() const;
     101    bool IsBoolean() const;
     102
    83103    bool IsPointer() const;
    84104    bool IsSigned() const;
     
    89109    bool IsProcPtr() const;
    90110    bool IsStruct() const;
     111    bool IsStructPtr() const;
     112    bool IsObject() const;
     113    bool IsObjectPtr() const;
     114    bool IsStringObject() const;
     115    bool IsVoidPtr() const;
     116    bool IsAny() const;
    91117
     118    const string ToString() const;
     119
     120    void operator= ( const Type &type ){
     121        basicType = type.basicType;
     122        index = type.index;
     123    }
    92124};
    93 
    94 #endif //_ACTIVEBASIC_COMPILER_TYPE_H
Note: See TracChangeset for help on using the changeset viewer.