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

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

egtraブランチの内容をマージ。

File size: 4.4 KB
RevLine 
[182]1#pragma once
[4]2
[637]3class CConst
4 : public RelationalObjectModuleItem
5 , public Jenga::Common::ObjectInHashmap<CConst>
[206]6{
7 Type type;
8 _int64 i64data;
9
[647]10 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
[206]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
[637]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
[206]28 ar & BOOST_SERIALIZATION_NVP( type );
29 ar & BOOST_SERIALIZATION_NVP( i64data );
30 }
31
[4]32public:
[637]33 CConst( const Symbol &symbol, const Type &newType, _int64 i64data)
34 : RelationalObjectModuleItem( symbol )
[206]35 , type( newType )
36 , i64data( i64data )
[103]37 {
38 }
[637]39 CConst( const Symbol &symbol, int value)
40 : RelationalObjectModuleItem( symbol )
[206]41 , type( Type(DEF_LONG) )
42 , i64data( value )
[103]43 {
44 }
[828]45private:
[206]46 CConst()
[828]47 : RelationalObjectModuleItem()
48 , type()
49 , i64data()
[206]50 {
51 }
[828]52public:
[206]53 ~CConst()
54 {
55 }
[7]56
[206]57 virtual const std::string &GetKeyName() const
[103]58 {
[206]59 return GetName();
[103]60 }
61
[206]62 Type GetType()
63 {
64 return type;
65 }
66 _int64 GetWholeData()
67 {
68 return i64data;
69 }
70 double GetDoubleData();
[637]71
[640]72 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
[828]73
74private:
75 CConst(CConst const&);
76 CConst& operator =(CConst const&);
[4]77};
[206]78class Consts : public Jenga::Common::Hashmap<CConst>
79{
[647]80 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
[206]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" );
[4]86
[206]87 ar & boost::serialization::make_nvp("Hashmap_CConst",
88 boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
89 }
[7]90
[4]91public:
[828]92 Consts() {}
[4]93
[637]94 void Add( const Symbol &symbol, _int64 i64data, const Type &type );
95 void Add( const Symbol &symbol, int value);
[7]96
[206]97private:
[579]98 CConst *GetObjectPtr( const Symbol &symbol );
[4]99public:
100
[579]101 int GetBasicType( const Symbol &symbol );
102 _int64 GetWholeData( const Symbol &symbol );
103 double GetDoubleData( const Symbol &symbol );
[600]104 bool IsStringPtr( const Symbol &symbol, bool isUnicode );
[828]105
106private:
107 Consts(Consts const&);
108 Consts& operator =(Consts const&);
[4]109};
110
[637]111class ConstMacro
112 : public RelationalObjectModuleItem
113 , public Jenga::Common::ObjectInHashmap<ConstMacro>
[206]114{
115 std::vector<std::string> parameters;
116 std::string expression;
[4]117
[647]118 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
[206]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" );
[4]124
[637]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
[206]136 ar & BOOST_SERIALIZATION_NVP( parameters );
137 ar & BOOST_SERIALIZATION_NVP( expression );
138 }
[4]139
[7]140public:
[637]141 ConstMacro( const Symbol &symbol, const std::vector<std::string> &parameters, const std::string &expression )
142 : RelationalObjectModuleItem( symbol )
[206]143 , parameters( parameters )
144 , expression( expression )
145 {
146 }
147 ConstMacro()
148 {
149 }
150 ~ConstMacro()
151 {
152 }
[7]153
[206]154 virtual const std::string &GetKeyName() const
155 {
156 return GetName();
157 }
[7]158
[206]159 const std::vector<std::string> &GetParameters() const
160 {
161 return parameters;
162 }
163 const std::string &GetExpression() const
164 {
165 return expression;
166 }
[637]167
[640]168 virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
[828]169
170private:
171 ConstMacro(ConstMacro const&);
172 ConstMacro& operator =(ConstMacro const&);
[206]173};
[637]174class ConstMacros
175 : public Jenga::Common::Hashmap<ConstMacro>
[206]176{
[647]177 // XML繧キ繝ェ繧「繝ゥ繧、繧コ逕ィ
[7]178private:
[206]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" );
[7]183
[206]184 ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
185 boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
186 }
[7]187
[206]188public:
[828]189 ConstMacros() {}
190
[637]191 bool Add( const Symbol &symbol, const char *parameterStr );
[579]192 ConstMacro *Find( const Symbol &name );
[828]193
194private:
195 ConstMacros(ConstMacros const&);
196 ConstMacros& operator =(ConstMacros const&);
[4]197};
Note: See TracBrowser for help on using the repository browser.