source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/TypeDef.h @ 505

Last change on this file since 505 was 505, checked in by dai_9181, 15 years ago

NamespaceScopes?、NamespaceScopesCollectionクラスをab_commonプロジェクトに移動した。

File size: 1.7 KB
Line 
1#pragma once
2
3#include <vector>
4#include <string>
5
6#include <Type.h>
7#include <Symbol.h>
8
9using namespace std;
10
11class TypeDefCollection;
12
13class TypeDef : public Symbol
14{
15    friend TypeDefCollection;
16
17    string baseName;
18    Type baseType;
19
20    // XMLシリアライズ用
21private:
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
32public:
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
51class TypeDefCollection : public std::vector<TypeDef>
52{
53    // XMLシリアライズ用
54private:
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
64public:
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
72private:
73    void Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine );
74public:
75    void CollectTypeDefs();
76};
Note: See TracBrowser for help on using the repository browser.