IDL compiler front-end library
Loading...
Searching...
No Matches
Container.h
Go to the documentation of this file.
1
2/*
3* Nirvana IDL front-end library.
4*
5* This is a part of the Nirvana project.
6*
7* Author: Igor Popov
8*
9* Copyright (c) 2021 Igor Popov.
10*
11* This program is free software; you can redistribute it and/or modify
12* it under the terms of the GNU Lesser General Public License as published by
13* the Free Software Foundation; either version 3 of the License, or
14* (at your option) any later version.
15*
16* This program is distributed in the hope that it will be useful,
17* but WITHOUT ANY WARRANTY; without even the implied warranty of
18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19* GNU General Public License for more details.
20*
21* You should have received a copy of the GNU Lesser General Public
22* License along with this library. If not, see <http://www.gnu.org/licenses/>.
23*
24* Send comments and/or bug reports to:
25* popov.nirvana@gmail.com
26*/
27#ifndef IDLFE_AST_CONTAINER_H_
28#define IDLFE_AST_CONTAINER_H_
29#pragma once
30
31#include "Item.h"
32#include <vector>
33
34namespace AST {
35
37template <class T>
39 public std::vector <Ptr <const T> >
40{
41protected:
42 typedef std::vector <Ptr <const T> > Base;
43
44protected:
45 friend class Builder;
46
47 void append (T& item)
48 {
49 Base::emplace_back (&item);
50 }
51};
52
53class CodeGen;
54
56class Container :
57 public ContainerT <Item>
58{
59 typedef ContainerT <Item> Base;
60public:
63 bool visit (CodeGen& cg) const;
64
65private:
66 friend class Builder;
67
68 void append (Item& item);
69};
70
71}
72
73#endif
The AST builder.
Definition Builder.h:60
Base for code generators. Abstract class.
Definition CodeGen.h:75
Sequential container of the AST items.
Definition Container.h:58
bool visit(CodeGen &cg) const
Sequential container of the AST items.
Definition Container.h:40
An AST item.
Definition Item.h:41
Abstract Syntax Tree namespace.
Definition Array.h:34