libfswatch
1.9.3
|
A RAII wrapper around Microsoft Windows HANDLE
.
More...
#include <win_handle.hpp>
Public Member Functions | |
win_handle () | |
Constructs an instance wrapping INVALID_HANDLE_VALUE . | |
win_handle (HANDLE handle) | |
Constructs an instance wrapping handle . | |
virtual | ~win_handle () |
Destructs a handle. More... | |
operator HANDLE () const | |
Returns the handle value as HANDLE instance. | |
bool | is_valid () const |
Checks whether the handle is valid. More... | |
win_handle (const win_handle &)=delete | |
Deleted copy constructor. | |
win_handle & | operator= (const win_handle &)=delete |
Deleted copy assignment operator. | |
win_handle (win_handle &&other) noexcept | |
Move constructor. More... | |
win_handle & | operator= (win_handle &&other) noexcept |
Move assignment operator. More... | |
win_handle & | operator= (const HANDLE &handle) |
Assigns a handle to the current instance. More... | |
Static Public Member Functions | |
static bool | is_valid (const HANDLE &handle) |
Checks whether handle is valid. More... | |
A RAII wrapper around Microsoft Windows HANDLE
.
This class is a movable, non-copyable RAII wrapper on HANDLE
.
|
virtual |
Destructs a handle.
If the handle is valid (is_valid()) it is closed invoking CloseHandle()
.
|
noexcept |
Move constructor.
The move constructors moves the handle value wrapped by other
to the target instance. The handle value in other
is set to INVALID_HANDLE_VALUE
. The previously wrapped instance is closed invoking CloseHandle
if it is valid.
other | The handle to move. |
|
static |
Checks whether handle
is valid.
A handle
is valid is if its value is not null
and if is not INVALID_HANDLE_VALUE
.
handle | The handle to check. |
true
if handle
is valid, false
otherwise. bool fsw::win_handle::is_valid | ( | ) | const |
Checks whether the handle is valid.
true
if the handle is valid, false
otherwise.
|
noexcept |
Move assignment operator.
The move assignment operator moves the handle value wrapped by other
to the target instance. The handle value in other
is set to INVALID_HANDLE_VALUE
. The previously wrapped instance is closed invoking CloseHandle
if it is valid.
other | The handle to move. |
win_handle& fsw::win_handle::operator= | ( | const HANDLE & | handle | ) |
Assigns a handle
to the current instance.
The previously wrapped instance is closed invoking CloseHandle
if it is valid.
handle | The handle value to assign to the current instance. |