Changeset 131 in dev for BasicCompiler_Common/Class.h


Ignore:
Timestamp:
Jun 4, 2007, 7:49:17 AM (17 years ago)
Author:
dai_9181
Message:

Prototypeクラスを用意した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Class.h

    r128 r131  
    22
    33#include <vector>
     4#include <string>
     5
     6#include <Prototype.h>
    47#include "Type.h"
    58#include "Procedure.h"
     
    5760class CDBClass;
    5861class CDebugSection;
    59 class CClass{
     62class CClass;
     63class InheritedInterface
     64{
     65    CClass *pInterfaceClass;
     66    int vtblOffset;
     67public:
     68    InheritedInterface( CClass *pInterfaceClass, int vtblOffset )
     69        : pInterfaceClass( pInterfaceClass )
     70        , vtblOffset( vtblOffset )
     71    {
     72    }
     73
     74    CClass &GetInterfaceClass() const{
     75        return *pInterfaceClass;
     76    }
     77    int GetVtblOffset() const
     78    {
     79        return vtblOffset;
     80    }
     81};
     82typedef vector<InheritedInterface> Interfaces;
     83class CClass : public Prototype
     84{
    6085    friend CMember;
    6186    friend CDBClass;
    6287    friend CDebugSection;
    6388
    64     // 名前空間
    65     NamespaceScopes namespaceScopes;
     89    // importされている名前空間
    6690    NamespaceScopesCollection importedNamespaces;
     91
     92    // 継承するインターフェイス
     93    Interfaces interfaces;
    6794
    6895    // Blittable型情報
     
    93120
    94121public:
    95     //クラス名
    96     char *name;
    97122
    98123    //継承クラスへのポインタ
     
    111136
    112137public:
    113     CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name );
     138    CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name );
    114139    ~CClass();
    115140
    116     const NamespaceScopes &GetNamespaceScopes() const
    117     {
    118         return namespaceScopes;
    119     }
    120141    const NamespaceScopesCollection &GetImportedNamespaces() const
    121142    {
     
    123144    }
    124145
    125     const string GetName() const
    126     {
    127         return name;
    128     }
    129 
     146    // インターフェイス
     147    bool HasInterfaces() const
     148    {
     149        return ( interfaces.size() != 0 );
     150    }
     151    bool IsInheritsInterface( const CClass *pInterfaceClass ) const;
     152
     153    // Blittable型
    130154    bool IsBlittableType() const
    131155    {
     
    140164    }
    141165
     166    // シンボル比較
    142167    bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
    143168    bool IsEqualSymbol( const CClass &objClass ) const;
     
    154179
    155180    //継承させる
    156     bool Inherits( const CClass &inheritsClass, int nowLine );
     181    bool Inherits( const char *inheritNames, int nowLine );
     182    bool InheritsClass( const CClass &inheritsClass, int nowLine );
    157183    bool InheritsInterface( const CClass &inheritsClass, int nowLine );
    158184
Note: See TracChangeset for help on using the changeset viewer.