1 | #pragma once |
---|
2 | |
---|
3 | #include <vector> |
---|
4 | #include <string> |
---|
5 | |
---|
6 | #include <Type.h> |
---|
7 | #include <Symbol.h> |
---|
8 | |
---|
9 | using namespace std; |
---|
10 | |
---|
11 | class TypeDefCollection; |
---|
12 | |
---|
13 | class TypeDef : public Symbol |
---|
14 | { |
---|
15 | friend TypeDefCollection; |
---|
16 | |
---|
17 | string baseName; |
---|
18 | Type baseType; |
---|
19 | |
---|
20 | // XMLシリアライズ用 |
---|
21 | private: |
---|
22 | friend class boost::serialization::access; |
---|
23 | template<class Archive> void serialize(Archive& ar, const unsigned int version) |
---|
24 | { |
---|
25 | trace_for_serialize( "serializing - TypeDef" ); |
---|
26 | |
---|
27 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol ); |
---|
28 | ar & BOOST_SERIALIZATION_NVP( baseName ); |
---|
29 | ar & BOOST_SERIALIZATION_NVP( baseType ); |
---|
30 | } |
---|
31 | |
---|
32 | public: |
---|
33 | TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName, int nowLine ); |
---|
34 | TypeDef() |
---|
35 | { |
---|
36 | } |
---|
37 | ~TypeDef() |
---|
38 | { |
---|
39 | } |
---|
40 | |
---|
41 | const string &GetBaseName() const |
---|
42 | { |
---|
43 | return baseName; |
---|
44 | } |
---|
45 | const Type &GetBaseType() const |
---|
46 | { |
---|
47 | return baseType; |
---|
48 | } |
---|
49 | }; |
---|
50 | |
---|
51 | class TypeDefCollection : public std::vector<TypeDef> |
---|
52 | { |
---|
53 | // XMLシリアライズ用 |
---|
54 | private: |
---|
55 | friend class boost::serialization::access; |
---|
56 | template<class Archive> void serialize(Archive& ar, const unsigned int version) |
---|
57 | { |
---|
58 | trace_for_serialize( "serializing - TypeDefCollection" ); |
---|
59 | |
---|
60 | ar & boost::serialization::make_nvp("vector_TypeDef", |
---|
61 | boost::serialization::base_object<std::vector<TypeDef>>(*this)); |
---|
62 | } |
---|
63 | |
---|
64 | public: |
---|
65 | TypeDefCollection(); |
---|
66 | ~TypeDefCollection(); |
---|
67 | |
---|
68 | void Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName, int nowLine ); |
---|
69 | int GetIndex( const NamespaceScopes &namespaceScopes, const string &name ) const; |
---|
70 | int GetIndex( const string &fullName ) const; |
---|
71 | |
---|
72 | private: |
---|
73 | void Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine ); |
---|
74 | public: |
---|
75 | void CollectTypeDefs(); |
---|
76 | }; |
---|