#pragma once #include #include class Compiler { NativeCode nativeCode; MetaImpl metaImpl; NamespaceScopesCollection importedNamespaces; public: NativeCode &GetNativeCode() { return nativeCode; } MetaImpl &GetMeta() { return metaImpl; } NamespaceScopesCollection &GetImportedNamespaces() { return importedNamespaces; } void SetImportedNamespaces( const NamespaceScopesCollection &namespaces ) { this->importedNamespaces = namespaces; } bool ImportsNamespace( const std::string &namespaceStr ) { NamespaceScopes namespaceScopes( namespaceStr ); if( !this->GetMeta().GetNamespaces().IsExist( namespaceScopes ) ){ return false; } this->importedNamespaces.push_back( namespaceScopes ); return true; } static bool StringToType( const std::string &typeName, Type &type ); static const std::string TypeToString( const Type &type ); // 指定された名前空間が同一エリアと見なされるかどうかをチェック bool IsSameAreaNamespace( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes ){ if( entryNamespaceScopes.size() ){ if( baseNamespaceScopes.IsCoverd( entryNamespaceScopes ) ){ // 包括しているときは同一と見なす return true; } } else{ if( baseNamespaceScopes.size() ){ // 名前空間の判断が必要なとき if( this->importedNamespaces.IsImported( baseNamespaceScopes ) || baseNamespaceScopes.IsLiving() ){ // Using指定があるとき // または // 指定された名前空間が現在の名前空間スコープと同一のとき return true; } } else{ return true; } } return false; } }; static Compiler compiler;