1 | #pragma once
|
---|
2 |
|
---|
3 | void AddConst( const NamespaceScopes &namespaceScopes, char *buffer );
|
---|
4 |
|
---|
5 | //定数
|
---|
6 | class CConst : public Symbol, public Jenga::Common::ObjectInHashmap<CConst>
|
---|
7 | {
|
---|
8 | Type type;
|
---|
9 | _int64 i64data;
|
---|
10 |
|
---|
11 | // XMLシリアライズ用
|
---|
12 | private:
|
---|
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( Symbol );
|
---|
19 | ar & BOOST_SERIALIZATION_NVP( type );
|
---|
20 | ar & BOOST_SERIALIZATION_NVP( i64data );
|
---|
21 | }
|
---|
22 |
|
---|
23 | public:
|
---|
24 | CConst( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &newType, _int64 i64data)
|
---|
25 | : Symbol( namespaceScopes, name )
|
---|
26 | , type( newType )
|
---|
27 | , i64data( i64data )
|
---|
28 | {
|
---|
29 | }
|
---|
30 | CConst( const NamespaceScopes &namespaceScopes, const std::string &name, int value)
|
---|
31 | : Symbol( namespaceScopes, name )
|
---|
32 | , type( Type(DEF_LONG) )
|
---|
33 | , i64data( value )
|
---|
34 | {
|
---|
35 | }
|
---|
36 | CConst()
|
---|
37 | {
|
---|
38 | }
|
---|
39 | ~CConst()
|
---|
40 | {
|
---|
41 | }
|
---|
42 |
|
---|
43 | virtual const std::string &GetKeyName() const
|
---|
44 | {
|
---|
45 | return GetName();
|
---|
46 | }
|
---|
47 |
|
---|
48 | Type GetType()
|
---|
49 | {
|
---|
50 | return type;
|
---|
51 | }
|
---|
52 | _int64 GetWholeData()
|
---|
53 | {
|
---|
54 | return i64data;
|
---|
55 | }
|
---|
56 | double GetDoubleData();
|
---|
57 | };
|
---|
58 | class Consts : public Jenga::Common::Hashmap<CConst>
|
---|
59 | {
|
---|
60 | // XMLシリアライズ用
|
---|
61 | private:
|
---|
62 | friend class boost::serialization::access;
|
---|
63 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
64 | {
|
---|
65 | trace_for_serialize( "serializing - Consts" );
|
---|
66 |
|
---|
67 | ar & boost::serialization::make_nvp("Hashmap_CConst",
|
---|
68 | boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
|
---|
69 | }
|
---|
70 |
|
---|
71 | public:
|
---|
72 |
|
---|
73 | void Add( const NamespaceScopes &namespaceScopes, char *buffer);
|
---|
74 | void Add( const NamespaceScopes &namespaceScopes, const std::string &name, char *Expression);
|
---|
75 | void Add( const NamespaceScopes &namespaceScopes, const std::string &name, int value);
|
---|
76 |
|
---|
77 | private:
|
---|
78 | CConst *GetObjectPtr( const std::string &name );
|
---|
79 | public:
|
---|
80 |
|
---|
81 | int GetBasicType(const char *Name);
|
---|
82 | _int64 GetWholeData(const char *Name);
|
---|
83 | double GetDoubleData(const char *Name);
|
---|
84 | bool IsStringPtr(const char *Name);
|
---|
85 | };
|
---|
86 |
|
---|
87 | //定数マクロ
|
---|
88 | class ConstMacro : public Symbol, public Jenga::Common::ObjectInHashmap<ConstMacro>
|
---|
89 | {
|
---|
90 | std::vector<std::string> parameters;
|
---|
91 | std::string expression;
|
---|
92 |
|
---|
93 | // XMLシリアライズ用
|
---|
94 | private:
|
---|
95 | friend class boost::serialization::access;
|
---|
96 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
97 | {
|
---|
98 | trace_for_serialize( "serializing - ConstMacro" );
|
---|
99 |
|
---|
100 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
|
---|
101 | ar & BOOST_SERIALIZATION_NVP( parameters );
|
---|
102 | ar & BOOST_SERIALIZATION_NVP( expression );
|
---|
103 | }
|
---|
104 |
|
---|
105 | public:
|
---|
106 | ConstMacro( const NamespaceScopes &namespaceScopes, const std::string &name, const std::vector<std::string> ¶meters, const std::string &expression )
|
---|
107 | : Symbol( namespaceScopes, name )
|
---|
108 | , parameters( parameters )
|
---|
109 | , expression( expression )
|
---|
110 | {
|
---|
111 | }
|
---|
112 | ConstMacro()
|
---|
113 | {
|
---|
114 | }
|
---|
115 | ~ConstMacro()
|
---|
116 | {
|
---|
117 | }
|
---|
118 |
|
---|
119 | virtual const std::string &GetKeyName() const
|
---|
120 | {
|
---|
121 | return GetName();
|
---|
122 | }
|
---|
123 |
|
---|
124 | const std::vector<std::string> &GetParameters() const
|
---|
125 | {
|
---|
126 | return parameters;
|
---|
127 | }
|
---|
128 | const std::string &GetExpression() const
|
---|
129 | {
|
---|
130 | return expression;
|
---|
131 | }
|
---|
132 |
|
---|
133 | bool GetCalcBuffer( const char *parameterStr, char *dest ) const;
|
---|
134 | };
|
---|
135 | class ConstMacros : public Jenga::Common::Hashmap<ConstMacro>
|
---|
136 | {
|
---|
137 | // XMLシリアライズ用
|
---|
138 | private:
|
---|
139 | friend class boost::serialization::access;
|
---|
140 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
141 | {
|
---|
142 | trace_for_serialize( "serializing - ConstMacros" );
|
---|
143 |
|
---|
144 | ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
|
---|
145 | boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
|
---|
146 | }
|
---|
147 |
|
---|
148 | public:
|
---|
149 | void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr );
|
---|
150 | ConstMacro *Find( const std::string &name );
|
---|
151 | };
|
---|