Ignore:
Timestamp:
Apr 25, 2007, 4:19:28 AM (17 years ago)
Author:
dai_9181
Message:

名前空間機能をグローバル関数に適用(作業完了)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/include/Namespace.h

    r100 r101  
    1111public:
    1212    NamespaceScopes(){}
     13    NamespaceScopes( const char *name );
    1314    ~NamespaceScopes(){}
    1415
    15     void ToString( string &namespaceStr ) const
     16    string ToString() const
    1617    {
     18        string namespaceStr;
    1719        const vector<string> &me = *this;
    1820
     
    2830            namespaceStr += itemStr;
    2931        }
     32        return namespaceStr;
    3033    }
    3134
    32     bool Equal( const string &name ) const
     35    // 等しいかをチェック
     36    bool IsEqual( const string &name ) const
    3337    {
    34         string tempName;
    35         ToString( tempName );
    36         if( tempName == name ){
     38        if( ToString() == name ){
    3739            return true;
    3840        }
     
    4042    }
    4143
     44    // 等しいかをチェック
     45    bool IsEqual( const NamespaceScopes &namespaceScopes ) const
     46    {
     47        if( ToString() == namespaceScopes.ToString() ){
     48            return true;
     49        }
     50        return false;
     51    }
     52
     53    // 所属しているかをチェック
     54    // 例:
     55    // baseNamespaceScopes =  "Discoversoft"
     56    // entryNamespaceScopes = "Discoversoft.ActiveBasic"
     57    // この場合、entryNamespaceScopes は baseNamespaceScopes に所属している。
     58    static bool IsBelong( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes )
     59    {
     60        if( baseNamespaceScopes.size() > entryNamespaceScopes.size() ){
     61            return false;
     62        }
     63
     64        for( int i=0; i<(int)baseNamespaceScopes.size(); i++ ){
     65            if( baseNamespaceScopes[i] != entryNamespaceScopes[i] ){
     66                return false;
     67            }
     68        }
     69        return true;
     70    }
     71
    4272    bool IsUsing() const
    4373    {
     74        // TODO: 実装
    4475        return false;
    4576    }
     77
     78    bool IsLiving() const;
     79
     80    // 包括しているかをチェック
     81    // 例:
     82    // this =   "Discoversoft.ActiveBasic"
     83    // living = "Discoversoft.ActiveBasic"
     84    // name =   "ActiveBasic"
     85    // この場合、living は name を包括している。
     86    bool IsCoverd( const string &name ) const;
     87    bool IsCoverd( const NamespaceScopes &namespaceScopes ) const;
    4688};
Note: See TracChangeset for help on using the changeset viewer.