opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
window_id.h
Go to the documentation of this file.
1#pragma once
2
3namespace osc { class App; }
4
5namespace osc
6{
7 class WindowID final {
8 public:
9 // Default constructs a "null" `WindowID`.
10 WindowID() = default;
11
12 // Constructs a `WindowID` from a type-erased void pointer. This is mostly
13 // used when `WindowID`s are stored by third-party libraries.
14 explicit WindowID(void* handle) : handle_{handle} {}
15
16 friend bool operator==(const WindowID&, const WindowID&) = default;
17
18 // Converts a `WindowID` to a boolean, which can be used to check for
19 // its nullstate.
20 explicit operator bool () const { return handle_ != nullptr; }
21
22 // Converts a `WindowID` to a type-erased void pointer. This is mostly used
23 // when `WindowID`s are stored by third-party libraries.
24 explicit operator void* () const { return handle_; }
25
26 // Resets the state of the `WindowID` to the default-constructed (false-y) state.
27 void reset() { handle_ = nullptr; }
28
29 private:
30 void* handle_ = nullptr;
31 };
32}
Definition window_id.h:7
void reset()
Definition window_id.h:27
WindowID(void *handle)
Definition window_id.h:14
WindowID()=default
friend bool operator==(const WindowID &, const WindowID &)=default
Definition custom_decoration_generator.h:5
constexpr U to(T &&value)
Definition conversion.h:56