[182] | 1 | #pragma once
|
---|
[4] | 2 |
|
---|
[206] | 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 |
|
---|
[4] | 21 | public:
|
---|
[206] | 22 | CConst( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &newType, _int64 i64data)
|
---|
| 23 | : Symbol( namespaceScopes, name )
|
---|
| 24 | , type( newType )
|
---|
| 25 | , i64data( i64data )
|
---|
[103] | 26 | {
|
---|
| 27 | }
|
---|
[206] | 28 | CConst( const NamespaceScopes &namespaceScopes, const std::string &name, int value)
|
---|
| 29 | : Symbol( namespaceScopes, name )
|
---|
| 30 | , type( Type(DEF_LONG) )
|
---|
| 31 | , i64data( value )
|
---|
[103] | 32 | {
|
---|
| 33 | }
|
---|
[206] | 34 | CConst()
|
---|
| 35 | {
|
---|
| 36 | }
|
---|
| 37 | ~CConst()
|
---|
| 38 | {
|
---|
| 39 | }
|
---|
[7] | 40 |
|
---|
[206] | 41 | virtual const std::string &GetKeyName() const
|
---|
[103] | 42 | {
|
---|
[206] | 43 | return GetName();
|
---|
[103] | 44 | }
|
---|
| 45 |
|
---|
[206] | 46 | Type GetType()
|
---|
| 47 | {
|
---|
| 48 | return type;
|
---|
| 49 | }
|
---|
| 50 | _int64 GetWholeData()
|
---|
| 51 | {
|
---|
| 52 | return i64data;
|
---|
| 53 | }
|
---|
| 54 | double GetDoubleData();
|
---|
[4] | 55 | };
|
---|
[206] | 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" );
|
---|
[4] | 64 |
|
---|
[206] | 65 | ar & boost::serialization::make_nvp("Hashmap_CConst",
|
---|
| 66 | boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
|
---|
| 67 | }
|
---|
[7] | 68 |
|
---|
[4] | 69 | public:
|
---|
| 70 |
|
---|
[600] | 71 | void Add( const NamespaceScopes &namespaceScopes, const std::string &name, _int64 i64data, const Type &type );
|
---|
[523] | 72 | void Add( const NamespaceScopes &namespaceScopes, const std::string &name, int value);
|
---|
[7] | 73 |
|
---|
[206] | 74 | private:
|
---|
[579] | 75 | CConst *GetObjectPtr( const Symbol &symbol );
|
---|
[4] | 76 | public:
|
---|
| 77 |
|
---|
[579] | 78 | int GetBasicType( const Symbol &symbol );
|
---|
| 79 | _int64 GetWholeData( const Symbol &symbol );
|
---|
| 80 | double GetDoubleData( const Symbol &symbol );
|
---|
[600] | 81 | bool IsStringPtr( const Symbol &symbol, bool isUnicode );
|
---|
[4] | 82 | };
|
---|
| 83 |
|
---|
[206] | 84 | //定数マクロ
|
---|
| 85 | class ConstMacro : public Symbol, public Jenga::Common::ObjectInHashmap<ConstMacro>
|
---|
| 86 | {
|
---|
| 87 | std::vector<std::string> parameters;
|
---|
| 88 | std::string expression;
|
---|
[4] | 89 |
|
---|
[206] | 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" );
|
---|
[4] | 96 |
|
---|
[206] | 97 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
|
---|
| 98 | ar & BOOST_SERIALIZATION_NVP( parameters );
|
---|
| 99 | ar & BOOST_SERIALIZATION_NVP( expression );
|
---|
| 100 | }
|
---|
[4] | 101 |
|
---|
[7] | 102 | public:
|
---|
[523] | 103 | ConstMacro( const NamespaceScopes &namespaceScopes, const std::string &name, const std::vector<std::string> ¶meters, const std::string &expression )
|
---|
[206] | 104 | : Symbol( namespaceScopes, name )
|
---|
| 105 | , parameters( parameters )
|
---|
| 106 | , expression( expression )
|
---|
| 107 | {
|
---|
| 108 | }
|
---|
| 109 | ConstMacro()
|
---|
| 110 | {
|
---|
| 111 | }
|
---|
| 112 | ~ConstMacro()
|
---|
| 113 | {
|
---|
| 114 | }
|
---|
[7] | 115 |
|
---|
[206] | 116 | virtual const std::string &GetKeyName() const
|
---|
| 117 | {
|
---|
| 118 | return GetName();
|
---|
| 119 | }
|
---|
[7] | 120 |
|
---|
[206] | 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 | class ConstMacros : public Jenga::Common::Hashmap<ConstMacro>
|
---|
| 131 | {
|
---|
| 132 | // XMLシリアライズ用
|
---|
[7] | 133 | private:
|
---|
[206] | 134 | friend class boost::serialization::access;
|
---|
| 135 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
| 136 | {
|
---|
| 137 | trace_for_serialize( "serializing - ConstMacros" );
|
---|
[7] | 138 |
|
---|
[206] | 139 | ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
|
---|
| 140 | boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
|
---|
| 141 | }
|
---|
[7] | 142 |
|
---|
[206] | 143 | public:
|
---|
[579] | 144 | bool Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr );
|
---|
| 145 | ConstMacro *Find( const Symbol &name );
|
---|
[4] | 146 | };
|
---|