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