source: dev/trunk/abdev/BasicCompiler_Common/include/MetaImpl.h@ 206

Last change on this file since 206 was 206, checked in by dai_9181, 17 years ago

コード全体のリファクタリングを実施

File size: 3.1 KB
Line 
1#pragma once
2
3#include <jenga/include/common/BoostXmlSupport.h>
4
5#include <option.h>
6#include <Program.h>
7#include <Class.h>
8#include <Procedure.h>
9#include <TypeDef.h>
10#include <Variable.h>
11#include <Const.h>
12
13class MetaImpl : public Jenga::Common::BoostXmlSupport<MetaImpl>
14{
15 // 名前空間
16 NamespaceScopesCollection namespaceScopesCollection;
17
18 // 関数・メソッド
19 UserProcs userProcs;
20
21 // クラス
22 Classes classesImpl;
23
24 // グローバル変数
25 Variables globalVars;
26
27 // グローバル定数
28 Consts globalConsts;
29
30 // グローバル定数マクロ
31 ConstMacros globalConstMacros;
32
33 // blittable型
34 BlittableTypes blittableTypes;
35
36 // TypeDef
37 TypeDefCollection typeDefs;
38
39 // 関数ポインタ
40 ProcPointers procPointers;
41
42 // XMLシリアライズ用
43private:
44 virtual const char *RootTagName() const
45 {
46 return "metaImpl";
47 }
48 friend class boost::serialization::access;
49 template<class Archive> void serialize(Archive& ar, const unsigned int version)
50 {
51 trace_for_serialize( "serializing - MetaImpl" );
52
53 ar & BOOST_SERIALIZATION_NVP( namespaceScopesCollection );
54 ar & BOOST_SERIALIZATION_NVP( userProcs );
55 ar & BOOST_SERIALIZATION_NVP( classesImpl );
56 ar & BOOST_SERIALIZATION_NVP( globalVars );
57 ar & BOOST_SERIALIZATION_NVP( globalConsts );
58 ar & BOOST_SERIALIZATION_NVP( globalConstMacros );
59 ar & BOOST_SERIALIZATION_NVP( blittableTypes );
60 ar & BOOST_SERIALIZATION_NVP( typeDefs );
61 ar & BOOST_SERIALIZATION_NVP( procPointers );
62 }
63
64 Classes *pNowClassesForDebugger;
65
66public:
67 MetaImpl()
68 : classesImpl()
69 , pNowClassesForDebugger( &classesImpl )
70 {
71 }
72
73 const NamespaceScopesCollection &GetNamespaces() const
74 {
75 return namespaceScopesCollection;
76 }
77 NamespaceScopesCollection &GetNamespaces()
78 {
79 return namespaceScopesCollection;
80 }
81
82 const UserProcs &GetUserProcs() const
83 {
84 return userProcs;
85 }
86 UserProcs &GetUserProcs()
87 {
88 return userProcs;
89 }
90
91 Classes &GetClasses()
92 {
93 return *pNowClassesForDebugger;
94 }
95 void SetClasses( Classes *pClasses )
96 {
97 this->pNowClassesForDebugger = pClasses;
98 }
99
100 const Variables &GetGlobalVars() const
101 {
102 return globalVars;
103 }
104 Variables &GetGlobalVars()
105 {
106 return globalVars;
107 }
108
109 const Consts &GetGlobalConsts() const
110 {
111 return globalConsts;
112 }
113 Consts &GetGlobalConsts()
114 {
115 return globalConsts;
116 }
117
118 const ConstMacros &GetGlobalConstMacros() const
119 {
120 return globalConstMacros;
121 }
122 ConstMacros &GetGlobalConstMacros()
123 {
124 return globalConstMacros;
125 }
126
127 BlittableTypes &GetBlittableTypes()
128 {
129 return blittableTypes;
130 }
131
132 TypeDefCollection &GetTypeDefs()
133 {
134 return typeDefs;
135 }
136
137 // 関数ポインタ
138 ProcPointers &GetProcPointers()
139 {
140 return procPointers;
141 }
142
143 bool AutoWrite( const std::string &filePath )
144 {
145 std::ofstream ofs( filePath.c_str() );
146
147 bool isSuccessful = false;
148 try{
149 boost::archive::xml_oarchive oa(ofs);
150
151 // ファイルから読込
152 oa << boost::serialization::make_nvp( RootTagName(), *this );
153
154 isSuccessful = true;
155 }
156 catch(...){
157 // 失敗
158 }
159
160 // 入力を閉じる
161 ofs.close();
162
163 return isSuccessful;
164 }
165};
Note: See TracBrowser for help on using the repository browser.