[182] | 1 | #pragma once
|
---|
[4] | 2 |
|
---|
[206] | 3 | #include <Type.h>
|
---|
[4] | 4 |
|
---|
| 5 |
|
---|
[206] | 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 |
|
---|
[4] | 26 | public:
|
---|
[206] | 27 | CConst( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &newType, _int64 i64data)
|
---|
| 28 | : Symbol( namespaceScopes, name )
|
---|
| 29 | , type( newType )
|
---|
| 30 | , i64data( i64data )
|
---|
[103] | 31 | {
|
---|
| 32 | }
|
---|
[206] | 33 | CConst( const NamespaceScopes &namespaceScopes, const std::string &name, int value)
|
---|
| 34 | : Symbol( namespaceScopes, name )
|
---|
| 35 | , type( Type(DEF_LONG) )
|
---|
| 36 | , i64data( value )
|
---|
[103] | 37 | {
|
---|
| 38 | }
|
---|
[206] | 39 | CConst()
|
---|
| 40 | {
|
---|
| 41 | }
|
---|
| 42 | ~CConst()
|
---|
| 43 | {
|
---|
| 44 | }
|
---|
[7] | 45 |
|
---|
[206] | 46 | virtual const std::string &GetKeyName() const
|
---|
[103] | 47 | {
|
---|
[206] | 48 | return GetName();
|
---|
[103] | 49 | }
|
---|
| 50 |
|
---|
[206] | 51 | Type GetType()
|
---|
| 52 | {
|
---|
| 53 | return type;
|
---|
| 54 | }
|
---|
| 55 | _int64 GetWholeData()
|
---|
| 56 | {
|
---|
| 57 | return i64data;
|
---|
| 58 | }
|
---|
| 59 | double GetDoubleData();
|
---|
[4] | 60 | };
|
---|
[206] | 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" );
|
---|
[4] | 69 |
|
---|
[206] | 70 | ar & boost::serialization::make_nvp("Hashmap_CConst",
|
---|
| 71 | boost::serialization::base_object<Jenga::Common::Hashmap<CConst>>(*this));
|
---|
| 72 | }
|
---|
[7] | 73 |
|
---|
[4] | 74 | public:
|
---|
| 75 |
|
---|
[206] | 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);
|
---|
[7] | 79 |
|
---|
[206] | 80 | private:
|
---|
| 81 | CConst *GetObjectPtr( const string &name );
|
---|
[4] | 82 | public:
|
---|
| 83 |
|
---|
[254] | 84 | int GetBasicType(const char *Name);
|
---|
| 85 | _int64 GetWholeData(const char *Name);
|
---|
| 86 | double GetDoubleData(const char *Name);
|
---|
| 87 | bool IsStringPtr(const char *Name);
|
---|
[4] | 88 | };
|
---|
| 89 |
|
---|
[206] | 90 | //定数マクロ
|
---|
| 91 | class ConstMacro : public Symbol, public Jenga::Common::ObjectInHashmap<ConstMacro>
|
---|
| 92 | {
|
---|
| 93 | std::vector<std::string> parameters;
|
---|
| 94 | std::string expression;
|
---|
[4] | 95 |
|
---|
[206] | 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" );
|
---|
[4] | 102 |
|
---|
[206] | 103 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
|
---|
| 104 | ar & BOOST_SERIALIZATION_NVP( parameters );
|
---|
| 105 | ar & BOOST_SERIALIZATION_NVP( expression );
|
---|
| 106 | }
|
---|
[4] | 107 |
|
---|
[7] | 108 | public:
|
---|
[206] | 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 | }
|
---|
[7] | 121 |
|
---|
[206] | 122 | virtual const std::string &GetKeyName() const
|
---|
| 123 | {
|
---|
| 124 | return GetName();
|
---|
| 125 | }
|
---|
[7] | 126 |
|
---|
[206] | 127 | const std::vector<std::string> &GetParameters() const
|
---|
| 128 | {
|
---|
| 129 | return parameters;
|
---|
| 130 | }
|
---|
| 131 | const std::string &GetExpression() const
|
---|
| 132 | {
|
---|
| 133 | return expression;
|
---|
| 134 | }
|
---|
[4] | 135 |
|
---|
[206] | 136 | bool GetCalcBuffer( const char *parameterStr, char *dest ) const;
|
---|
| 137 | };
|
---|
| 138 | class ConstMacros : public Jenga::Common::Hashmap<ConstMacro>
|
---|
| 139 | {
|
---|
| 140 | // XMLシリアライズ用
|
---|
[7] | 141 | private:
|
---|
[206] | 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" );
|
---|
[7] | 146 |
|
---|
[206] | 147 | ar & boost::serialization::make_nvp("Hashmap_ConstMacro",
|
---|
| 148 | boost::serialization::base_object<Jenga::Common::Hashmap<ConstMacro>>(*this));
|
---|
| 149 | }
|
---|
[7] | 150 |
|
---|
[206] | 151 | public:
|
---|
| 152 | void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr );
|
---|
| 153 | ConstMacro *Find( const std::string &name );
|
---|
[4] | 154 | };
|
---|