Ignore:
Timestamp:
Aug 23, 2007, 6:17:00 PM (17 years ago)
Author:
dai_9181
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/include/Type.h

    r293 r299  
    2626        const CClass *pClass;
    2727    };
     28
     29    // ジェネリクス クラス インスタンス型の場合に使う
    2830    GenericTypes actualGenericTypes;
     31
     32    // 型パラメータで使う
     33    std::string formalTypeName; // 型パラメータの名前
     34    int formalTypeIndex;        // 型パラメータの引数番号
    2935
    3036    // XMLシリアライズ用
     
    4450        {
    4551            ar & BOOST_SERIALIZATION_NVP( index );
     52        }
     53
     54        if( IsTypeParameter() )
     55        {
     56            ar & BOOST_SERIALIZATION_NVP( formalTypeName );
     57            ar & BOOST_SERIALIZATION_NVP( formalTypeIndex );
    4658        }
    4759    }
     
    7183        , index( type.index )
    7284        , actualGenericTypes( type.actualGenericTypes )
     85        , formalTypeName( type.formalTypeName )
     86        , formalTypeIndex( type.formalTypeIndex )
    7387    {
    7488    }
     
    8195        index = type.index;
    8296        actualGenericTypes = type.actualGenericTypes;
     97        formalTypeName = type.formalTypeName;
     98        formalTypeIndex = type.formalTypeIndex;
    8399    }
    84100
     
    176192    bool HasMember() const;
    177193
     194    // 型パラメータの名前を取得
     195    const std::string &GetFormalTypeName() const
     196    {
     197        if( !IsTypeParameter() )
     198        {
     199            Jenga::Throw( "型パラメータでない型に対してGetFormalTypeNameメソッドが呼ばれた" );
     200        }
     201        return formalTypeName;
     202    }
     203    void SetFormalTypeName( const std::string &formalTypeName )
     204    {
     205        if( !IsTypeParameter() )
     206        {
     207            Jenga::Throw( "型パラメータでない型に対してSetFormalTypeNameメソッドが呼ばれた" );
     208        }
     209        this->formalTypeName = formalTypeName;
     210    }
     211    int GetFormalTypeIndex() const
     212    {
     213        if( !IsTypeParameter() )
     214        {
     215            Jenga::Throw( "型パラメータでない型に対してGetFormalTypeIndexメソッドが呼ばれた" );
     216        }
     217        return formalTypeIndex;
     218    }
     219    void SetFormalTypeIndex( int formalTypeIndex )
     220    {
     221        if( !IsTypeParameter() )
     222        {
     223            Jenga::Throw( "型パラメータでない型に対してSetFormalTypeIndexメソッドが呼ばれた" );
     224        }
     225        this->formalTypeIndex = formalTypeIndex;
     226    }
     227
    178228    // 未完成
    179229    const Type &GetDummyActualGenericType() const;
     
    189239    static int GetBasicTypeFromSimpleName( const char *variable );
    190240};
     241typedef std::vector<Type> Types;
     242
     243void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc = NULL );
    191244
    192245class GenericType
Note: See TracChangeset for help on using the changeset viewer.