#pragma once namespace ActiveBasic{ namespace Common{ namespace Lexical{ class NamespaceSupporter { const NamespaceScopesCollection *allNamespaceScopesCollection; // Importsされた名前空間 NamespaceScopesCollection importedNamespaces; // 現在の名前空間 NamespaceScopes livingNamespaceScopes; public: NamespaceSupporter() : allNamespaceScopesCollection( NULL ) { } void RegistAllNamespaceScopesCollection( const NamespaceScopesCollection *allNamespaceScopesCollection ) { this->allNamespaceScopesCollection = allNamespaceScopesCollection; } const NamespaceScopesCollection &GetImportedNamespaces() const { return importedNamespaces; } void SetImportedNamespaces( const NamespaceScopesCollection &namespaces ) { this->importedNamespaces = namespaces; } void ClearImportedNamespaces() { this->importedNamespaces.clear(); } bool ImportsNamespace( const NamespaceScopes &namespaceScopes ); bool ImportsNamespace( const std::string &namespaceStr ); NamespaceScopes &GetLivingNamespaceScopes() { return livingNamespaceScopes; } void SetLivingNamespaceScopes( const NamespaceScopes &namespaceScopes ) { this->livingNamespaceScopes = namespaceScopes; } bool IsLiving( const NamespaceScopes &namespaceScopes ) const { return NamespaceScopes::IsBelong( namespaceScopes, livingNamespaceScopes ); } // 包括しているかをチェック // 例: // this = "Discoversoft.ActiveBasic" // living = "Discoversoft.ActiveBasic" // entryName = "ActiveBasic" // この場合、living は entryName を包括している。 bool IsCoverd( const NamespaceScopes &base, const NamespaceScopes &entry ) const; // 指定された名前空間が同一エリアと見なされるかどうかをチェック bool IsSameAreaNamespace( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes ) const; private: NamespaceSupporter(NamespaceSupporter const&); NamespaceSupporter& operator =(NamespaceSupporter const&); }; }}}