Skip to main content

GLFWRAIIGuard.ixx File

RAII guard class to initialize/terminate GLFW. More...

Included Headers

#include <GLFW/glfw3.h> #include <stdexcept>

Namespaces Index

namespacehelios
namespaceext

Platform-specific extensions and backend implementations. More...

namespaceglfw

GLFW-specific implementations. More...

namespaceapp

GLFW application infrastructure. More...

Classes Index

classGLFWRAIIGuard

A RAII Guard for GLFW. More...

Description

RAII guard class to initialize/terminate GLFW.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file GLFWRAIIGuard.ixx
3 * @brief RAII guard class to initialize/terminate GLFW.
4 */
5module;
6
7#include <GLFW/glfw3.h>
8#include <stdexcept>
9
10export module helios.ext.glfw.app.GLFWRAIIGuard;
11
12export namespace helios::ext::glfw::app {
13
14 /**
15 * @brief A RAII Guard for GLFW.
16 *
17 * This class makes sure that GLFW is properly initialized when an instance is created
18 * and terminated when this instance is destroyed.
19 *
20 * @see https://en.cppreference.com/w/cpp/language/raii.html
21 */
23
24 public:
25 /**
26 * @brief Initializes the glfw library by calling `glfwInit()`.
27 *
28 * @throws std::runtime_error if initialization fails
29 *
30 * @see https://www.glfw.org/docs/latest/group__init.html#ga317aac130a235ab08c6db0834907d85e
31 */
33 if (glfwInit() == GLFW_FALSE) {
34 throw std::runtime_error("Failed to initialize glfw");
35 }
36 }
37
38
39 /**
40 * @brief Terminates the glfw library by calling `glfwTerminate()`.
41 *
42 * @see https://www.glfw.org/docs/latest/group__init.html#gaaae48c0a18607ea4a4ba951d939f0901
43 */
45 glfwTerminate();
46 }
47
48 /**
49 * @brief No copy or move.
50 */
51 GLFWRAIIGuard(const GLFWRAIIGuard&) = delete;
53 GLFWRAIIGuard(const GLFWRAIIGuard&&) = delete;
55 };
56
57}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.