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