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

Last change on this file since 270 was 270, checked in by dai_9181, 17 years ago
File size: 2.1 KB
RevLine 
[184]1#pragma once
2
3#include <CodeGenerator.h>
[199]4#include <NamespaceSupporter.h>
[256]5#include <Meta.h>
[224]6#include <DataTable.h>
[225]7#include <CodeGenerator.h>
[270]8#include <ObjectModule.h>
[256]9#include <Linker.h>
[193]10
[184]11class Compiler
12{
[199]13 // 名前空間サポート
14 NamespaceSupporter namespaceSupporter;
15
[265]16 // オブジェクトモジュール
17 ObjectModule *pObjectModule;
18 ObjectModule *pNowObjectModule;
19
[184]20public:
[193]21
[265]22 Compiler()
23 : pObjectModule( new ObjectModule )
24 , pNowObjectModule( pObjectModule )
[266]25 , targetModuleType( Exe )
[265]26 {
27 }
28 ~Compiler()
29 {
30 delete pObjectModule;
[270]31 Clear();
[265]32 }
[270]33 void Clear()
34 {
35 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
36 {
37 delete pStaticLibrary;
38 }
39 staticLibraries.clear();
40 }
[265]41
[270]42 void StaticLink( ObjectModules &staticLibraries );
43
[199]44 NamespaceSupporter &GetNamespaceSupporter()
45 {
46 return namespaceSupporter;
47 }
48
[268]49 // ソースコード
50 BasicSource source;
51
[225]52 // コード生成機構
53 CodeGenerator codeGenerator;
54
[256]55 // リンカ
56 Linker linker;
57
[269]58 // 静的リンクするオブジェクトファイル
59 std::vector<std::string> staticLibraryFilePaths;
60
[270]61 // 静的リンクするオブジェクトモジュール
62 ObjectModules staticLibraries;
63
[266]64 // オブジェクトモジュール
[265]65 ObjectModule &GetObjectModule()
66 {
67 return *pNowObjectModule;
68 }
69 void SelectObjectModule( ObjectModule &objectModule )
70 {
71 pNowObjectModule = &objectModule;
72 }
73
[266]74
75 // ターゲット
76 enum TargetModuleType
77 {
78 Exe,
79 Dll,
80 StaticLibrary,
81 };
82
83 TargetModuleType targetModuleType;
84
85 bool IsExe() const
86 {
87 if( targetModuleType == Exe )
88 {
89 return true;
90 }
91 return false;
92 }
93 bool IsDll() const
94 {
95 if( targetModuleType == Dll )
96 {
97 return true;
98 }
99 return false;
100 }
101 bool IsStaticLibrary() const
102 {
103 if( targetModuleType == StaticLibrary )
104 {
105 return true;
106 }
107 return false;
108 }
109 void SetTargetModuleType( TargetModuleType targetModuleType )
110 {
111 this->targetModuleType = targetModuleType;
112 }
113
114
[193]115 static bool StringToType( const std::string &typeName, Type &type );
116 static const std::string TypeToString( const Type &type );
[206]117
118 // コンパイル中のクラス
119 const CClass *pCompilingClass;
[184]120};
[193]121
[195]122extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.