IDL compiler front-end library
Loading...
Searching...
No Matches
Module.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_MODULE_H_
28#define IDLFE_AST_MODULE_H_
29#pragma once
30
31#include "ItemScope.h"
32#include "Container.h"
33
34namespace AST {
35
40class Module :
41 public ItemScope
42{
43private:
44 template <class T> friend class Ptr;
45
46 Module (Builder& builder, const SimpleDeclarator& name) :
47 ItemScope (Kind::MODULE, builder, name)
48 {}
49};
50
71 public Item,
72 public Container
73{
74public:
76 const Identifier& name () const noexcept
77 {
78 return module_.name ();
79 }
80
82 const Module& module () const noexcept
83 {
84 return module_;
85 }
86
87private:
88 template <class T> friend class Ptr;
89
90 ModuleItems (const Module& mod) :
91 Item (Item::Kind::MODULE_ITEMS),
92 module_ (mod)
93 {}
94
95private:
96 const Module& module_;
97};
98
99}
100
101#endif
The AST builder.
Definition Builder.h:60
Sequential container of the AST items.
Definition Container.h:58
An identifier.
Definition Identifier.h:37
An AST item.
Definition Item.h:41
Kind
The kind of item.
Definition Item.h:45
@ MODULE
class Module
@ MODULE_ITEMS
class ModuleItems
The named item which defines a scope.
Definition ItemScope.h:38
The module as a scope.
Definition Module.h:42
The seqence of items in a module.
Definition Module.h:73
const Identifier & name() const noexcept
Definition Module.h:76
const Identifier & name() const noexcept
Definition NamedItem.h:48
AST item smart pointer.
Definition Item.h:134
The IDL simple declarator.
Definition Declarators.h:41
Abstract Syntax Tree namespace.
Definition Array.h:34