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

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