nngn
Loading...
Searching...
No Matches
handle.h
Go to the documentation of this file.
1
#ifndef NNGN_GRAPHICS_OPENGL_HANDLE_H
2
#define NNGN_GRAPHICS_OPENGL_HANDLE_H
3
4
#include <utility>
5
6
#include "
utils/def.h
"
7
8
#include "
opengl.h
"
9
10
namespace
nngn
{
11
12
template
<
typename
T>
class
OpenGLHandle
{
13
u32
m_h
= 0;
14
public
:
15
constexpr
OpenGLHandle
() =
default
;
16
explicit
constexpr
OpenGLHandle
(
u32
h) noexcept :
m_h
(h) {}
17
OpenGLHandle
(
const
OpenGLHandle
&) =
delete
;
18
OpenGLHandle
(
OpenGLHandle
&&lhs)
noexcept
19
{ this->m_h = std::exchange(lhs.m_h, {}); }
20
OpenGLHandle
&
operator=
(
const
OpenGLHandle
&) =
delete
;
21
OpenGLHandle
&
operator=
(
OpenGLHandle
&&lhs)
noexcept
22
{ this->m_h = std::exchange(lhs.m_h, {}); }
23
~OpenGLHandle
() {
static_cast<
T
*
>
(
this
)->destroy(); }
24
u32
id
()
const
{
return
this->
m_h
; }
25
u32
&
id
() {
return
this->
m_h
; }
26
};
27
28
}
29
30
#endif
nngn::OpenGLHandle
Definition
handle.h:12
nngn::OpenGLHandle::operator=
OpenGLHandle & operator=(const OpenGLHandle &)=delete
nngn::OpenGLHandle::OpenGLHandle
OpenGLHandle(const OpenGLHandle &)=delete
nngn::OpenGLHandle::id
u32 & id()
Definition
handle.h:25
nngn::OpenGLHandle::m_h
u32 m_h
Definition
handle.h:13
nngn::OpenGLHandle::operator=
OpenGLHandle & operator=(OpenGLHandle &&lhs) noexcept
Definition
handle.h:21
nngn::OpenGLHandle::OpenGLHandle
constexpr OpenGLHandle(u32 h) noexcept
Definition
handle.h:16
nngn::OpenGLHandle::OpenGLHandle
OpenGLHandle(OpenGLHandle &&lhs) noexcept
Definition
handle.h:18
nngn::OpenGLHandle::id
u32 id() const
Definition
handle.h:24
nngn::OpenGLHandle::OpenGLHandle
constexpr OpenGLHandle()=default
nngn::OpenGLHandle::~OpenGLHandle
~OpenGLHandle()
Definition
handle.h:23
def.h
T
#define T(f0, f1, f2)
nngn
Definition
audio.cpp:7
nngn::u32
std::uint32_t u32
Definition
def.h:14
opengl.h
src
graphics
opengl
handle.h
Generated by
1.11.0