aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-19 13:21:54 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:56 +0200
commit55c93fe609888be73677317978959040cf35b2ff (patch)
tree41ee53961eb5667136432b69773ef7acf3ad8259 /src/interfaces
parent020303df1410d10546f53d0bfee4f48797d4f067 (diff)
refactor: implement matrix iterator
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/matrix.hpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp
index 44a26ed..c22c0a7 100644
--- a/src/interfaces/matrix.hpp
+++ b/src/interfaces/matrix.hpp
@@ -3,45 +3,39 @@
#include "engine/data/bounds.hpp"
#include "engine/data/vector2.hpp"
+#include "engine/matrix_iterator.hpp"
+
#include <memory>
template <typename Element>
class IMatrix
{
public:
+ IMatrix() noexcept = default;
+
+ IMatrix(const IMatrix &matrix) noexcept = default;
+
+ IMatrix(IMatrix &&matrix) noexcept = default;
+
virtual ~IMatrix() noexcept = default;
- /**
- * Fills the matrix with a element.
- *
- * @param element A element
- */
virtual void fill(Element element) noexcept = 0;
- /**
- * Returns a element of the matrix.
- *
- * @param pos The position of a element
- */
[[nodiscard]] virtual Element get(const Vector2 &pos) const noexcept = 0;
- /**
- * Sets a element of the matrix.
- *
- * @param pos The position of a element
- * @param element A new element
- */
virtual void set(const Vector2 &pos, Element element) noexcept = 0;
- /**
- * Returns the number of rows the matrix has.
- */
- [[nodiscard]] virtual uint32_t rows() const noexcept = 0;
+ [[nodiscard]] virtual uint32_t get_row_cnt() const noexcept = 0;
+
+ [[nodiscard]] virtual uint32_t get_column_cnt() const noexcept = 0;
+
+ [[nodiscard]] virtual MatrixIterator<std::string_view> begin() const noexcept = 0;
+
+ [[nodiscard]] virtual MatrixIterator<std::string_view> end() const noexcept = 0;
+
+ IMatrix &operator=(const IMatrix &matrix) noexcept = default;
- /**
- * Returns the number of columns the matrix has.
- */
- [[nodiscard]] virtual uint32_t columns() const noexcept = 0;
+ IMatrix &operator=(IMatrix &&matrix) noexcept = default;
};
template <typename Element>