source: dev/trunk/abdev/BasicCompiler_Common/include/TypeDef.h @ 272

Last change on this file since 272 was 272, checked in by dai_9181, 16 years ago
File size: 1.8 KB
Line 
1#pragma once
2
3#include <vector>
4#include <string>
5
6#include <Namespace.h>
7#include <Type.h>
8#include <Symbol.h>
9
10using namespace std;
11
12class TypeDefCollection;
13
14class TypeDef : public Symbol
15{
16    friend TypeDefCollection;
17
18    string baseName;
19    Type baseType;
20
21    // XMLシリアライズ用
22private:
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
33public:
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
52class TypeDefCollection : public std::vector<TypeDef>
53{
54    // XMLシリアライズ用
55private:
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
65public:
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
73private:
74    void Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine );
75public:
76    void CollectTypeDefs();
77};
Note: See TracBrowser for help on using the repository browser.