IDL compiler front-end library
Loading...
Searching...
No Matches
Struct.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_STRUCT_H_
28#define IDLFE_AST_STRUCT_H_
29#pragma once
30
31#include "StructBase.h"
32#include "ForwardDeclarable.h"
33
34namespace AST {
35
36class Struct;
37
43 public ItemWithId
44{
45public:
47 const Struct& definition () const
48 {
49 assert (definition_);
50 return *definition_;
51 }
52
53private:
54 template <class T> friend class Ptr;
55 friend class Builder;
56
57 StructDecl (Builder& builder, const SimpleDeclarator& name) :
58 ItemWithId (Item::Kind::STRUCT_DECL, builder, name),
59 definition_ (nullptr)
60 {}
61
62private:
63 const Struct* definition_;
64};
65
70class Struct :
71 public StructBase,
73{
74private:
75 template <class T> friend class Ptr;
76 friend class Builder;
77
78 Struct (Builder& builder, const SimpleDeclarator& name) :
80 {}
81};
82
83}
84
85#endif
The AST builder.
Definition Builder.h:60
The item that can be forward declared.
An AST item.
Definition Item.h:41
Kind
The kind of item.
Definition Item.h:45
@ STRUCT_DECL
class StructDecl
@ STRUCT
class Struct
Items which have repository identifiers derive from this class.
Definition ItemWithId.h:42
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
The common base for Struct and Exception.
Definition StructBase.h:41
The struct forward declaration.
Definition Struct.h:44
const Struct & definition() const
Definition Struct.h:47
The struct definition.
Definition Struct.h:73
Abstract Syntax Tree namespace.
Definition Array.h:34