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