IDL compiler front-end library
Loading...
Searching...
No Matches
Enum.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_ENUM_H_
28#define IDLFE_AST_ENUM_H_
29#pragma once
30
31#include "ItemWithId.h"
32#include "Container.h"
33
34namespace AST {
35
36class EnumItem;
37
42class EnumItem :
43 public NamedItem
44{
45public:
47 const NamedItem& enum_type () const noexcept
48 {
49 return enum_type_;
50 }
51
52private:
53 template <class T> friend class Ptr;
54
55 EnumItem (Builder& builder, const NamedItem& enum_type, const SimpleDeclarator& name) :
56 NamedItem (Item::Kind::ENUM_ITEM, builder, name),
57 enum_type_ (enum_type)
58 {}
59
60private:
61 const NamedItem& enum_type_;
62};
63
68class Enum :
69 public ItemWithId,
70 public ContainerT <EnumItem>
71{
72private:
73 template <class T> friend class Ptr;
74
75 Enum (Builder& builder, const SimpleDeclarator& name) :
77 {}
78};
79
80}
81
82#endif
The AST builder.
Definition Builder.h:60
Sequential container of the AST items.
Definition Container.h:40
The enum declaration.
Definition Enum.h:71
The enumerator.
Definition Enum.h:44
const NamedItem & enum_type() const noexcept
Definition Enum.h:47
An AST item.
Definition Item.h:41
Kind
The kind of item.
Definition Item.h:45
@ ENUM
class Enum
@ ENUM_ITEM
class EnumItem
Items which have repository identifiers derive from this class.
Definition ItemWithId.h:42
A named AST item.
Definition NamedItem.h:45
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