From 6b0e2a25cf1e98d3f11d4e6c0305dd327048bbb8 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 27 Jun 2022 22:08:43 +0200 Subject: refactor: use int types from std namespace --- src/engine/data/bounds.hpp | 6 +++--- src/engine/data/style.hpp | 8 ++++---- src/engine/data/vector2.hpp | 6 +++--- src/engine/graphics/matrix.hpp | 8 ++++---- src/engine/graphics/matrix_impl.hpp | 4 ++-- src/engine/graphics/matrix_iterator.hpp | 8 ++++---- src/engine/graphics/matrix_iterator_impl.hpp | 4 ++-- src/engine/graphics/scene.cpp | 2 +- src/engine/user/cursor.cpp | 2 +- src/engine/user/cursor.hpp | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/engine') diff --git a/src/engine/data/bounds.hpp b/src/engine/data/bounds.hpp index 731db5c..b122489 100644 --- a/src/engine/data/bounds.hpp +++ b/src/engine/data/bounds.hpp @@ -15,14 +15,14 @@ enum CoordsValidation struct BoundsOptions { - uint32_t width; - uint32_t height; + std::uint32_t width; + std::uint32_t height; }; class Bounds { public: - using Value = uint32_t; + using Value = std::uint32_t; explicit Bounds(const BoundsOptions &options) noexcept; diff --git a/src/engine/data/style.hpp b/src/engine/data/style.hpp index 50c1faa..6cb3fbd 100644 --- a/src/engine/data/style.hpp +++ b/src/engine/data/style.hpp @@ -7,14 +7,14 @@ class Style { public: // Colors - std::optional fg_color{}; - std::optional bg_color{}; + std::optional fg_color{}; + std::optional bg_color{}; // Toggles bool bold = false; bool reset_before = false; // Spacing - uint32_t padding_left = 0U; - uint32_t padding_right = 0U; + std::uint32_t padding_left = 0U; + std::uint32_t padding_right = 0U; }; diff --git a/src/engine/data/vector2.hpp b/src/engine/data/vector2.hpp index 96ebf87..b83e924 100644 --- a/src/engine/data/vector2.hpp +++ b/src/engine/data/vector2.hpp @@ -5,8 +5,8 @@ struct Vector2Options { - int32_t x; - int32_t y; + std::int32_t x; + std::int32_t y; }; /** @@ -15,7 +15,7 @@ struct Vector2Options class Vector2 { public: - using Value = int32_t; + using Value = std::int32_t; constexpr explicit Vector2(const Vector2Options &options) noexcept : _x(options.x), _y(options.y) diff --git a/src/engine/graphics/matrix.hpp b/src/engine/graphics/matrix.hpp index 7b4d037..58905ee 100644 --- a/src/engine/graphics/matrix.hpp +++ b/src/engine/graphics/matrix.hpp @@ -28,9 +28,9 @@ public: void set(const Vector2 &pos, Element element) noexcept override; - [[nodiscard]] auto get_row_cnt() const noexcept -> uint32_t override; + [[nodiscard]] auto get_row_cnt() const noexcept -> std::uint32_t override; - [[nodiscard]] auto get_column_cnt() const noexcept -> uint32_t override; + [[nodiscard]] auto get_column_cnt() const noexcept -> std::uint32_t override; [[nodiscard]] auto begin() const noexcept -> MatrixIterator override; @@ -43,8 +43,8 @@ public: private: gsl::owner _matrix; - uint32_t _row_cnt; - uint32_t _column_cnt; + std::uint32_t _row_cnt; + std::uint32_t _column_cnt; void _delete_matrix() noexcept; diff --git a/src/engine/graphics/matrix_impl.hpp b/src/engine/graphics/matrix_impl.hpp index 527c61f..9105149 100644 --- a/src/engine/graphics/matrix_impl.hpp +++ b/src/engine/graphics/matrix_impl.hpp @@ -70,13 +70,13 @@ void Matrix::set(const Vector2 &pos, Element element) noexcept } template -auto Matrix::get_row_cnt() const noexcept -> uint32_t +auto Matrix::get_row_cnt() const noexcept -> std::uint32_t { return _row_cnt; } template -auto Matrix::get_column_cnt() const noexcept -> uint32_t +auto Matrix::get_column_cnt() const noexcept -> std::uint32_t { return _column_cnt; } diff --git a/src/engine/graphics/matrix_iterator.hpp b/src/engine/graphics/matrix_iterator.hpp index 70a59bf..2d91ff1 100644 --- a/src/engine/graphics/matrix_iterator.hpp +++ b/src/engine/graphics/matrix_iterator.hpp @@ -28,7 +28,7 @@ class MatrixRow public: using RowPtr = gsl::owner; - explicit MatrixRow(RowPtr row_ptr, const uint32_t &column_cnt) noexcept; + explicit MatrixRow(RowPtr row_ptr, const std::uint32_t &column_cnt) noexcept; [[nodiscard]] auto begin() const noexcept -> MatrixRowIterator; @@ -37,7 +37,7 @@ public: private: RowPtr _row_ptr; - const uint32_t &_column_cnt; + const std::uint32_t &_column_cnt; }; template @@ -46,7 +46,7 @@ class MatrixIterator public: using RowPtr = gsl::owner; - explicit MatrixIterator(RowPtr row_ptr, const uint32_t &column_cnt) noexcept; + explicit MatrixIterator(RowPtr row_ptr, const std::uint32_t &column_cnt) noexcept; auto operator++() noexcept -> MatrixIterator &; auto operator++(int) noexcept -> MatrixIterator; @@ -59,7 +59,7 @@ public: private: RowPtr _row_ptr; - const uint32_t &_column_cnt; + const std::uint32_t &_column_cnt; }; #include "matrix_iterator_impl.hpp" diff --git a/src/engine/graphics/matrix_iterator_impl.hpp b/src/engine/graphics/matrix_iterator_impl.hpp index 4b2c785..95846fe 100644 --- a/src/engine/graphics/matrix_iterator_impl.hpp +++ b/src/engine/graphics/matrix_iterator_impl.hpp @@ -51,7 +51,7 @@ auto MatrixRowIterator::operator!=(const MatrixRowIterator &rhs) const // Matrix row template -MatrixRow::MatrixRow(RowPtr row_ptr, const uint32_t &column_cnt) noexcept +MatrixRow::MatrixRow(RowPtr row_ptr, const std::uint32_t &column_cnt) noexcept : _row_ptr(row_ptr), _column_cnt(column_cnt) { } @@ -73,7 +73,7 @@ auto MatrixRow::end() const noexcept -> MatrixRowIterator template MatrixIterator::MatrixIterator( RowPtr row_ptr, - const uint32_t &column_cnt) noexcept + const std::uint32_t &column_cnt) noexcept : _row_ptr(row_ptr), _column_cnt(column_cnt) { } diff --git a/src/engine/graphics/scene.cpp b/src/engine/graphics/scene.cpp index e4bdb6e..ff64edd 100644 --- a/src/engine/graphics/scene.cpp +++ b/src/engine/graphics/scene.cpp @@ -39,7 +39,7 @@ void Scene::enter() noexcept // ICANON - Canonical mode (line by line input) // ISIG - Generate the corresponding signals for the characters // INTR, QUIT, SUSP and DSUSP - new_termios.c_lflag &= static_cast(~(ECHO | ICANON | ISIG)); + new_termios.c_lflag &= static_cast(~(ECHO | ICANON | ISIG)); // Set a new terminal state tcsetattr(STDIN_FILENO, TCSAFLUSH, &new_termios); diff --git a/src/engine/user/cursor.cpp b/src/engine/user/cursor.cpp index e3ad56c..a372ca7 100644 --- a/src/engine/user/cursor.cpp +++ b/src/engine/user/cursor.cpp @@ -12,7 +12,7 @@ CursorController::CursorController() noexcept void CursorController::move( const Vector2 &direction, - const uint32_t &amount, + const std::uint32_t &amount, bool flush_cout) noexcept { auto direction_format = direction_format_map.at(direction); diff --git a/src/engine/user/cursor.hpp b/src/engine/user/cursor.hpp index 8f352ef..06c6b88 100644 --- a/src/engine/user/cursor.hpp +++ b/src/engine/user/cursor.hpp @@ -39,7 +39,7 @@ class CursorController : public ICursorController, public: CursorController() noexcept; - void move(const Vector2 &direction, const uint32_t &amount, bool flush_cout) noexcept + void move(const Vector2 &direction, const std::uint32_t &amount, bool flush_cout) noexcept override; void move_to(const Vector2 &position, bool flush_cout) noexcept override; -- cgit v1.2.3-18-g5258