| 1 | #pragma once
|
|---|
| 2 |
|
|---|
| 3 | namespace ActiveBasic{ namespace Common{ namespace Lexical{
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | class NamespaceSupporter
|
|---|
| 7 | {
|
|---|
| 8 | const NamespaceScopesCollection *allNamespaceScopesCollection;
|
|---|
| 9 |
|
|---|
| 10 | // Importsされた名前空間
|
|---|
| 11 | NamespaceScopesCollection importedNamespaces;
|
|---|
| 12 |
|
|---|
| 13 | // 現在の名前空間
|
|---|
| 14 | NamespaceScopes livingNamespaceScopes;
|
|---|
| 15 |
|
|---|
| 16 | public:
|
|---|
| 17 | NamespaceSupporter()
|
|---|
| 18 | : allNamespaceScopesCollection( NULL )
|
|---|
| 19 | {
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | void RegistAllNamespaceScopesCollection( const NamespaceScopesCollection *allNamespaceScopesCollection )
|
|---|
| 23 | {
|
|---|
| 24 | this->allNamespaceScopesCollection = allNamespaceScopesCollection;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | const NamespaceScopesCollection &GetImportedNamespaces() const
|
|---|
| 28 | {
|
|---|
| 29 | return importedNamespaces;
|
|---|
| 30 | }
|
|---|
| 31 | void SetImportedNamespaces( const NamespaceScopesCollection &namespaces )
|
|---|
| 32 | {
|
|---|
| 33 | this->importedNamespaces = namespaces;
|
|---|
| 34 | }
|
|---|
| 35 | void ClearImportedNamespaces()
|
|---|
| 36 | {
|
|---|
| 37 | this->importedNamespaces.clear();
|
|---|
| 38 | }
|
|---|
| 39 | bool ImportsNamespace( const NamespaceScopes &namespaceScopes );
|
|---|
| 40 | bool ImportsNamespace( const std::string &namespaceStr );
|
|---|
| 41 |
|
|---|
| 42 | NamespaceScopes &GetLivingNamespaceScopes()
|
|---|
| 43 | {
|
|---|
| 44 | return livingNamespaceScopes;
|
|---|
| 45 | }
|
|---|
| 46 | void SetLivingNamespaceScopes( const NamespaceScopes &namespaceScopes )
|
|---|
| 47 | {
|
|---|
| 48 | this->livingNamespaceScopes = namespaceScopes;
|
|---|
| 49 | }
|
|---|
| 50 | bool IsLiving( const NamespaceScopes &namespaceScopes ) const
|
|---|
| 51 | {
|
|---|
| 52 | return NamespaceScopes::IsBelong( namespaceScopes, livingNamespaceScopes );
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | // 包括しているかをチェック
|
|---|
| 57 | // 例:
|
|---|
| 58 | // this = "Discoversoft.ActiveBasic"
|
|---|
| 59 | // living = "Discoversoft.ActiveBasic"
|
|---|
| 60 | // entryName = "ActiveBasic"
|
|---|
| 61 | // この場合、living は entryName を包括している。
|
|---|
| 62 | bool IsCoverd( const NamespaceScopes &base, const NamespaceScopes &entry ) const;
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | // 指定された名前空間が同一エリアと見なされるかどうかをチェック
|
|---|
| 66 | bool IsSameAreaNamespace( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes ) const;
|
|---|
| 67 |
|
|---|
| 68 | private:
|
|---|
| 69 | NamespaceSupporter(NamespaceSupporter const&);
|
|---|
| 70 | NamespaceSupporter& operator =(NamespaceSupporter const&);
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 | }}}
|
|---|