Line data Source code
1 : #ifndef ATTRIBUTE_H
2 : #define ATTRIBUTE_H
3 :
4 : #include "../../../symbol.h"
5 : #include "../type.h"
6 : #include <cstddef>
7 : #include <memory>
8 :
9 : namespace nicole {
10 :
11 : class Attribute final : public Symbol {
12 : private:
13 : std::shared_ptr<Type> type_{};
14 : std::size_t position_;
15 :
16 : public:
17 : explicit Attribute(const std::string &id,
18 : const std::shared_ptr<Type> &type, const std::size_t pos) noexcept
19 0 : : Symbol{id}, type_{type}, position_(pos) {}
20 :
21 0 : [[nodiscard]] const std::shared_ptr<Type> &type() const noexcept {
22 0 : return type_;
23 0 : }
24 :
25 0 : [[nodiscard]] std::size_t position() const noexcept { return position_; }
26 : };
27 :
28 : } // namespace nicole
29 :
30 : #endif
|