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