Ignore:
Timestamp:
Jun 26, 2007, 5:04:50 AM (17 years ago)
Author:
dai_9181
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/include/Compiler.h

    r184 r193  
    22
    33#include <CodeGenerator.h>
     4#include <MetaImpl.h>
     5
    46class Compiler
    57{
    6     static NativeCode nativeCode;
     8    NativeCode nativeCode;
     9    MetaImpl metaImpl;
     10
     11    NamespaceScopesCollection importedNamespaces;
     12
    713public:
    8     static NativeCode &GetNativeCode()
     14    NativeCode &GetNativeCode()
    915    {
    1016        return nativeCode;
    1117    }
     18
     19    MetaImpl &GetMeta()
     20    {
     21        return metaImpl;
     22    }
     23
     24    NamespaceScopesCollection &GetImportedNamespaces()
     25    {
     26        return importedNamespaces;
     27    }
     28    void SetImportedNamespaces( const NamespaceScopesCollection &namespaces )
     29    {
     30        this->importedNamespaces = namespaces;
     31    }
     32    bool ImportsNamespace( const std::string &namespaceStr )
     33    {
     34        NamespaceScopes namespaceScopes( namespaceStr );
     35        if( !this->GetMeta().GetNamespaces().IsExist( namespaceScopes ) ){
     36            return false;
     37        }
     38
     39        this->importedNamespaces.push_back( namespaceScopes );
     40
     41        return true;
     42    }
     43
     44    static bool StringToType( const std::string &typeName, Type &type );
     45    static const std::string TypeToString( const Type &type );
     46
     47    // 指定された名前空間が同一エリアと見なされるかどうかをチェック
     48    bool IsSameAreaNamespace( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes ){
     49        if( entryNamespaceScopes.size() ){
     50            if( baseNamespaceScopes.IsCoverd( entryNamespaceScopes ) ){
     51                // 包括しているときは同一と見なす
     52                return true;
     53            }
     54        }
     55        else{
     56            if( baseNamespaceScopes.size() ){
     57                // 名前空間の判断が必要なとき
     58                if( this->importedNamespaces.IsImported( baseNamespaceScopes )
     59                    || baseNamespaceScopes.IsLiving() ){
     60                    // Using指定があるとき
     61                    // または
     62                    // 指定された名前空間が現在の名前空間スコープと同一のとき
     63                    return true;
     64                }
     65            }
     66            else{
     67                return true;
     68            }
     69        }
     70
     71        return false;
     72    }
    1273};
     74
     75static Compiler compiler;
Note: See TracChangeset for help on using the changeset viewer.