source: dev/trunk/abdev/BasicCompiler_Common/include/Compiler.h@ 193

Last change on this file since 193 was 193, checked in by dai_9181, 17 years ago
File size: 1.7 KB
RevLine 
[184]1#pragma once
2
3#include <CodeGenerator.h>
[193]4#include <MetaImpl.h>
5
[184]6class Compiler
7{
[193]8 NativeCode nativeCode;
9 MetaImpl metaImpl;
10
11 NamespaceScopesCollection importedNamespaces;
12
[184]13public:
[193]14 NativeCode &GetNativeCode()
[184]15 {
16 return nativeCode;
17 }
[193]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 }
[184]73};
[193]74
75static Compiler compiler;
Note: See TracBrowser for help on using the repository browser.