Line data Source code
1 : #ifndef VECTOR_TYPE_H
2 : #define VECTOR_TYPE_H
3 :
4 : #include "../type.h"
5 : #include <memory>
6 : #include <string>
7 :
8 : namespace nicole {
9 :
10 : class VectorType final : public Type {
11 : private:
12 : std::shared_ptr<Type> elementType_;
13 :
14 : public:
15 : explicit VectorType(const std::shared_ptr<Type> &elementType)
16 0 : : elementType_{elementType} {}
17 :
18 0 : [[nodiscard]] const std::shared_ptr<Type> &elementType() const noexcept {
19 0 : return elementType_;
20 0 : }
21 :
22 0 : [[nodiscard]] std::string toString() const noexcept override {
23 0 : return "vector<" + elementType_->toString() + ">";
24 0 : }
25 : };
26 :
27 : } // namespace nicole
28 :
29 : #endif
|