From 5a0b3927a33807cca4c77c40eb873f8a3b51b0b0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 29 Apr 2023 19:07:11 +0100 Subject: Drop .hpp for header only things Half of them acquired a .cpp part anyway --- ui/modeHelper.hpp | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 ui/modeHelper.hpp (limited to 'ui/modeHelper.hpp') diff --git a/ui/modeHelper.hpp b/ui/modeHelper.hpp deleted file mode 100644 index 77707f2..0000000 --- a/ui/modeHelper.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -union SDL_Event; - -enum ModeSecondClick { Unset, Reset, NoAction }; -template class Mode { -public: - explicit Mode(Target & t) : target {t} { } - - Target & target; - - template - auto - toggle(Params &&... params) - { - return [params..., this](const SDL_Event &) { - toggleSetMode(std::forward(params)...); - }; - } - -private: - template - void - toggleSetMode(Params &&... params) - { - if (dynamic_cast(target.get())) { - if constexpr (msc == ModeSecondClick::Unset) { - target.reset(); - } - if constexpr (msc == ModeSecondClick::Reset) { - target = std::make_unique(std::forward(params)...); - } - } - else { - target = std::make_unique(std::forward(params)...); - } - } -}; -- cgit v1.2.3