From b4a17e3a28f31217c79faa160f5e6abd720da054 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Mon, 23 Sep 2024 23:53:01 -0500 Subject: Applying RAII types --- src/sdl_main_window.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/sdl_main_window.hpp (limited to 'src/sdl_main_window.hpp') diff --git a/src/sdl_main_window.hpp b/src/sdl_main_window.hpp new file mode 100644 index 0000000..fbb9dd4 --- /dev/null +++ b/src/sdl_main_window.hpp @@ -0,0 +1,31 @@ +#ifndef SDL_MAIN_WINDOW_HPP +#define SDL_MAIN_WINDOW_HPP + +#include "sdl_context.hpp" + +#include + +namespace bookmouse { + +class SdlMainWindow { + public: + explicit SdlMainWindow(const SdlContext& sdlContext) noexcept(false); + SdlMainWindow(const SdlMainWindow&) = delete; + SdlMainWindow(SdlMainWindow&&) = delete; + ~SdlMainWindow(); + + SdlMainWindow& operator=(const SdlMainWindow&) = delete; + SdlMainWindow& operator=(SdlMainWindow&&) = delete; + + constexpr SDL_Window* window() + { + return m_window; + } + + private: + SDL_Window* m_window{nullptr}; +}; + +} // namespace bookmouse + +#endif -- cgit v1.2.3