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