IDL compiler front-end library
Sequence.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_SEQUENCE_H_
28 #define IDLFE_AST_SEQUENCE_H_
29 #pragma once
30 
31 #include "Type.h"
32 
33 namespace AST {
34 
36 class Sequence :
37  public Type
38 {
39 public:
41  Dim bound () const noexcept
42  {
43  return bound_;
44  }
45 
47  Dim size () const noexcept
48  {
49  return bound ();
50  }
51 
53  bool operator == (const Sequence& rhs) const noexcept
54  {
55  return Type::operator == (rhs) && bound () == rhs.bound ();
56  }
57 
58 private:
59  friend class Type;
60 
61  Sequence (const Type& type, Dim bound = 0) :
62  Type (type),
63  bound_ (bound)
64  {}
65 
66 private:
67  Dim bound_;
68 };
69 
70 }
71 
72 #endif
The sequence type descriptor.
Definition: Sequence.h:38
bool operator==(const Sequence &rhs) const noexcept
Check types for equality.
Definition: Sequence.h:53
Dim bound() const noexcept
Definition: Sequence.h:41
Dim size() const noexcept
Obsolete. Use Sequence::bound () instead.
Definition: Sequence.h:47
An IDL type.
Definition: Type.h:47
bool operator==(const Type &rhs) const noexcept
Check types for equality.
Abstract Syntax Tree namespace.
Definition: Array.h:34
uint32_t Dim
Array dimensions, string and sequence bounds.
Definition: Type.h:40