[829] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | namespace ActiveBasic{ namespace Common{ namespace Lexical{
|
---|
| 4 |
|
---|
| 5 | std::string Operator_NaturalStringToCalcMarkString( const std::string &name );
|
---|
| 6 | std::string Operator_CalcMarkStringToNaturalString( const std::string &name );
|
---|
| 7 |
|
---|
| 8 | class Symbol
|
---|
| 9 | {
|
---|
| 10 | static const NamespaceSupporter *namespaceSupporter;
|
---|
| 11 |
|
---|
| 12 | NamespaceScopes namespaceScopes;
|
---|
| 13 | std::string name;
|
---|
| 14 |
|
---|
| 15 | // XMLシリアライズ用
|
---|
| 16 | private:
|
---|
| 17 | friend class boost::serialization::access;
|
---|
| 18 | BOOST_SERIALIZATION_SPLIT_MEMBER();
|
---|
| 19 | template<class Archive> void load(Archive& ar, const unsigned int version)
|
---|
| 20 | {
|
---|
| 21 | //trace_for_serialize( "serializing(load) - Symbol" );
|
---|
| 22 |
|
---|
| 23 | ar & BOOST_SERIALIZATION_NVP( namespaceScopes );
|
---|
| 24 |
|
---|
| 25 | std::string _name;
|
---|
| 26 | ar & BOOST_SERIALIZATION_NVP( _name );
|
---|
| 27 | this->name = Operator_NaturalStringToCalcMarkString( _name );
|
---|
| 28 | }
|
---|
| 29 | template<class Archive> void save(Archive& ar, const unsigned int version) const
|
---|
| 30 | {
|
---|
| 31 | //trace_for_serialize( "serializing(save) - Symbol" );
|
---|
| 32 |
|
---|
| 33 | ar & BOOST_SERIALIZATION_NVP( namespaceScopes );
|
---|
| 34 |
|
---|
| 35 | std::string _name = Operator_CalcMarkStringToNaturalString( name );
|
---|
| 36 | ar & BOOST_SERIALIZATION_NVP( _name );
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | public:
|
---|
| 40 | Symbol(NamespaceScopes namespaceScopes, std::string name)
|
---|
| 41 | : namespaceScopes(std::move(namespaceScopes))
|
---|
| 42 | , name(std::move(name))
|
---|
| 43 | {
|
---|
| 44 | }
|
---|
| 45 | Symbol(const Symbol &symbol)
|
---|
| 46 | : namespaceScopes(symbol.namespaceScopes)
|
---|
| 47 | , name(symbol.name)
|
---|
| 48 | {
|
---|
| 49 | }
|
---|
| 50 | Symbol(Symbol&& symbol)
|
---|
| 51 | : namespaceScopes(std::move(symbol.namespaceScopes))
|
---|
| 52 | , name(std::move(symbol.name))
|
---|
| 53 | {
|
---|
| 54 | }
|
---|
| 55 | Symbol()
|
---|
| 56 | {
|
---|
| 57 | }
|
---|
| 58 | Symbol& operator =(Symbol&& symbol)
|
---|
| 59 | {
|
---|
| 60 | namespaceScopes = std::move(symbol.namespaceScopes);
|
---|
| 61 | name = std::move(symbol.name);
|
---|
| 62 | return *this;
|
---|
| 63 | }
|
---|
| 64 | Symbol& operator =(Symbol const& symbol)
|
---|
| 65 | {
|
---|
| 66 | return *this = Symbol(symbol);
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | static void RegistNamespaceSupporter( const NamespaceSupporter *namespaceSupporter )
|
---|
| 70 | {
|
---|
| 71 | Symbol::namespaceSupporter = namespaceSupporter;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | virtual const NamespaceScopes &GetNamespaceScopes() const
|
---|
| 75 | {
|
---|
| 76 | return namespaceScopes;
|
---|
| 77 | }
|
---|
| 78 | const std::string &GetName() const
|
---|
| 79 | {
|
---|
| 80 | return name;
|
---|
| 81 | }
|
---|
| 82 | std::string GetFullName() const;
|
---|
| 83 |
|
---|
| 84 | // シンボル比較
|
---|
| 85 | bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const std::string &name ) const;
|
---|
| 86 | bool IsEqualSymbol( const Symbol &symbol ) const;
|
---|
| 87 | };
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | }}}
|
---|