source: dev/trunk/ab5.0/abdev/ab_common/include/Lexical/Const.h@ 644

Last change on this file since 644 was 640, checked in by dai_9181, 16 years ago

静的リンクリンカの依存関係解決モジュールを製作中

File size: 3.9 KB
Line 
1#pragma once
2
3//萔
4class CConst
5 : public RelationalObjectModuleItem
6 , public Jenga::Common::ObjectInHashmap<CConst>
7{
8 Type type;
9 _int64 i64data;
10
11 // XMLVACYp
12private:
13 friend class boost::serialization::access;
14 template<class Archive> void serialize(Archive& ar, const unsigned int version)
15 {
16 trace_for_serialize( "serializing - CConst" );
17
18 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
19
20 if( ActiveBasic::Common::Environment::IsRemoveExternal() )
21 {
22 if( this->IsExternal() )
23 {
24 this->NeedResolve();
25 return;
26 }
27 }
28
29 ar & BOOST_SERIALIZATION_NVP( type );
30 ar & BOOST_SERIALIZATION_NVP( i64data );
31 }
32
33public:
34 CConst( const Symbol &symbol, const Type &newType, _int64 i64data)
35 : RelationalObjectModuleItem( symbol )
36 , type( newType )
37 , i64data( i64data )
38 {
39 }
40 CConst( const Symbol &symbol, int value)
41 : RelationalObjectModuleItem( symbol )
42 , type( Type(DEF_LONG) )
43 , i64data( value )
44 {
45 }
46 CConst()
47 {
48 }
49 ~CConst()
50 {
51 }
52
53 virtual const std::string &GetKeyName() const
54 {
55 return GetName();
56 }
57
58 Type GetType()
59 {
60 return type;
61 }
62 _int64 GetWholeData()
63 {
64 return i64data;
65 }
66 double GetDoubleData();
67
68 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
69};
70class Consts : public Jenga::Common::Hashmap<CConst>
71{
72 // XMLVACYp
73private:
74 friend class boost::serialization::access;
75 template<class Archive> void serialize(Archive& ar, const unsigned int version)
76 {
77 trace_for_serialize( "serializing - Consts" );
78
79 ar & boost::serialization::make_nvp("Hashmap_CConst",
80 boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
81 }
82
83public:
84
85 void Add( const Symbol &symbol, _int64 i64data, const Type &type );
86 void Add( const Symbol &symbol, int value);
87
88private:
89 CConst *GetObjectPtr( const Symbol &symbol );
90public:
91
92 int GetBasicType( const Symbol &symbol );
93 _int64 GetWholeData( const Symbol &symbol );
94 double GetDoubleData( const Symbol &symbol );
95 bool IsStringPtr( const Symbol &symbol, bool isUnicode );
96};
97
98//萔}N
99class ConstMacro
100 : public RelationalObjectModuleItem
101 , public Jenga::Common::ObjectInHashmap<ConstMacro>
102{
103 std::vector<std::string> parameters;
104 std::string expression;
105
106 // XMLVACYp
107private:
108 friend class boost::serialization::access;
109 template<class Archive> void serialize(Archive& ar, const unsigned int version)
110 {
111 trace_for_serialize( "serializing - ConstMacro" );
112
113 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
114
115 if( ActiveBasic::Common::Environment::IsRemoveExternal() )
116 {
117 if( this->IsExternal() )
118 {
119 this->NeedResolve();
120 return;
121 }
122 }
123
124 ar & BOOST_SERIALIZATION_NVP( parameters );
125 ar & BOOST_SERIALIZATION_NVP( expression );
126 }
127
128public:
129 ConstMacro( const Symbol &symbol, const std::vector<std::string> &parameters, const std::string &expression )
130 : RelationalObjectModuleItem( symbol )
131 , parameters( parameters )
132 , expression( expression )
133 {
134 }
135 ConstMacro()
136 {
137 }
138 ~ConstMacro()
139 {
140 }
141
142 virtual const std::string &GetKeyName() const
143 {
144 return GetName();
145 }
146
147 const std::vector<std::string> &GetParameters() const
148 {
149 return parameters;
150 }
151 const std::string &GetExpression() const
152 {
153 return expression;
154 }
155
156 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
157};
158class ConstMacros
159 : public Jenga::Common::Hashmap<ConstMacro>
160{
161 // XMLVACYp
162private:
163 friend class boost::serialization::access;
164 template<class Archive> void serialize(Archive& ar, const unsigned int version)
165 {
166 trace_for_serialize( "serializing - ConstMacros" );
167
168 ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
169 boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
170 }
171
172public:
173 bool Add( const Symbol &symbol, const char *parameterStr );
174 ConstMacro *Find( const Symbol &name );
175};
Note: See TracBrowser for help on using the repository browser.