IDL compiler front-end library
Attribute.h
Go to the documentation of this file.
1 /*
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_ATTRIBUTE_H_
28 #define IDLFE_AST_ATTRIBUTE_H_
29 #pragma once
30 
31 #include "Member.h"
32 #include "Exception.h"
33 
34 namespace AST {
35 
37 class Attribute :
38  public Member
39 {
40 public:
42  bool readonly () const noexcept
43  {
44  return readonly_;
45  }
46 
48  const Raises& getraises () const noexcept
49  {
50  return getraises_;
51  }
52 
54  const Raises& setraises () const noexcept
55  {
56  return setraises_;
57  }
58 
59 private:
60  friend class Builder;
61  template <class T> friend class Ptr;
62 
63  Attribute (Builder& builder, bool readonly, Type&& type, const SimpleDeclarator& name) :
64  Member (builder, std::move (type), name, Item::Kind::ATTRIBUTE),
65  readonly_ (readonly)
66  {}
67 
68  void getraises (Raises&& raises) noexcept
69  {
70  getraises_ = std::move (raises);
71  }
72 
73  void setraises (Raises&& raises) noexcept
74  {
75  setraises_ = std::move (raises);
76  }
77 
78 private:
79  bool readonly_;
80  Raises getraises_;
81  Raises setraises_;
82 };
83 
84 }
85 
86 #endif
The attribute specification.
Definition: Attribute.h:39
const Raises & getraises() const noexcept
Definition: Attribute.h:48
bool readonly() const noexcept
Definition: Attribute.h:42
const Raises & setraises() const noexcept
Definition: Attribute.h:54
The AST builder.
Definition: Builder.h:60
An AST item.
Definition: Item.h:41
The item with name and type.
Definition: Member.h:43
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
An IDL type.
Definition: Type.h:47
Kind
The kind of type.
Definition: Type.h:51
Abstract Syntax Tree namespace.
Definition: Array.h:34
std::vector< const ItemWithId * > Raises
Definition: Exception.h:55