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

Last change on this file since 201 was 201, checked in by dai_9181, 17 years ago
File size: 1.9 KB
Line 
1#pragma once
2
3#include <jenga/include/common/BoostXmlSupport.h>
4
5#include <jenga/include/smoothie/ObjectModule.h>
6
7#include <ClassImpl.h>
8#include <ProcedureImpl.h>
9#include <TypeDef.h>
10
11class MetaImpl : public Meta, public Jenga::Common::BoostXmlSupport<MetaImpl>
12{
13 // 名前空間
14 NamespaceScopesCollection namespaceScopesCollection;
15
16 // クラス
17 ClassesImpl classesImpl;
18 Classes *pNowClassesForDebugger;
19
20 // blittable型
21 BlittableTypes blittableTypes;
22
23 // TypeDef
24 TypeDefCollection typeDefs;
25
26public:
27 MetaImpl()
28 : Meta( new ProcPointersImpl() )
29 , classesImpl()
30 , pNowClassesForDebugger( &classesImpl )
31 {
32 }
33
34 const NamespaceScopesCollection &GetNamespaces() const
35 {
36 return namespaceScopesCollection;
37 }
38 NamespaceScopesCollection &GetNamespaces()
39 {
40 return namespaceScopesCollection;
41 }
42
43 virtual Classes &GetClasses()
44 {
45 return *pNowClassesForDebugger;
46 }
47 virtual void SetClasses( Classes *pClasses )
48 {
49 this->pNowClassesForDebugger = pClasses;
50 }
51
52 BlittableTypes &GetBlittableTypes()
53 {
54 return blittableTypes;
55 }
56
57 TypeDefCollection &GetTypeDefs()
58 {
59 return typeDefs;
60 }
61
62 virtual bool AutoWrite( const std::string &filePath )
63 {
64 std::ofstream ofs( filePath.c_str() );
65
66 bool isSuccessful = false;
67 try{
68 boost::archive::xml_oarchive oa(ofs);
69
70 // ファイルから読込
71 oa << boost::serialization::make_nvp( RootTagName(), *this );
72
73 isSuccessful = true;
74 }
75 catch(...){
76 // 失敗
77 }
78
79 // 入力を閉じる
80 ofs.close();
81
82 return isSuccessful;
83 }
84
85
86 // XMLシリアライズ用
87private:
88 virtual const char *RootTagName() const
89 {
90 return "metaImpl";
91 }
92 friend class boost::serialization::access;
93 template<class Archive> void serialize(Archive& ar, const unsigned int version)
94 {
95 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Meta );
96 ar & BOOST_SERIALIZATION_NVP( classesImpl );
97 }
98};
99BOOST_IS_ABSTRACT( Meta );
Note: See TracBrowser for help on using the repository browser.