aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-14 18:02:18 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:56 +0200
commitdc6222611ad14a33f642396558ba84ecba9d6605 (patch)
treed759020233b66be62c5539209a03842d283b67a9 /src/interfaces
parentdbab54ebf134b6ab2cf719d7c26a191fbffeed34 (diff)
perf: add noexcept almost everywhere
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/argument_parser.hpp6
-rw-r--r--src/interfaces/input.hpp12
-rw-r--r--src/interfaces/matrix.hpp12
-rw-r--r--src/interfaces/observable.hpp8
-rw-r--r--src/interfaces/randomization.hpp8
5 files changed, 23 insertions, 23 deletions
diff --git a/src/interfaces/argument_parser.hpp b/src/interfaces/argument_parser.hpp
index fbf1b2a..742646d 100644
--- a/src/interfaces/argument_parser.hpp
+++ b/src/interfaces/argument_parser.hpp
@@ -15,11 +15,11 @@ struct ParsedArguments
class IArgumentParser
{
public:
- virtual ~IArgumentParser() = default;
+ virtual ~IArgumentParser() noexcept = default;
virtual ParsedArguments
parse(const std::vector<option> &options, const std::string_view &short_options,
const int &argc,
- char *const *argv) = 0; // NOLINT(cppcoreguidelines-avoid-c-arrays,
- // modernize-avoid-c-arrays)
+ char *const *argv) noexcept = 0; // NOLINT(cppcoreguidelines-avoid-c-arrays,
+ // modernize-avoid-c-arrays)
};
diff --git a/src/interfaces/input.hpp b/src/interfaces/input.hpp
index b8679c7..b243a16 100644
--- a/src/interfaces/input.hpp
+++ b/src/interfaces/input.hpp
@@ -5,15 +5,15 @@
class IInputHandler : public IObservable<char>
{
public:
- ~IInputHandler() override = default;
+ ~IInputHandler() noexcept override = default;
- void listen() const override = 0;
+ void listen() const noexcept override = 0;
- void attach(const char &event, Callback callback) override = 0;
+ void attach(const char &event, Callback callback) noexcept override = 0;
- void notify(const char &event) const override = 0;
+ void notify(const char &event) const noexcept override = 0;
- virtual void enter_raw_mode() = 0;
+ virtual void enter_raw_mode() noexcept = 0;
- virtual void leave_raw_mode() = 0;
+ virtual void leave_raw_mode() noexcept = 0;
};
diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp
index e0a92bf..44a26ed 100644
--- a/src/interfaces/matrix.hpp
+++ b/src/interfaces/matrix.hpp
@@ -9,21 +9,21 @@ template <typename Element>
class IMatrix
{
public:
- virtual ~IMatrix() = default;
+ virtual ~IMatrix() noexcept = default;
/**
* Fills the matrix with a element.
*
* @param element A element
*/
- virtual void fill(Element element) = 0;
+ 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 = 0;
+ [[nodiscard]] virtual Element get(const Vector2 &pos) const noexcept = 0;
/**
* Sets a element of the matrix.
@@ -31,17 +31,17 @@ public:
* @param pos The position of a element
* @param element A new element
*/
- virtual void set(const Vector2 &pos, Element element) = 0;
+ virtual void set(const Vector2 &pos, Element element) noexcept = 0;
/**
* Returns the number of rows the matrix has.
*/
- [[nodiscard]] virtual uint32_t rows() const = 0;
+ [[nodiscard]] virtual uint32_t rows() const noexcept = 0;
/**
* Returns the number of columns the matrix has.
*/
- [[nodiscard]] virtual uint32_t columns() const = 0;
+ [[nodiscard]] virtual uint32_t columns() const noexcept = 0;
};
template <typename Element>
diff --git a/src/interfaces/observable.hpp b/src/interfaces/observable.hpp
index 7dbd50a..1777b7d 100644
--- a/src/interfaces/observable.hpp
+++ b/src/interfaces/observable.hpp
@@ -8,11 +8,11 @@ template <typename Event>
class IObservable
{
public:
- virtual ~IObservable() = default;
+ virtual ~IObservable() noexcept = default;
- virtual void listen() const = 0;
+ virtual void listen() const noexcept = 0;
- virtual void attach(const Event &event, Callback callback) = 0;
+ virtual void attach(const Event &event, Callback callback) noexcept = 0;
- virtual void notify(const Event &event) const = 0;
+ virtual void notify(const Event &event) const noexcept = 0;
};
diff --git a/src/interfaces/randomization.hpp b/src/interfaces/randomization.hpp
index 524069a..f290d5c 100644
--- a/src/interfaces/randomization.hpp
+++ b/src/interfaces/randomization.hpp
@@ -5,9 +5,9 @@
class ISeedGenerator
{
public:
- virtual ~ISeedGenerator() = default;
+ virtual ~ISeedGenerator() noexcept = default;
- [[nodiscard]] virtual uint32_t random_seed() const = 0;
+ [[nodiscard]] virtual uint32_t random_seed() const noexcept = 0;
};
using ISeedGeneratorFactory = std::shared_ptr<ISeedGenerator> (*)();
@@ -18,7 +18,7 @@ using ISeedGeneratorFactory = std::shared_ptr<ISeedGenerator> (*)();
class IRandomNumberGenerator
{
public:
- virtual ~IRandomNumberGenerator() = default;
+ virtual ~IRandomNumberGenerator() noexcept = default;
/**
* Returns a number in the range of a to b.
@@ -27,7 +27,7 @@ public:
* @param b A number greater than a
*/
[[nodiscard]] virtual uint32_t in_range(const uint32_t &a,
- const uint32_t &b) const = 0;
+ const uint32_t &b) const noexcept = 0;
};
using IRandomNumberGeneratorFactory =