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

Last change on this file since 191 was 191, checked in by dai_9181, 17 years ago
File size: 1.4 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
10class MetaImpl : public Meta
11{
12 ClassesImpl classesImpl;
13 Classes *pNowClassesForDebugger;
14
15public:
16 MetaImpl( ClassesImpl *pClasses )
17 : Meta( new ProcPointersImpl() )
18 , classesImpl()
19 , pNowClassesForDebugger( &classesImpl )
20 {
21 }
22 MetaImpl()
23 : Meta()
24 {
25 }
26
27
28 virtual Classes &GetClasses()
29 {
30 return *pNowClassesForDebugger;
31 }
32 virtual void SetClasses( Classes *pClasses )
33 {
34 this->pNowClassesForDebugger = pClasses;
35 }
36
37 virtual bool AutoWrite( const std::string &filePath )
38 {
39 std::ofstream ofs( filePath.c_str() );
40
41 bool isSuccessful = false;
42 try{
43 boost::archive::xml_oarchive oa(ofs);
44
45 // ファイルから読込
46 oa << boost::serialization::make_nvp( RootTagName(), *this );
47
48 isSuccessful = true;
49 }
50 catch(...){
51 // 失敗
52 }
53
54 // 入力を閉じる
55 ofs.close();
56
57 return isSuccessful;
58 }
59
60
61 // XMLシリアライズ用
62private:
63 virtual const char *RootTagName() const
64 {
65 return "metaImpl";
66 }
67 friend class boost::serialization::access;
68 template<class Archive> void serialize(Archive& ar, const unsigned int version)
69 {
70 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Meta );
71 ar & BOOST_SERIALIZATION_NVP( classesImpl );
72 }
73};
74BOOST_IS_ABSTRACT( Meta );
Note: See TracBrowser for help on using the repository browser.