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

Last change on this file since 829 was 829, checked in by イグトランス (egtra), 12 years ago

svn:eol-styleとsvn:mime-type(文字コード指定含む)の設定

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