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