1 | #pragma once
|
---|
2 |
|
---|
3 | class NativeSection
|
---|
4 | {
|
---|
5 | public:
|
---|
6 | // グローバル領域のネイティブコード
|
---|
7 | NativeCode globalNativeCode;
|
---|
8 |
|
---|
9 | // データテーブル
|
---|
10 | DataTable dataTable;
|
---|
11 |
|
---|
12 | private:
|
---|
13 | // ソースコード
|
---|
14 | int currentSourceIndex;
|
---|
15 | BasicSources sources;
|
---|
16 |
|
---|
17 | // XMLシリアライズ用
|
---|
18 | private:
|
---|
19 | virtual const char *RootTagName() const
|
---|
20 | {
|
---|
21 | return "nativeSection";
|
---|
22 | }
|
---|
23 | friend class boost::serialization::access;
|
---|
24 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
25 | {
|
---|
26 | trace_for_serialize( "serializing - objectModule" );
|
---|
27 |
|
---|
28 | ar & BOOST_SERIALIZATION_NVP( globalNativeCode );
|
---|
29 | ar & BOOST_SERIALIZATION_NVP( dataTable );
|
---|
30 | ar & BOOST_SERIALIZATION_NVP( currentSourceIndex );
|
---|
31 | ar & BOOST_SERIALIZATION_NVP( sources );
|
---|
32 | }
|
---|
33 |
|
---|
34 | public:
|
---|
35 | int GetCurrentSourceIndex() const
|
---|
36 | {
|
---|
37 | return currentSourceIndex;
|
---|
38 | }
|
---|
39 | const BasicSource &GetCurrentSource() const
|
---|
40 | {
|
---|
41 | return sources[currentSourceIndex];
|
---|
42 | }
|
---|
43 | BasicSource &GetCurrentSource()
|
---|
44 | {
|
---|
45 | return sources[currentSourceIndex];
|
---|
46 | }
|
---|
47 | void SetCurrentSourceIndex( int currentSourceIndex )
|
---|
48 | {
|
---|
49 | this->currentSourceIndex = currentSourceIndex;
|
---|
50 | }
|
---|
51 | const BasicSource &GetSource( int sourceIndex ) const
|
---|
52 | {
|
---|
53 | return sources[sourceIndex];
|
---|
54 | }
|
---|
55 | BasicSources &GetSources()
|
---|
56 | {
|
---|
57 | return sources;
|
---|
58 | }
|
---|
59 | };
|
---|
60 |
|
---|
61 | class ObjectModule
|
---|
62 | {
|
---|
63 | public:
|
---|
64 | // メタ情報
|
---|
65 | Meta meta;
|
---|
66 |
|
---|
67 | NativeSection nativeSection;
|
---|
68 |
|
---|
69 | // XMLシリアライズ用
|
---|
70 | private:
|
---|
71 | virtual const char *RootTagName() const
|
---|
72 | {
|
---|
73 | return "objectModule";
|
---|
74 | }
|
---|
75 | friend class boost::serialization::access;
|
---|
76 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
77 | {
|
---|
78 | trace_for_serialize( "serializing - objectModule" );
|
---|
79 |
|
---|
80 | ar & BOOST_SERIALIZATION_NVP( meta );
|
---|
81 | ar & BOOST_SERIALIZATION_NVP( nativeSection );
|
---|
82 | }
|
---|
83 |
|
---|
84 | public:
|
---|
85 | void StaticLink( ObjectModule &objectModule );
|
---|
86 |
|
---|
87 | bool Read( const std::string &filePath );
|
---|
88 | bool Write( const std::string &filePath ) const;
|
---|
89 | bool Load( const Jenga::Common::Binary &binary );
|
---|
90 | bool Save( Jenga::Common::Binary &binary ) const;
|
---|
91 | };
|
---|
92 | typedef std::vector<ObjectModule *> ObjectModules;
|
---|