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

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

文字コードがあっていない不具合を修正

File size: 4.0 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 }
45 CConst()
46 {
47 }
48 ~CConst()
49 {
50 }
51
52 virtual const std::string &GetKeyName() const
53 {
54 return GetName();
55 }
56
57 Type GetType()
58 {
59 return type;
60 }
61 _int64 GetWholeData()
62 {
63 return i64data;
64 }
65 double GetDoubleData();
66
67 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
68};
69class Consts : public Jenga::Common::Hashmap<CConst>
70{
71 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
72private:
73 friend class boost::serialization::access;
74 template<class Archive> void serialize(Archive& ar, const unsigned int version)
75 {
76 trace_for_serialize( "serializing - Consts" );
77
78 ar & boost::serialization::make_nvp("Hashmap_CConst",
79 boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
80 }
81
82public:
83
84 void Add( const Symbol &symbol, _int64 i64data, const Type &type );
85 void Add( const Symbol &symbol, int value);
86
87private:
88 CConst *GetObjectPtr( const Symbol &symbol );
89public:
90
91 int GetBasicType( const Symbol &symbol );
92 _int64 GetWholeData( const Symbol &symbol );
93 double GetDoubleData( const Symbol &symbol );
94 bool IsStringPtr( const Symbol &symbol, bool isUnicode );
95};
96
97class ConstMacro
98 : public RelationalObjectModuleItem
99 , public Jenga::Common::ObjectInHashmap<ConstMacro>
100{
101 std::vector<std::string> parameters;
102 std::string expression;
103
104 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
105private:
106 friend class boost::serialization::access;
107 template<class Archive> void serialize(Archive& ar, const unsigned int version)
108 {
109 trace_for_serialize( "serializing - ConstMacro" );
110
111 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
112
113 if( ActiveBasic::Common::Environment::IsRemoveExternal() )
114 {
115 if( this->IsExternal() )
116 {
117 this->NeedResolve();
118 return;
119 }
120 }
121
122 ar & BOOST_SERIALIZATION_NVP( parameters );
123 ar & BOOST_SERIALIZATION_NVP( expression );
124 }
125
126public:
127 ConstMacro( const Symbol &symbol, const std::vector<std::string> &parameters, const std::string &expression )
128 : RelationalObjectModuleItem( symbol )
129 , parameters( parameters )
130 , expression( expression )
131 {
132 }
133 ConstMacro()
134 {
135 }
136 ~ConstMacro()
137 {
138 }
139
140 virtual const std::string &GetKeyName() const
141 {
142 return GetName();
143 }
144
145 const std::vector<std::string> &GetParameters() const
146 {
147 return parameters;
148 }
149 const std::string &GetExpression() const
150 {
151 return expression;
152 }
153
154 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
155};
156class ConstMacros
157 : public Jenga::Common::Hashmap<ConstMacro>
158{
159 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
160private:
161 friend class boost::serialization::access;
162 template<class Archive> void serialize(Archive& ar, const unsigned int version)
163 {
164 trace_for_serialize( "serializing - ConstMacros" );
165
166 ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
167 boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
168 }
169
170public:
171 bool Add( const Symbol &symbol, const char *parameterStr );
172 ConstMacro *Find( const Symbol &name );
173};
Note: See TracBrowser for help on using the repository browser.