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

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

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

File size: 3.9 KB
RevLine 
[182]1#pragma once
[4]2
[206]3//定数
[637]4class CConst
5 : public RelationalObjectModuleItem
6 , public Jenga::Common::ObjectInHashmap<CConst>
[206]7{
8 Type type;
9 _int64 i64data;
10
11 // XMLシリアライズ用
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
[637]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
[206]29 ar & BOOST_SERIALIZATION_NVP( type );
30 ar & BOOST_SERIALIZATION_NVP( i64data );
31 }
32
[4]33public:
[637]34 CConst( const Symbol &symbol, const Type &newType, _int64 i64data)
35 : RelationalObjectModuleItem( symbol )
[206]36 , type( newType )
37 , i64data( i64data )
[103]38 {
39 }
[637]40 CConst( const Symbol &symbol, int value)
41 : RelationalObjectModuleItem( symbol )
[206]42 , type( Type(DEF_LONG) )
43 , i64data( value )
[103]44 {
45 }
[206]46 CConst()
47 {
48 }
49 ~CConst()
50 {
51 }
[7]52
[206]53 virtual const std::string &GetKeyName() const
[103]54 {
[206]55 return GetName();
[103]56 }
57
[206]58 Type GetType()
59 {
60 return type;
61 }
62 _int64 GetWholeData()
63 {
64 return i64data;
65 }
66 double GetDoubleData();
[637]67
68 virtual bool Resolve();
[4]69};
[206]70class Consts : public Jenga::Common::Hashmap<CConst>
71{
72 // XMLシリアライズ用
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" );
[4]78
[206]79 ar & boost::serialization::make_nvp("Hashmap_CConst",
80 boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
81 }
[7]82
[4]83public:
84
[637]85 void Add( const Symbol &symbol, _int64 i64data, const Type &type );
86 void Add( const Symbol &symbol, int value);
[7]87
[206]88private:
[579]89 CConst *GetObjectPtr( const Symbol &symbol );
[4]90public:
91
[579]92 int GetBasicType( const Symbol &symbol );
93 _int64 GetWholeData( const Symbol &symbol );
94 double GetDoubleData( const Symbol &symbol );
[600]95 bool IsStringPtr( const Symbol &symbol, bool isUnicode );
[4]96};
97
[206]98//定数マクロ
[637]99class ConstMacro
100 : public RelationalObjectModuleItem
101 , public Jenga::Common::ObjectInHashmap<ConstMacro>
[206]102{
103 std::vector<std::string> parameters;
104 std::string expression;
[4]105
[206]106 // XMLシリアライズ用
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" );
[4]112
[637]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
[206]124 ar & BOOST_SERIALIZATION_NVP( parameters );
125 ar & BOOST_SERIALIZATION_NVP( expression );
126 }
[4]127
[7]128public:
[637]129 ConstMacro( const Symbol &symbol, const std::vector<std::string> &parameters, const std::string &expression )
130 : RelationalObjectModuleItem( symbol )
[206]131 , parameters( parameters )
132 , expression( expression )
133 {
134 }
135 ConstMacro()
136 {
137 }
138 ~ConstMacro()
139 {
140 }
[7]141
[206]142 virtual const std::string &GetKeyName() const
143 {
144 return GetName();
145 }
[7]146
[206]147 const std::vector<std::string> &GetParameters() const
148 {
149 return parameters;
150 }
151 const std::string &GetExpression() const
152 {
153 return expression;
154 }
[637]155
156 virtual bool Resolve();
[206]157};
[637]158class ConstMacros
159 : public Jenga::Common::Hashmap<ConstMacro>
[206]160{
161 // XMLシリアライズ用
[7]162private:
[206]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" );
[7]167
[206]168 ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
169 boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
170 }
[7]171
[206]172public:
[637]173 bool Add( const Symbol &symbol, const char *parameterStr );
[579]174 ConstMacro *Find( const Symbol &name );
[4]175};
Note: See TracBrowser for help on using the repository browser.