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