diff options
55 files changed, 169 insertions, 171 deletions
diff --git a/.clang-tidy b/.clang-tidy index 6fffdc8..5406dd0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,8 +11,6 @@ Checks: ' -bugprone-lambda-function-name, -bugprone-reserved-identifier, -google-readability-braces-around-statements, - -modernize-return-braced-init-list, - -modernize-use-trailing-return-type, -misc-non-private-member-variables-in-classes' WarningsAsErrors: '*' HeaderFilterRegex: '\/src\/' diff --git a/src/DI/auto_wirable.hpp b/src/DI/auto_wirable.hpp index 178158a..54a291e 100644 --- a/src/DI/auto_wirable.hpp +++ b/src/DI/auto_wirable.hpp @@ -8,14 +8,14 @@ template <class Interface> class IAutoWirable { public: - static Interface resolve() noexcept; + static auto resolve() noexcept -> Interface; }; template <class Interface, class ObjectImpl, class... Dependencies> class AutoWirable : public IAutoWirable<Interface> { public: - static std::shared_ptr<Interface> resolve(const Container &container) noexcept; + static auto resolve(const Container &container) noexcept -> std::shared_ptr<Interface>; }; #include "auto_wirable.tpp" diff --git a/src/DI/auto_wirable.tpp b/src/DI/auto_wirable.tpp index a99d82b..3b42cc4 100644 --- a/src/DI/auto_wirable.tpp +++ b/src/DI/auto_wirable.tpp @@ -3,8 +3,8 @@ #include "auto_wirable.hpp" template <class Interface, class ObjectImpl, class... Dependencies> -std::shared_ptr<Interface> AutoWirable<Interface, ObjectImpl, Dependencies...>::resolve( - const Container &container) noexcept +auto AutoWirable<Interface, ObjectImpl, Dependencies...>::resolve( + const Container &container) noexcept -> std::shared_ptr<Interface> { return std::make_shared<ObjectImpl>(container.get<Dependencies>()...); } diff --git a/src/DI/container.hpp b/src/DI/container.hpp index 2efb265..83f24ae 100644 --- a/src/DI/container.hpp +++ b/src/DI/container.hpp @@ -32,13 +32,13 @@ public: Container() noexcept = default; template <class Interface> - BindingBuilder<Interface> bind() noexcept; + auto bind() noexcept -> BindingBuilder<Interface>; template <class Interface, class = std::enable_if_t<std::is_abstract_v<Interface>>> - std::shared_ptr<Interface> get() const noexcept; + auto get() const noexcept -> std::shared_ptr<Interface>; template <typename Interface, typename = std::enable_if_t<is_func_v<Interface>>> - Interface get() const noexcept; + auto get() const noexcept -> Interface; std::unordered_map<BaseObjectType, std::shared_ptr<IGenericWrapper>, ObjectTypeHasher> bindings; diff --git a/src/DI/container.tpp b/src/DI/container.tpp index ed7f34f..2573223 100644 --- a/src/DI/container.tpp +++ b/src/DI/container.tpp @@ -32,13 +32,13 @@ void BindingBuilder<Interface>::to_factory(Interface func) noexcept } template <class Interface> -BindingBuilder<Interface> Container::bind() noexcept +auto Container::bind() noexcept -> BindingBuilder<Interface> { return BindingBuilder<Interface>(this); } template <class Interface, class> -std::shared_ptr<Interface> Container::get() const noexcept +auto Container::get() const noexcept -> std::shared_ptr<Interface> { ObjectType<Interface> interface_type; @@ -57,7 +57,7 @@ std::shared_ptr<Interface> Container::get() const noexcept } template <typename Interface, typename> -Interface Container::get() const noexcept +auto Container::get() const noexcept -> Interface { auto wrapper = std::dynamic_pointer_cast<IWrapper<Interface>>( bindings.at(ObjectType<Interface>())); diff --git a/src/DI/function_wrapper.hpp b/src/DI/function_wrapper.hpp index e6468f2..b8d0cab 100644 --- a/src/DI/function_wrapper.hpp +++ b/src/DI/function_wrapper.hpp @@ -11,7 +11,7 @@ class FunctionWrapper : public IWrapper<Interface> public: explicit FunctionWrapper(Interface func) noexcept; - [[nodiscard]] Interface get() const noexcept override; + [[nodiscard]] auto get() const noexcept -> Interface override; private: const Interface _func; diff --git a/src/DI/function_wrapper.tpp b/src/DI/function_wrapper.tpp index 540a7aa..6a9c317 100644 --- a/src/DI/function_wrapper.tpp +++ b/src/DI/function_wrapper.tpp @@ -8,7 +8,7 @@ FunctionWrapper<Interface>::FunctionWrapper(Interface func) noexcept : _func(fun } template <class Interface> -Interface FunctionWrapper<Interface>::get() const noexcept +auto FunctionWrapper<Interface>::get() const noexcept -> Interface { return _func; } diff --git a/src/DI/interfaces/wrapper.hpp b/src/DI/interfaces/wrapper.hpp index cde555f..e22ea7f 100644 --- a/src/DI/interfaces/wrapper.hpp +++ b/src/DI/interfaces/wrapper.hpp @@ -13,5 +13,5 @@ template <class Interface> class IWrapper : public IGenericWrapper { public: - [[nodiscard]] virtual Interface get() const noexcept = 0; + [[nodiscard]] virtual auto get() const noexcept -> Interface = 0; }; diff --git a/src/DI/object_type.cpp b/src/DI/object_type.cpp index 008c4a4..64a23fa 100644 --- a/src/DI/object_type.cpp +++ b/src/DI/object_type.cpp @@ -5,22 +5,22 @@ BaseObjectType::BaseObjectType(const std::type_info &type_info) noexcept { } -bool BaseObjectType::operator==(const BaseObjectType &object_type) const noexcept +auto BaseObjectType::operator==(const BaseObjectType &object_type) const noexcept -> bool { return hash() == object_type.hash(); } -std::size_t BaseObjectType::hash() const noexcept +auto BaseObjectType::hash() const noexcept -> std::size_t { return _type_info.hash_code(); } -std::string_view BaseObjectType::name() const noexcept +auto BaseObjectType::name() const noexcept -> std::string_view { - return std::string_view(_type_info.name()); + return {_type_info.name()}; } -std::size_t ObjectTypeHasher::operator()(const BaseObjectType &object_type) const noexcept +auto ObjectTypeHasher::operator()(const BaseObjectType &object_type) const noexcept -> std::size_t { return object_type.hash(); } diff --git a/src/DI/object_type.hpp b/src/DI/object_type.hpp index 6b27682..5107dbf 100644 --- a/src/DI/object_type.hpp +++ b/src/DI/object_type.hpp @@ -8,11 +8,11 @@ class BaseObjectType public: explicit BaseObjectType(const std::type_info &type_info) noexcept; - bool operator==(const BaseObjectType &object_type) const noexcept; + auto operator==(const BaseObjectType &object_type) const noexcept -> bool; - [[nodiscard]] std::size_t hash() const noexcept; + [[nodiscard]] auto hash() const noexcept -> std::size_t; - [[nodiscard]] std::string_view name() const noexcept; + [[nodiscard]] auto name() const noexcept -> std::string_view; private: const std::type_info &_type_info; @@ -28,5 +28,5 @@ public: class ObjectTypeHasher { public: - std::size_t operator()(const BaseObjectType &object_type) const noexcept; + auto operator()(const BaseObjectType &object_type) const noexcept -> std::size_t; }; diff --git a/src/DI/object_wrapper.hpp b/src/DI/object_wrapper.hpp index 4aee9af..28121cb 100644 --- a/src/DI/object_wrapper.hpp +++ b/src/DI/object_wrapper.hpp @@ -11,7 +11,7 @@ class ObjectWrapper : public IWrapper<std::shared_ptr<Interface>> public: explicit ObjectWrapper(const Container &container) noexcept : _container(container) {} - [[nodiscard]] std::shared_ptr<Interface> get() const noexcept override; + [[nodiscard]] auto get() const noexcept -> std::shared_ptr<Interface> override; private: const Container &_container; diff --git a/src/DI/object_wrapper.tpp b/src/DI/object_wrapper.tpp index bbb7bee..5334247 100644 --- a/src/DI/object_wrapper.tpp +++ b/src/DI/object_wrapper.tpp @@ -3,7 +3,7 @@ #include "object_wrapper.hpp" template <class Interface, class ObjectImpl> -std::shared_ptr<Interface> ObjectWrapper<Interface, ObjectImpl>::get() const noexcept +auto ObjectWrapper<Interface, ObjectImpl>::get() const noexcept -> std::shared_ptr<Interface> { return ObjectImpl::resolve(_container); } diff --git a/src/argument_parser.cpp b/src/argument_parser.cpp index 94c6a4a..fd18bc7 100644 --- a/src/argument_parser.cpp +++ b/src/argument_parser.cpp @@ -19,9 +19,9 @@ void optarg_error(char arg, const std::string_view &error) noexcept /** * Returns the current optarg as a string view. */ -std::string_view get_str_optarg() noexcept +auto get_str_optarg() noexcept -> std::string_view { - return std::string_view(optarg); + return {optarg}; } /** @@ -30,7 +30,7 @@ std::string_view get_str_optarg() noexcept * @param arg The current command-line argument character * @param check_zero Whether or not to make sure that the result is not zero */ -uint32_t get_uint_optarg(char arg, bool check_zero = false) noexcept +auto get_uint_optarg(char arg, bool check_zero = false) noexcept -> uint32_t { auto conversion_result = str_to_uint(get_str_optarg()); @@ -49,10 +49,10 @@ ArgumentParser::ArgumentParser( { } -ParsedArguments ArgumentParser::parse( +auto ArgumentParser::parse( const std::vector<option> &options, const std::string_view &short_options, const int &argc, - char *const *argv) noexcept // NOLINT(cppcoreguidelines-avoid-c-arrays, + char *const *argv) noexcept -> ParsedArguments // NOLINT(cppcoreguidelines-avoid-c-arrays, // modernize-avoid-c-arrays) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) diff --git a/src/argument_parser.hpp b/src/argument_parser.hpp index c7f33de..bee7c84 100644 --- a/src/argument_parser.hpp +++ b/src/argument_parser.hpp @@ -16,10 +16,10 @@ public: explicit ArgumentParser( IRandomNumberGeneratorFactory random_number_generator_factory) noexcept; - ParsedArguments parse( + auto parse( const std::vector<option> &options, const std::string_view &short_options, const int &argc, - char *const *argv) noexcept override; // NOLINT(cppcoreguidelines-avoid-c-arrays, + char *const *argv) noexcept -> ParsedArguments override; // NOLINT(cppcoreguidelines-avoid-c-arrays, // modernize-avoid-c-arrays) private: diff --git a/src/bootstrap.cpp b/src/bootstrap.cpp index 49808d6..1436301 100644 --- a/src/bootstrap.cpp +++ b/src/bootstrap.cpp @@ -49,7 +49,7 @@ auto construct_as_interface(Params &&...parameters) -> std::shared_ptr<Interface return std::dynamic_pointer_cast<Interface>(std::make_shared<Impl>(parameters...)); } -Container bootstrap() noexcept +auto bootstrap() noexcept -> Container { auto container = Container(); diff --git a/src/bootstrap.hpp b/src/bootstrap.hpp index 2c4fd1d..5e559c5 100644 --- a/src/bootstrap.hpp +++ b/src/bootstrap.hpp @@ -2,4 +2,4 @@ #include "DI/container.hpp" -Container bootstrap() noexcept; +auto bootstrap() noexcept -> Container; diff --git a/src/conversion.cpp b/src/conversion.cpp index 4dbf651..078d66b 100644 --- a/src/conversion.cpp +++ b/src/conversion.cpp @@ -3,7 +3,7 @@ #include <climits> #include <stdexcept> -ConversionResult<uint32_t> str_to_uint(const std::string_view &str) noexcept +auto str_to_uint(const std::string_view &str) noexcept -> ConversionResult<uint32_t> { if (!ctre::match<IS_VALID_UINT>(str)) { diff --git a/src/conversion.hpp b/src/conversion.hpp index 9f6f933..f0bbc04 100644 --- a/src/conversion.hpp +++ b/src/conversion.hpp @@ -29,4 +29,4 @@ static constexpr auto IS_UINT_IN_RANGE = ctll::fixed_string("^[0-9]{1,19}$"); * @param str A string that possibly is a unsigned integer * @returns A conversion result */ -ConversionResult<uint32_t> str_to_uint(const std::string_view &str) noexcept; +auto str_to_uint(const std::string_view &str) noexcept -> ConversionResult<uint32_t>; diff --git a/src/engine/data/bounds.cpp b/src/engine/data/bounds.cpp index 1a8c4d0..ca67008 100644 --- a/src/engine/data/bounds.cpp +++ b/src/engine/data/bounds.cpp @@ -5,7 +5,7 @@ Bounds::Bounds(const BoundsOptions &options) noexcept { } -Bounds::Value Bounds::get_width() const noexcept +auto Bounds::get_width() const noexcept -> Bounds::Value { return _width; } @@ -15,7 +15,7 @@ void Bounds::set_width(Bounds::Value width) noexcept _width = width; } -Bounds::Value Bounds::get_height() const noexcept +auto Bounds::get_height() const noexcept -> Bounds::Value { return _height; } @@ -25,7 +25,7 @@ void Bounds::set_height(Bounds::Value height) noexcept _height = height; } -CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept +auto Bounds::validate_coords(const Vector2 &coords) const noexcept -> CoordsValidation { if (static_cast<Bounds::Value>(coords.get_x()) >= _width) { @@ -50,7 +50,7 @@ CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept return CoordsValidation::VALID; } -const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept +auto Bounds::operator*=(const Bounds &rhs) noexcept -> const Bounds & { _width *= rhs._width; _height *= rhs._height; @@ -58,7 +58,7 @@ const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept return *this; } -const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept +auto Bounds::operator+=(const Bounds &rhs) noexcept -> const Bounds & { _width += rhs._width; _height += rhs._height; @@ -66,7 +66,7 @@ const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept return *this; } -const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept +auto Bounds::operator-=(const Bounds &rhs) noexcept -> const Bounds & { _width -= rhs._width; _height -= rhs._height; @@ -74,7 +74,7 @@ const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept return *this; } -Bounds Bounds::operator-(const Bounds &rhs) const noexcept +auto Bounds::operator-(const Bounds &rhs) const noexcept -> Bounds { auto new_bounds = Bounds(*this); diff --git a/src/engine/data/bounds.hpp b/src/engine/data/bounds.hpp index ccea2c3..5444503 100644 --- a/src/engine/data/bounds.hpp +++ b/src/engine/data/bounds.hpp @@ -26,21 +26,21 @@ public: explicit Bounds(const BoundsOptions &options) noexcept; - [[nodiscard]] Value get_width() const noexcept; + [[nodiscard]] auto get_width() const noexcept -> Value; void set_width(Value width) noexcept; - [[nodiscard]] Value get_height() const noexcept; + [[nodiscard]] auto get_height() const noexcept -> Value; void set_height(Value height) noexcept; - [[nodiscard]] CoordsValidation validate_coords(const Vector2 &coords) const noexcept; + [[nodiscard]] auto validate_coords(const Vector2 &coords) const noexcept -> CoordsValidation; - const Bounds &operator*=(const Bounds &rhs) noexcept; - const Bounds &operator+=(const Bounds &rhs) noexcept; - const Bounds &operator-=(const Bounds &rhs) noexcept; + auto operator*=(const Bounds &rhs) noexcept -> const Bounds &; + auto operator+=(const Bounds &rhs) noexcept -> const Bounds &; + auto operator-=(const Bounds &rhs) noexcept -> const Bounds &; - Bounds operator-(const Bounds &rhs) const noexcept; + auto operator-(const Bounds &rhs) const noexcept -> Bounds; private: Value _width = 0U; diff --git a/src/engine/data/vector2.cpp b/src/engine/data/vector2.cpp index b838051..0554930 100644 --- a/src/engine/data/vector2.cpp +++ b/src/engine/data/vector2.cpp @@ -2,7 +2,7 @@ #include "util/hash.hpp" -Vector2::Value Vector2::get_x() const noexcept +auto Vector2::get_x() const noexcept -> Vector2::Value { return _x; } @@ -12,7 +12,7 @@ void Vector2::set_x(Vector2::Value x) noexcept _x = x; } -Vector2::Value Vector2::get_y() const noexcept +auto Vector2::get_y() const noexcept -> Vector2::Value { return _y; } @@ -22,13 +22,13 @@ void Vector2::set_y(Vector2::Value y) noexcept _y = y; } -Vector2 Vector2::to_direction(const Vector2 &direction, - Vector2::Value amount) const noexcept +auto Vector2::to_direction(const Vector2 &direction, + Vector2::Value amount) const noexcept -> Vector2 { return *this + (direction * Vector2({.x = amount, .y = amount})); } -const Vector2 &Vector2::operator+=(const Vector2 &rhs) noexcept +auto Vector2::operator+=(const Vector2 &rhs) noexcept -> const Vector2 & { _x += rhs._x; _y += rhs._y; @@ -36,7 +36,7 @@ const Vector2 &Vector2::operator+=(const Vector2 &rhs) noexcept return *this; } -const Vector2 &Vector2::operator-=(const Vector2 &rhs) noexcept +auto Vector2::operator-=(const Vector2 &rhs) noexcept -> const Vector2 & { _x -= rhs._x; _y -= rhs._y; @@ -44,7 +44,7 @@ const Vector2 &Vector2::operator-=(const Vector2 &rhs) noexcept return *this; } -Vector2 Vector2::operator+(const Vector2 &rhs) const noexcept +auto Vector2::operator+(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = Vector2(*this); @@ -54,7 +54,7 @@ Vector2 Vector2::operator+(const Vector2 &rhs) const noexcept return new_vector2; } -Vector2 Vector2::operator-(const Vector2 &rhs) const noexcept +auto Vector2::operator-(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = Vector2(*this); @@ -64,7 +64,7 @@ Vector2 Vector2::operator-(const Vector2 &rhs) const noexcept return new_vector2; } -Vector2 Vector2::operator*(const Vector2 &rhs) const noexcept +auto Vector2::operator*(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = *this; @@ -74,12 +74,12 @@ Vector2 Vector2::operator*(const Vector2 &rhs) const noexcept return new_vector2; } -bool Vector2::operator==(const Vector2 &rhs) const noexcept +auto Vector2::operator==(const Vector2 &rhs) const noexcept -> bool { return _x == rhs._x && _y == rhs._y; } -std::size_t Vector2Hasher::operator()(const Vector2 &vector2) const noexcept +auto Vector2Hasher::operator()(const Vector2 &vector2) const noexcept -> std::size_t { std::size_t result_hash = 0; diff --git a/src/engine/data/vector2.hpp b/src/engine/data/vector2.hpp index 78eba11..95baf1c 100644 --- a/src/engine/data/vector2.hpp +++ b/src/engine/data/vector2.hpp @@ -22,30 +22,30 @@ public: { } - [[nodiscard]] Value get_x() const noexcept; + [[nodiscard]] auto get_x() const noexcept -> Value; void set_x(Value x) noexcept; - [[nodiscard]] Value get_y() const noexcept; + [[nodiscard]] auto get_y() const noexcept -> Value; void set_y(Value y) noexcept; - [[nodiscard]] Vector2 to_direction(const Vector2 &direction, - Vector2::Value amount) const noexcept; + [[nodiscard]] auto to_direction(const Vector2 &direction, + Vector2::Value amount) const noexcept -> Vector2; - const Vector2 &operator+=(const Vector2 &rhs) noexcept; - const Vector2 &operator-=(const Vector2 &rhs) noexcept; + auto operator+=(const Vector2 &rhs) noexcept -> const Vector2 &; + auto operator-=(const Vector2 &rhs) noexcept -> const Vector2 &; - Vector2 operator+(const Vector2 &rhs) const noexcept; - Vector2 operator-(const Vector2 &rhs) const noexcept; - Vector2 operator*(const Vector2 &rhs) const noexcept; + auto operator+(const Vector2 &rhs) const noexcept -> Vector2; + auto operator-(const Vector2 &rhs) const noexcept -> Vector2; + auto operator*(const Vector2 &rhs) const noexcept -> Vector2; - bool operator==(const Vector2 &rhs) const noexcept; + auto operator==(const Vector2 &rhs) const noexcept -> bool; /** * Returns Vector2({.x = 0, .y = -1}) */ - static constexpr Vector2 up() noexcept + static constexpr auto up() noexcept -> Vector2 { return Vector2({.x = 0, .y = -1}); } @@ -53,7 +53,7 @@ public: /** * Returns Vector2({.x = 0, .y = 1}) */ - static constexpr Vector2 down() noexcept + static constexpr auto down() noexcept -> Vector2 { return Vector2({.x = 0, .y = 1}); } @@ -61,7 +61,7 @@ public: /** * Returns Vector2({.x = -1, .y = 0}) */ - static constexpr Vector2 left() noexcept + static constexpr auto left() noexcept -> Vector2 { return Vector2({.x = -1, .y = 0}); @@ -70,7 +70,7 @@ public: /** * Returns Vector2({.x = 1, .y = 0}) */ - static constexpr Vector2 right() noexcept + static constexpr auto right() noexcept -> Vector2 { return Vector2({.x = 1, .y = 0}); } @@ -83,5 +83,5 @@ private: class Vector2Hasher { public: - std::size_t operator()(const Vector2 &vector2) const noexcept; + auto operator()(const Vector2 &vector2) const noexcept -> std::size_t; }; diff --git a/src/engine/graphics/matrix.hpp b/src/engine/graphics/matrix.hpp index 2c9ba81..f71018b 100644 --- a/src/engine/graphics/matrix.hpp +++ b/src/engine/graphics/matrix.hpp @@ -23,21 +23,21 @@ public: void fill(Element element) noexcept override; - [[nodiscard]] Element get(const Vector2 &pos) const noexcept override; + [[nodiscard]] auto get(const Vector2 &pos) const noexcept -> Element override; void set(const Vector2 &pos, Element element) noexcept override; - [[nodiscard]] uint32_t get_row_cnt() const noexcept override; + [[nodiscard]] auto get_row_cnt() const noexcept -> uint32_t override; - [[nodiscard]] uint32_t get_column_cnt() const noexcept override; + [[nodiscard]] auto get_column_cnt() const noexcept -> uint32_t override; - [[nodiscard]] MatrixIterator<Element> begin() const noexcept override; + [[nodiscard]] auto begin() const noexcept -> MatrixIterator<Element> override; - [[nodiscard]] MatrixIterator<Element> end() const noexcept override; + [[nodiscard]] auto end() const noexcept -> MatrixIterator<Element> override; - Matrix &operator=(const Matrix &rhs) noexcept; + auto operator=(const Matrix &rhs) noexcept -> Matrix &; - Matrix &operator=(Matrix &&rhs) noexcept; + auto operator=(Matrix &&rhs) noexcept -> Matrix &; private: gsl::owner<Element **> _matrix; diff --git a/src/engine/graphics/matrix.tpp b/src/engine/graphics/matrix.tpp index e0e65bb..527c61f 100644 --- a/src/engine/graphics/matrix.tpp +++ b/src/engine/graphics/matrix.tpp @@ -49,7 +49,7 @@ void Matrix<Element>::fill(Element element) noexcept } template <typename Element> -Element Matrix<Element>::get(const Vector2 &pos) const noexcept +auto Matrix<Element>::get(const Vector2 &pos) const noexcept -> Element { auto x = static_cast<std::size_t>(pos.get_x()); @@ -70,31 +70,31 @@ void Matrix<Element>::set(const Vector2 &pos, Element element) noexcept } template <typename Element> -uint32_t Matrix<Element>::get_row_cnt() const noexcept +auto Matrix<Element>::get_row_cnt() const noexcept -> uint32_t { return _row_cnt; } template <typename Element> -uint32_t Matrix<Element>::get_column_cnt() const noexcept +auto Matrix<Element>::get_column_cnt() const noexcept -> uint32_t { return _column_cnt; } template <typename Element> -MatrixIterator<Element> Matrix<Element>::begin() const noexcept +auto Matrix<Element>::begin() const noexcept -> MatrixIterator<Element> { return MatrixIterator(_matrix, _column_cnt); } template <typename Element> -MatrixIterator<Element> Matrix<Element>::end() const noexcept +auto Matrix<Element>::end() const noexcept -> MatrixIterator<Element> { return MatrixIterator(_matrix + _row_cnt, _column_cnt); } template <typename Element> -Matrix<Element> &Matrix<Element>::operator=(const Matrix &rhs) noexcept +auto Matrix<Element>::operator=(const Matrix &rhs) noexcept -> Matrix<Element> & { if (&rhs != this) { @@ -111,7 +111,7 @@ Matrix<Element> &Matrix<Element>::operator=(const Matrix &rhs) noexcept } template <typename Element> -Matrix<Element> &Matrix<Element>::operator=(Matrix &&rhs) noexcept +auto Matrix<Element>::operator=(Matrix &&rhs) noexcept -> Matrix<Element> & { if (&rhs != this) { diff --git a/src/engine/graphics/scene.cpp b/src/engine/graphics/scene.cpp index 24c174f..c27a6d5 100644 --- a/src/engine/graphics/scene.cpp +++ b/src/engine/graphics/scene.cpp @@ -45,7 +45,7 @@ void Scene::leave() noexcept _is_shown = false; } -const std::shared_ptr<IMatrix<std::string_view>> &Scene::get_matrix() const noexcept +auto Scene::get_matrix() const noexcept -> const std::shared_ptr<IMatrix<std::string_view>> & { return _matrix; } diff --git a/src/engine/graphics/scene.hpp b/src/engine/graphics/scene.hpp index c4f6d67..3dcaa2d 100644 --- a/src/engine/graphics/scene.hpp +++ b/src/engine/graphics/scene.hpp @@ -23,8 +23,8 @@ public: void leave() noexcept override; - [[nodiscard]] const std::shared_ptr<IMatrix<std::string_view>> & - get_matrix() const noexcept override; + [[nodiscard]] auto + get_matrix() const noexcept -> const std::shared_ptr<IMatrix<std::string_view>> & override; private: bool _is_shown; diff --git a/src/engine/graphics/window.cpp b/src/engine/graphics/window.cpp index d6bae0c..bb33402 100644 --- a/src/engine/graphics/window.cpp +++ b/src/engine/graphics/window.cpp @@ -2,7 +2,7 @@ #include <sys/ioctl.h> -Bounds Window::size() const noexcept +auto Window::size() const noexcept -> Bounds { winsize window_size = {}; diff --git a/src/engine/graphics/window.hpp b/src/engine/graphics/window.hpp index c9a9c70..69c04c3 100644 --- a/src/engine/graphics/window.hpp +++ b/src/engine/graphics/window.hpp @@ -10,5 +10,5 @@ class Window : public IWindow, public AutoWirable<IWindow, Window> public: Window() noexcept = default; - [[nodiscard]] Bounds size() const noexcept override; + [[nodiscard]] auto size() const noexcept -> Bounds override; }; diff --git a/src/engine/matrix_iterator.hpp b/src/engine/matrix_iterator.hpp index 5d35052..674216f 100644 --- a/src/engine/matrix_iterator.hpp +++ b/src/engine/matrix_iterator.hpp @@ -10,13 +10,13 @@ public: explicit MatrixRowIterator(ColumnPtr column_ptr) noexcept; - MatrixRowIterator &operator++() noexcept; - MatrixRowIterator operator++(int) noexcept; + auto operator++() noexcept -> MatrixRowIterator &; + auto operator++(int) noexcept -> MatrixRowIterator; - Element &operator*() const noexcept; + auto operator*() const noexcept -> Element &; - bool operator==(const MatrixRowIterator &rhs) const noexcept; - bool operator!=(const MatrixRowIterator &rhs) const noexcept; + auto operator==(const MatrixRowIterator &rhs) const noexcept -> bool; + auto operator!=(const MatrixRowIterator &rhs) const noexcept -> bool; private: ColumnPtr _column_ptr; @@ -30,9 +30,9 @@ public: explicit MatrixRow(RowPtr row_ptr, const uint32_t &column_cnt) noexcept; - [[nodiscard]] MatrixRowIterator<Element> begin() const noexcept; + [[nodiscard]] auto begin() const noexcept -> MatrixRowIterator<Element>; - [[nodiscard]] MatrixRowIterator<Element> end() const noexcept; + [[nodiscard]] auto end() const noexcept -> MatrixRowIterator<Element>; private: RowPtr _row_ptr; @@ -48,13 +48,13 @@ public: explicit MatrixIterator(RowPtr row_ptr, const uint32_t &column_cnt) noexcept; - MatrixIterator &operator++() noexcept; - MatrixIterator operator++(int) noexcept; + auto operator++() noexcept -> MatrixIterator &; + auto operator++(int) noexcept -> MatrixIterator; - MatrixRow<Element> operator*() const noexcept; + auto operator*() const noexcept -> MatrixRow<Element>; - bool operator==(const MatrixIterator &rhs) const noexcept; - bool operator!=(const MatrixIterator &rhs) const noexcept; + auto operator==(const MatrixIterator &rhs) const noexcept -> bool; + auto operator!=(const MatrixIterator &rhs) const noexcept -> bool; private: RowPtr _row_ptr; diff --git a/src/engine/matrix_iterator.tpp b/src/engine/matrix_iterator.tpp index 52952c9..031136c 100644 --- a/src/engine/matrix_iterator.tpp +++ b/src/engine/matrix_iterator.tpp @@ -11,7 +11,7 @@ MatrixRowIterator<Element>::MatrixRowIterator(ColumnPtr column_ptr) noexcept } template <typename Element> -MatrixRowIterator<Element> &MatrixRowIterator<Element>::operator++() noexcept +auto MatrixRowIterator<Element>::operator++() noexcept -> MatrixRowIterator<Element> & { ++_column_ptr; @@ -19,7 +19,7 @@ MatrixRowIterator<Element> &MatrixRowIterator<Element>::operator++() noexcept } template <typename Element> -MatrixRowIterator<Element> MatrixRowIterator<Element>::operator++(int) noexcept +auto MatrixRowIterator<Element>::operator++(int) noexcept -> MatrixRowIterator<Element> { auto copy = *this; @@ -29,19 +29,19 @@ MatrixRowIterator<Element> MatrixRowIterator<Element>::operator++(int) noexcept } template <typename Element> -Element &MatrixRowIterator<Element>::operator*() const noexcept +auto MatrixRowIterator<Element>::operator*() const noexcept -> Element & { return *_column_ptr; } template <typename Element> -bool MatrixRowIterator<Element>::operator==(const MatrixRowIterator &rhs) const noexcept +auto MatrixRowIterator<Element>::operator==(const MatrixRowIterator &rhs) const noexcept -> bool { return _column_ptr == rhs._column_ptr; } template <typename Element> -bool MatrixRowIterator<Element>::operator!=(const MatrixRowIterator &rhs) const noexcept +auto MatrixRowIterator<Element>::operator!=(const MatrixRowIterator &rhs) const noexcept -> bool { return _column_ptr != rhs._column_ptr; } @@ -55,13 +55,13 @@ MatrixRow<Element>::MatrixRow(RowPtr row_ptr, const uint32_t &column_cnt) noexce } template <typename Element> -MatrixRowIterator<Element> MatrixRow<Element>::begin() const noexcept +auto MatrixRow<Element>::begin() const noexcept -> MatrixRowIterator<Element> { return MatrixRowIterator<Element>(_row_ptr); } template <typename Element> -MatrixRowIterator<Element> MatrixRow<Element>::end() const noexcept +auto MatrixRow<Element>::end() const noexcept -> MatrixRowIterator<Element> { return MatrixRowIterator<Element>(_row_ptr + _column_cnt); } @@ -76,7 +76,7 @@ MatrixIterator<Element>::MatrixIterator(RowPtr row_ptr, } template <typename Element> -MatrixIterator<Element> &MatrixIterator<Element>::operator++() noexcept +auto MatrixIterator<Element>::operator++() noexcept -> MatrixIterator<Element> & { ++_row_ptr; @@ -84,7 +84,7 @@ MatrixIterator<Element> &MatrixIterator<Element>::operator++() noexcept } template <typename Element> -MatrixIterator<Element> MatrixIterator<Element>::operator++(int) noexcept +auto MatrixIterator<Element>::operator++(int) noexcept -> MatrixIterator<Element> { auto copy = *this; @@ -94,19 +94,19 @@ MatrixIterator<Element> MatrixIterator<Element>::operator++(int) noexcept } template <typename Element> -MatrixRow<Element> MatrixIterator<Element>::operator*() const noexcept +auto MatrixIterator<Element>::operator*() const noexcept -> MatrixRow<Element> { return MatrixRow(*_row_ptr, _column_cnt); } template <typename Element> -bool MatrixIterator<Element>::operator==(const MatrixIterator &rhs) const noexcept +auto MatrixIterator<Element>::operator==(const MatrixIterator &rhs) const noexcept -> bool { return _row_ptr == rhs._row_ptr; } template <typename Element> -bool MatrixIterator<Element>::operator!=(const MatrixIterator &rhs) const noexcept +auto MatrixIterator<Element>::operator!=(const MatrixIterator &rhs) const noexcept -> bool { return _row_ptr != rhs._row_ptr; } diff --git a/src/engine/user/cursor.cpp b/src/engine/user/cursor.cpp index 2a72663..2b240b9 100644 --- a/src/engine/user/cursor.cpp +++ b/src/engine/user/cursor.cpp @@ -34,7 +34,7 @@ void CursorController::move_to(const Vector2 &position, bool silent) noexcept } } -Vector2 CursorController::where() const noexcept +auto CursorController::where() const noexcept -> Vector2 { return _position; } diff --git a/src/engine/user/cursor.hpp b/src/engine/user/cursor.hpp index fd75374..ccdf71a 100644 --- a/src/engine/user/cursor.hpp +++ b/src/engine/user/cursor.hpp @@ -39,7 +39,7 @@ public: void move_to(const Vector2 &position, bool silent) noexcept override; - [[nodiscard]] Vector2 where() const noexcept override; + [[nodiscard]] auto where() const noexcept -> Vector2 override; void ensure_position() noexcept override; diff --git a/src/engine/user/input.cpp b/src/engine/user/input.cpp index 81fe2f6..87d8a68 100644 --- a/src/engine/user/input.cpp +++ b/src/engine/user/input.cpp @@ -60,8 +60,8 @@ void InputHandler::leave_raw_mode() noexcept _original_termios = nullptr; } -InputHandler::_SubscribersSizeType -InputHandler::_event_as_index(const Event &event) noexcept +auto +InputHandler::_event_as_index(const Event &event) noexcept -> InputHandler::_SubscribersSizeType { return static_cast<_SubscribersSizeType>(static_cast<uint8_t>(event)); } diff --git a/src/engine/user/input.hpp b/src/engine/user/input.hpp index f86d0d0..0a437ef 100644 --- a/src/engine/user/input.hpp +++ b/src/engine/user/input.hpp @@ -36,5 +36,5 @@ private: using _SubscribersSizeType = decltype(_subscribers)::size_type; - static _SubscribersSizeType _event_as_index(const Event &event) noexcept; + static auto _event_as_index(const Event &event) noexcept -> _SubscribersSizeType; }; diff --git a/src/game/game.cpp b/src/game/game.cpp index 6632c08..88b9584 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -57,8 +57,8 @@ void Game::on_exit() const noexcept std::cout.flush(); } -std::unordered_map<char, std::shared_ptr<ICommand>> -Game::get_input_config() const noexcept +auto Game::get_input_config() const noexcept + -> std::unordered_map<char, std::shared_ptr<ICommand>> { return {{'q', std::make_shared<QuitCommand>()}, {'i', std::make_shared<InsertCellCommand>(_cursor_controller, _scene)}, diff --git a/src/game/game.hpp b/src/game/game.hpp index 5894a01..dfbe619 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -25,8 +25,8 @@ public: void on_exit() const noexcept override; - [[nodiscard]] std::unordered_map<char, std::shared_ptr<ICommand>> - get_input_config() const noexcept override; + [[nodiscard]] auto get_input_config() const noexcept + -> std::unordered_map<char, std::shared_ptr<ICommand>> override; private: std::shared_ptr<IWindow> _window; diff --git a/src/game/generation_tracker.cpp b/src/game/generation_tracker.cpp index 0e137cb..0a7a923 100644 --- a/src/game/generation_tracker.cpp +++ b/src/game/generation_tracker.cpp @@ -2,12 +2,12 @@ GenerationTracker::GenerationTracker(bool is_paused) noexcept : _is_paused(is_paused) {} -uint32_t GenerationTracker::get_current_generation() const noexcept +auto GenerationTracker::get_current_generation() const noexcept -> uint32_t { return _current_generation; } -bool GenerationTracker::get_is_paused() const noexcept +auto GenerationTracker::get_is_paused() const noexcept -> bool { return _is_paused; } diff --git a/src/game/generation_tracker.hpp b/src/game/generation_tracker.hpp index 0e59751..bd15a3e 100644 --- a/src/game/generation_tracker.hpp +++ b/src/game/generation_tracker.hpp @@ -9,9 +9,9 @@ class GenerationTracker : public IGenerationTracker public: explicit GenerationTracker(bool is_paused) noexcept; - [[nodiscard]] uint32_t get_current_generation() const noexcept override; + [[nodiscard]] auto get_current_generation() const noexcept -> uint32_t override; - [[nodiscard]] bool get_is_paused() const noexcept override; + [[nodiscard]] auto get_is_paused() const noexcept -> bool override; void set_is_paused(bool is_paused) noexcept override; diff --git a/src/game/statusline.cpp b/src/game/statusline.cpp index 221258c..6becb38 100644 --- a/src/game/statusline.cpp +++ b/src/game/statusline.cpp @@ -51,7 +51,7 @@ void StatusLine::set_status(StatusLineSection section, _move_back(previous_position); } -Vector2 StatusLine::_move_to_statusline(int32_t x) noexcept +auto StatusLine::_move_to_statusline(int32_t x) noexcept -> Vector2 { const auto previous_position = _cursor_controller->where(); @@ -72,7 +72,7 @@ void StatusLine::_move_back(Vector2 previous_position) noexcept _cursor_controller->show(); } -int32_t StatusLine::_get_section_start_x(StatusLineSection section) const noexcept +auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept -> int32_t { int32_t section_start = 0; diff --git a/src/game/statusline.hpp b/src/game/statusline.hpp index 7db1e0b..a14ab20 100644 --- a/src/game/statusline.hpp +++ b/src/game/statusline.hpp @@ -31,11 +31,11 @@ private: std::shared_ptr<ICursorController> _cursor_controller; std::shared_ptr<IWindow> _window; - Vector2 _move_to_statusline(int32_t x) noexcept; + auto _move_to_statusline(int32_t x) noexcept -> Vector2; void _move_back(Vector2 previous_position) noexcept; - int32_t _get_section_start_x(StatusLineSection section) const noexcept; + auto _get_section_start_x(StatusLineSection section) const noexcept -> int32_t; void _clear_section(StatusLineSection section) noexcept; }; diff --git a/src/game_of_life.cpp b/src/game_of_life.cpp index 6af6809..1daf5b8 100644 --- a/src/game_of_life.cpp +++ b/src/game_of_life.cpp @@ -10,7 +10,7 @@ const std::vector<option> options = {option({"seed", required_argument, nullptr, option({"help", no_argument, nullptr, 'h'}), option({nullptr, 0, nullptr, 0})}; -int main(int argc, char *argv[]) noexcept +auto main(int argc, char *argv[]) noexcept -> int { auto container = bootstrap(); diff --git a/src/interfaces/argument_parser.hpp b/src/interfaces/argument_parser.hpp index efcbaf3..8769698 100644 --- a/src/interfaces/argument_parser.hpp +++ b/src/interfaces/argument_parser.hpp @@ -18,9 +18,9 @@ class IArgumentParser public: virtual ~IArgumentParser() noexcept = default; - virtual ParsedArguments - parse(const std::vector<option> &options, const std::string_view &short_options, - const int &argc, - char *const *argv) noexcept = 0; // NOLINT(cppcoreguidelines-avoid-c-arrays, - // modernize-avoid-c-arrays) + virtual auto parse(const std::vector<option> &options, + const std::string_view &short_options, const int &argc, + char *const *argv) noexcept + -> ParsedArguments = 0; // NOLINT(cppcoreguidelines-avoid-c-arrays, + // modernize-avoid-c-arrays) }; diff --git a/src/interfaces/cursor.hpp b/src/interfaces/cursor.hpp index caa89df..f6521cb 100644 --- a/src/interfaces/cursor.hpp +++ b/src/interfaces/cursor.hpp @@ -27,7 +27,7 @@ public: // NOLINTNEXTLINE(google-default-arguments) virtual void move_to(const Vector2 &position, bool silent = false) noexcept = 0; - [[nodiscard]] virtual Vector2 where() const noexcept = 0; + [[nodiscard]] virtual auto where() const noexcept -> Vector2 = 0; virtual void ensure_position() noexcept = 0; diff --git a/src/interfaces/game.hpp b/src/interfaces/game.hpp index 3e547f5..46d79e4 100644 --- a/src/interfaces/game.hpp +++ b/src/interfaces/game.hpp @@ -20,8 +20,8 @@ public: virtual void on_exit() const noexcept = 0; - [[nodiscard]] virtual std::unordered_map<char, std::shared_ptr<ICommand>> - get_input_config() const noexcept = 0; + [[nodiscard]] virtual auto get_input_config() const noexcept + -> std::unordered_map<char, std::shared_ptr<ICommand>> = 0; }; using IGameFactory = std::shared_ptr<IGame> (*)( diff --git a/src/interfaces/generation_tracker.hpp b/src/interfaces/generation_tracker.hpp index 76f241a..fcd2426 100644 --- a/src/interfaces/generation_tracker.hpp +++ b/src/interfaces/generation_tracker.hpp @@ -9,9 +9,9 @@ class IGenerationTracker public: virtual ~IGenerationTracker() noexcept = default; - [[nodiscard]] virtual uint32_t get_current_generation() const noexcept = 0; + [[nodiscard]] virtual auto get_current_generation() const noexcept -> uint32_t = 0; - [[nodiscard]] virtual bool get_is_paused() const noexcept = 0; + [[nodiscard]] virtual auto get_is_paused() const noexcept -> bool = 0; virtual void set_is_paused(bool is_paused) noexcept = 0; }; diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp index 2b33342..edcf935 100644 --- a/src/interfaces/matrix.hpp +++ b/src/interfaces/matrix.hpp @@ -21,21 +21,21 @@ public: virtual void fill(Element element) noexcept = 0; - [[nodiscard]] virtual Element get(const Vector2 &pos) const noexcept = 0; + [[nodiscard]] virtual auto get(const Vector2 &pos) const noexcept -> Element = 0; virtual void set(const Vector2 &pos, Element element) noexcept = 0; - [[nodiscard]] virtual uint32_t get_row_cnt() const noexcept = 0; + [[nodiscard]] virtual auto get_row_cnt() const noexcept -> uint32_t = 0; - [[nodiscard]] virtual uint32_t get_column_cnt() const noexcept = 0; + [[nodiscard]] virtual auto get_column_cnt() const noexcept -> uint32_t = 0; - [[nodiscard]] virtual MatrixIterator<Element> begin() const noexcept = 0; + [[nodiscard]] virtual auto begin() const noexcept -> MatrixIterator<Element> = 0; - [[nodiscard]] virtual MatrixIterator<Element> end() const noexcept = 0; + [[nodiscard]] virtual auto end() const noexcept -> MatrixIterator<Element> = 0; - IMatrix &operator=(const IMatrix &matrix) noexcept = default; + auto operator=(const IMatrix &matrix) noexcept -> IMatrix & = default; - IMatrix &operator=(IMatrix &&matrix) noexcept = default; + auto operator=(IMatrix &&matrix) noexcept -> IMatrix & = default; }; template <typename Element> diff --git a/src/interfaces/randomization.hpp b/src/interfaces/randomization.hpp index 211360e..eb8bd30 100644 --- a/src/interfaces/randomization.hpp +++ b/src/interfaces/randomization.hpp @@ -8,7 +8,7 @@ class ISeedGenerator public: virtual ~ISeedGenerator() noexcept = default; - [[nodiscard]] virtual uint32_t random_seed() const noexcept = 0; + [[nodiscard]] virtual auto random_seed() const noexcept -> uint32_t = 0; }; using ISeedGeneratorFactory = std::shared_ptr<ISeedGenerator> (*)(); @@ -25,8 +25,8 @@ public: * @param a A number lower than b * @param b A number greater than a */ - [[nodiscard]] virtual uint32_t in_range(const uint32_t &a, - const uint32_t &b) const noexcept = 0; + [[nodiscard]] virtual auto in_range(const uint32_t &a, + const uint32_t &b) const noexcept -> uint32_t = 0; }; using IRandomNumberGeneratorFactory = diff --git a/src/interfaces/scene.hpp b/src/interfaces/scene.hpp index 3b440b0..3960985 100644 --- a/src/interfaces/scene.hpp +++ b/src/interfaces/scene.hpp @@ -16,8 +16,8 @@ public: virtual void leave() noexcept = 0; - [[nodiscard]] virtual const std::shared_ptr<IMatrix<std::string_view>> & - get_matrix() const noexcept = 0; + [[nodiscard]] virtual auto get_matrix() const noexcept + -> const std::shared_ptr<IMatrix<std::string_view>> & = 0; }; using ISceneFactory = std::shared_ptr<IScene> (*)( diff --git a/src/interfaces/window.hpp b/src/interfaces/window.hpp index d880762..6fc56e9 100644 --- a/src/interfaces/window.hpp +++ b/src/interfaces/window.hpp @@ -8,5 +8,5 @@ class IWindow public: virtual ~IWindow() noexcept = default; - [[nodiscard]] virtual Bounds size() const noexcept = 0; + [[nodiscard]] virtual auto size() const noexcept -> Bounds = 0; }; diff --git a/src/randomization/generator.cpp b/src/randomization/generator.cpp index 6956eda..2febf16 100644 --- a/src/randomization/generator.cpp +++ b/src/randomization/generator.cpp @@ -5,8 +5,8 @@ RandomNumberGenerator::RandomNumberGenerator(const uint32_t &seed) noexcept this->_generator = std::make_unique<std::mt19937>(seed); } -uint32_t RandomNumberGenerator::in_range(const uint32_t &a, - const uint32_t &b) const noexcept +auto RandomNumberGenerator::in_range(const uint32_t &a, + const uint32_t &b) const noexcept -> uint32_t { auto random_distribution = std::uniform_int_distribution<uint32_t>(a, b); diff --git a/src/randomization/generator.hpp b/src/randomization/generator.hpp index 4b002dd..98acfde 100644 --- a/src/randomization/generator.hpp +++ b/src/randomization/generator.hpp @@ -10,8 +10,8 @@ class RandomNumberGenerator : public IRandomNumberGenerator public: explicit RandomNumberGenerator(const uint32_t &seed) noexcept; - [[nodiscard]] uint32_t in_range(const uint32_t &a, - const uint32_t &b) const noexcept override; + [[nodiscard]] auto in_range(const uint32_t &a, + const uint32_t &b) const noexcept -> uint32_t override; private: std::unique_ptr<std::mt19937> _generator; diff --git a/src/randomization/seed_generator.cpp b/src/randomization/seed_generator.cpp index 3afa275..5aedf17 100644 --- a/src/randomization/seed_generator.cpp +++ b/src/randomization/seed_generator.cpp @@ -6,7 +6,7 @@ SeedGenerator::SeedGenerator( { } -uint32_t SeedGenerator::random_seed() const noexcept +auto SeedGenerator::random_seed() const noexcept -> uint32_t { return (*_random_device)(); } diff --git a/src/randomization/seed_generator.hpp b/src/randomization/seed_generator.hpp index 087ad6b..2439949 100644 --- a/src/randomization/seed_generator.hpp +++ b/src/randomization/seed_generator.hpp @@ -11,7 +11,7 @@ public: explicit SeedGenerator( const std::shared_ptr<std::random_device> &random_device) noexcept; - [[nodiscard]] uint32_t random_seed() const noexcept override; + [[nodiscard]] auto random_seed() const noexcept -> uint32_t override; private: const std::shared_ptr<std::random_device> &_random_device; diff --git a/src/util/color.cpp b/src/util/color.cpp index 17665de..10496b1 100644 --- a/src/util/color.cpp +++ b/src/util/color.cpp @@ -2,13 +2,13 @@ #include <fmt/color.h> -std::string get_foreground_esc_seq(const uint32_t &color) noexcept +auto get_foreground_esc_seq(const uint32_t &color) noexcept -> std::string { return std::string( fmt::detail::make_foreground_color<char>(fmt::detail::color_type(color)).begin()); } -std::string get_background_esc_seq(const uint32_t &color) noexcept +auto get_background_esc_seq(const uint32_t &color) noexcept -> std::string { return std::string( fmt::detail::make_background_color<char>(fmt::detail::color_type(color)).begin()); diff --git a/src/util/color.hpp b/src/util/color.hpp index 5511893..f7c38d2 100644 --- a/src/util/color.hpp +++ b/src/util/color.hpp @@ -5,6 +5,6 @@ constexpr fmt::string_view RESET_ALL_MODES = "{esc}[0m"; -std::string get_foreground_esc_seq(const uint32_t &color) noexcept; +auto get_foreground_esc_seq(const uint32_t &color) noexcept -> std::string; -std::string get_background_esc_seq(const uint32_t &color) noexcept; +auto get_background_esc_seq(const uint32_t &color) noexcept -> std::string; |