blob: ff0939cd8c41088fa374d0bf889482e2ea1b0cca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
#include "interfaces/matrix.hpp"
#include "engine/data/bounds.hpp"
#include "engine/data/vector2.hpp"
#include "engine/matrix_iterator.hpp"
#include <gsl/pointers>
#include <memory>
#include <string_view>
#include <vector>
class StringMatrix : public IMatrix<std::string_view>
{
public:
explicit StringMatrix(const Bounds &bounds) noexcept;
StringMatrix(const StringMatrix &string_matrix) noexcept;
StringMatrix(StringMatrix &&string_matrix) noexcept;
~StringMatrix() noexcept override;
void fill(std::string_view element) noexcept override;
[[nodiscard]] std::string_view get(const Vector2 &pos) const noexcept override;
void set(const Vector2 &pos, std::string_view element) noexcept override;
[[nodiscard]] uint32_t get_row_cnt() const noexcept override;
[[nodiscard]] uint32_t get_column_cnt() const noexcept override;
[[nodiscard]] MatrixIterator<std::string_view> begin() const noexcept override;
[[nodiscard]] MatrixIterator<std::string_view> end() const noexcept override;
StringMatrix &operator=(const StringMatrix &rhs) noexcept;
StringMatrix &operator=(StringMatrix &&rhs) noexcept;
private:
gsl::owner<std::string_view **> _matrix;
uint32_t _row_cnt;
uint32_t _column_cnt;
void _delete_matrix() noexcept;
void _copy_matrix_from(const StringMatrix &source) noexcept;
};
|