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