source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Symbol.h@ 505

Last change on this file since 505 was 505, checked in by dai_9181, 16 years ago

NamespaceScopes、NamespaceScopesCollectionクラスをab_commonプロジェクトに移動した。

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