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
RevLine 
[191]1#pragma once
2
3#include <jenga/include/common/BoostXmlSupport.h>
4
[206]5#include <option.h>
6#include <Program.h>
7#include <Class.h>
8#include <Procedure.h>
[193]9#include <TypeDef.h>
[206]10#include <Variable.h>
11#include <Const.h>
[191]12
[206]13class MetaImpl : public Jenga::Common::BoostXmlSupport<MetaImpl>
[191]14{
[193]15 // 名前空間
16 NamespaceScopesCollection namespaceScopesCollection;
17
[206]18 // 関数・メソッド
19 UserProcs userProcs;
20
[193]21 // クラス
[206]22 Classes classesImpl;
[191]23
[206]24 // グローバル変数
25 Variables globalVars;
26
27 // グローバル定数
28 Consts globalConsts;
29
30 // グローバル定数マクロ
31 ConstMacros globalConstMacros;
32
[193]33 // blittable型
34 BlittableTypes blittableTypes;
35
36 // TypeDef
37 TypeDefCollection typeDefs;
38
[206]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
[191]66public:
[193]67 MetaImpl()
[206]68 : classesImpl()
[191]69 , pNowClassesForDebugger( &classesImpl )
70 {
71 }
[193]72
73 const NamespaceScopesCollection &GetNamespaces() const
[191]74 {
[193]75 return namespaceScopesCollection;
[191]76 }
[193]77 NamespaceScopesCollection &GetNamespaces()
78 {
79 return namespaceScopesCollection;
80 }
[191]81
[206]82 const UserProcs &GetUserProcs() const
[191]83 {
[206]84 return userProcs;
85 }
86 UserProcs &GetUserProcs()
87 {
88 return userProcs;
89 }
90
91 Classes &GetClasses()
92 {
[191]93 return *pNowClassesForDebugger;
94 }
[206]95 void SetClasses( Classes *pClasses )
[191]96 {
97 this->pNowClassesForDebugger = pClasses;
98 }
99
[206]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
[193]127 BlittableTypes &GetBlittableTypes()
128 {
129 return blittableTypes;
130 }
131
132 TypeDefCollection &GetTypeDefs()
133 {
134 return typeDefs;
135 }
136
[206]137 // 関数ポインタ
138 ProcPointers &GetProcPointers()
[191]139 {
[206]140 return procPointers;
141 }
142
143 bool AutoWrite( const std::string &filePath )
144 {
[191]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.