source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h@ 472

Last change on this file since 472 was 472, checked in by dai_9181, 16 years ago

デプロイ時にcore.lib/cored.libのビルドもできるようにした。

File size: 3.5 KB
Line 
1#pragma once
2
3#include <Messenger.h>
4#include <CodeGenerator.h>
5#include <NamespaceSupporter.h>
6#include <Meta.h>
7#include <DataTable.h>
8#include <CodeGenerator.h>
9#include <ObjectModule.h>
10#include <Linker.h>
11#include <Delegate.h>
12#include <Exception.h>
13#include <Enum.h>
14
15class Compiler
16{
17public:
18 // ターゲット
19 enum TargetModuleType
20 {
21 Exe,
22 Dll,
23 StaticLibrary,
24 };
25
26private:
27 // ビルド成功のフラグ
28 bool isBuildSuccessful;
29
30 // モジュール名
31 std::string moduleName;
32
33 // モジュール タイプ
34 TargetModuleType targetModuleType;
35
36 // デバッグ ビルドかどうか
37 bool isDebug;
38
39 // Unicode対応モジュールかどうか
40 bool isUnicode;
41
42 // 名前空間サポート
43 NamespaceSupporter namespaceSupporter;
44
45 // オブジェクトモジュール
46 ObjectModule *pObjectModule;
47 ObjectModule *pNowObjectModule;
48
49public:
50
51 Compiler()
52 : isBuildSuccessful( false )
53 , pObjectModule( new ObjectModule )
54 , pNowObjectModule( pObjectModule )
55 , targetModuleType( Exe )
56 , isDebug( false )
57 , isUnicode( false )
58 , isCore( false )
59 {
60 }
61 ~Compiler()
62 {
63 delete pObjectModule;
64 Clear();
65 }
66 void Clear()
67 {
68 BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
69 {
70 delete pStaticLibrary;
71 }
72 staticLibraries.clear();
73 }
74
75 void StaticLink( ObjectModules &staticLibraries );
76
77 // ビルド成功のフラグ
78 bool IsBuildSuccessful() const
79 {
80 return isBuildSuccessful;
81 }
82 void BuildSuccessful()
83 {
84 isBuildSuccessful = true;
85 }
86
87 // モジュール名
88 void SetModuleName( const std::string &moduleName )
89 {
90 this->moduleName = moduleName;
91 }
92 const std::string &GetModuleName() const
93 {
94 return moduleName;
95 }
96
97 // 名前空間サポート
98 NamespaceSupporter &GetNamespaceSupporter()
99 {
100 return namespaceSupporter;
101 }
102
103 // メッセンジャー
104 Messenger messenger;
105 ErrorMessenger errorMessenger;
106
107 // コード生成機構
108 CodeGenerator codeGenerator;
109
110 // リンカ
111 Linker linker;
112
113 // 静的リンクするオブジェクトファイル
114 std::vector<std::string> staticLibraryFilePaths;
115
116 // 静的リンクするオブジェクトモジュール
117 ObjectModules staticLibraries;
118
119 // オブジェクトモジュール
120 ObjectModule &GetObjectModule()
121 {
122 return *pNowObjectModule;
123 }
124 void SelectObjectModule( ObjectModule &objectModule )
125 {
126 pNowObjectModule = &objectModule;
127 }
128
129 bool IsExe() const
130 {
131 if( targetModuleType == Exe )
132 {
133 return true;
134 }
135 return false;
136 }
137 bool IsDll() const
138 {
139 if( targetModuleType == Dll )
140 {
141 return true;
142 }
143 return false;
144 }
145 bool IsStaticLibrary() const
146 {
147 if( targetModuleType == StaticLibrary )
148 {
149 return true;
150 }
151 return false;
152 }
153 void SetTargetModuleType( TargetModuleType targetModuleType )
154 {
155 this->targetModuleType = targetModuleType;
156 }
157
158 void SetDebugMark( bool isDebug )
159 {
160 this->isDebug = isDebug;
161 }
162 bool IsDebug() const
163 {
164 return isDebug;
165 }
166
167 void SetUnicodeMark( bool isUnicode )
168 {
169 this->isUnicode = isUnicode;
170 }
171 bool IsUnicode()
172 {
173 return isUnicode;
174 }
175
176
177 // コアモジュールかどうか
178 bool isCore;
179 void SetCoreMark( bool isCore )
180 {
181 this->isCore = isCore;
182 }
183 bool IsCore() const
184 {
185 return isCore;
186 }
187
188 // グローバルエリアが置かれる関数名
189 std::string globalAreaProcName;
190
191 // 列挙型
192 EnumInfoCollection enumInfoCollection;
193
194
195 bool StringToType( const std::string &typeName, Type &type );
196 const std::string TypeToString( const Type &type );
197
198 // コンパイル中のクラス
199 const CClass *pCompilingClass;
200};
201
202extern Compiler compiler;
Note: See TracBrowser for help on using the repository browser.