source: dev/trunk/abdev/BasicCompiler_Common/include/Symbol.h@ 260

Last change on this file since 260 was 215, checked in by dai_9181, 17 years ago

BoostSerializationSupportのクラステンプレートインスタンスを明示的に生成するようにした(コンパイル時間の短縮)

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