diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-02 21:24:34 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:54 +0200 |
commit | c2f41a5b278df2837f4cc5617df07248a048d93c (patch) | |
tree | 0187794794cd96958720219340b85d31e6194c39 | |
parent | 68ee3c67a8d23f68d9f87aea08548aba598ef14a (diff) |
refactor: add virtual destructors to interfaces
This is required by clang++ for some reason...
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | src/interfaces/argument_parser.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/bounds.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/game.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/input.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/matrix.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/observable.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/randomization.hpp | 4 | ||||
-rw-r--r-- | src/interfaces/scene.hpp | 2 | ||||
-rw-r--r-- | src/interfaces/vector2.hpp | 2 |
10 files changed, 21 insertions, 0 deletions
diff --git a/.clang-tidy b/.clang-tidy index 6fffdc8..e22d9fe 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,6 +11,7 @@ Checks: ' -bugprone-lambda-function-name, -bugprone-reserved-identifier, -google-readability-braces-around-statements, + -cppcoreguidelines-special-member-functions, -modernize-return-braced-init-list, -modernize-use-trailing-return-type, -misc-non-private-member-variables-in-classes' diff --git a/src/interfaces/argument_parser.hpp b/src/interfaces/argument_parser.hpp index 222d9e0..fbf1b2a 100644 --- a/src/interfaces/argument_parser.hpp +++ b/src/interfaces/argument_parser.hpp @@ -15,6 +15,8 @@ struct ParsedArguments class IArgumentParser { public: + virtual ~IArgumentParser() = default; + virtual ParsedArguments parse(const std::vector<option> &options, const std::string_view &short_options, const int &argc, diff --git a/src/interfaces/bounds.hpp b/src/interfaces/bounds.hpp index 9cec97e..7e920cf 100644 --- a/src/interfaces/bounds.hpp +++ b/src/interfaces/bounds.hpp @@ -15,6 +15,8 @@ enum CoordsValidation class IBounds { public: + virtual ~IBounds() = default; + [[nodiscard]] virtual unsigned int width() const = 0; virtual void width(unsigned int width) = 0; diff --git a/src/interfaces/game.hpp b/src/interfaces/game.hpp index f9d851b..114f019 100644 --- a/src/interfaces/game.hpp +++ b/src/interfaces/game.hpp @@ -3,5 +3,7 @@ class IGame { public: + virtual ~IGame() = default; + virtual void run() = 0; }; diff --git a/src/interfaces/input.hpp b/src/interfaces/input.hpp index 956ec4f..2e93b5d 100644 --- a/src/interfaces/input.hpp +++ b/src/interfaces/input.hpp @@ -5,6 +5,8 @@ class IInputHandler : public IObservable<char> { public: + virtual ~IInputHandler() = default; + void listen() const override = 0; void attach(const char &event, Callback callback) override = 0; diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp index 5dc5f2e..ab5f40b 100644 --- a/src/interfaces/matrix.hpp +++ b/src/interfaces/matrix.hpp @@ -10,6 +10,8 @@ template <typename Element> class IMatrix { public: + virtual ~IMatrix() = default; + /** * Fills the matrix with a element. * diff --git a/src/interfaces/observable.hpp b/src/interfaces/observable.hpp index ca8ffda..7dbd50a 100644 --- a/src/interfaces/observable.hpp +++ b/src/interfaces/observable.hpp @@ -8,6 +8,8 @@ template <typename Event> class IObservable { public: + virtual ~IObservable() = default; + virtual void listen() const = 0; virtual void attach(const Event &event, Callback callback) = 0; diff --git a/src/interfaces/randomization.hpp b/src/interfaces/randomization.hpp index 78456a2..9eeec0a 100644 --- a/src/interfaces/randomization.hpp +++ b/src/interfaces/randomization.hpp @@ -6,6 +6,8 @@ class ISeedGenerator { public: + virtual ~ISeedGenerator() = default; + [[nodiscard]] virtual unsigned int random_seed() const = 0; }; @@ -17,6 +19,8 @@ using ISeedGeneratorFactory = std::function<std::shared_ptr<ISeedGenerator>()>; class IRandomNumberGenerator { public: + virtual ~IRandomNumberGenerator() = default; + /** * Returns a number in the range of a to b. * diff --git a/src/interfaces/scene.hpp b/src/interfaces/scene.hpp index 8b34dae..39110a2 100644 --- a/src/interfaces/scene.hpp +++ b/src/interfaces/scene.hpp @@ -9,6 +9,8 @@ class IScene { public: + virtual ~IScene() = default; + virtual void enter() = 0; virtual void leave() = 0; diff --git a/src/interfaces/vector2.hpp b/src/interfaces/vector2.hpp index a58686f..569dc30 100644 --- a/src/interfaces/vector2.hpp +++ b/src/interfaces/vector2.hpp @@ -6,6 +6,8 @@ class IVector2 { public: + virtual ~IVector2() = default; + /** * Returns the X coordinate. */ |