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