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