Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Generic scopeguard designed to handle any type of handle. More...
#include <ScopeGuard.h>
Public Member Functions | |
CScopeGuard (std::function< Deleter > del, Handle handle=invalid) | |
~CScopeGuard () noexcept | |
operator Handle () const | |
operator bool () const | |
void | attach (Handle handle) |
attach a new handle to this instance, if there's already a handle it will be closed. | |
Handle | release () |
release the managed handle so that it won't be auto closed | |
void | reset () |
reset the instance, closing any managed handle and setting it to invalid | |
CScopeGuard ()=delete | |
CScopeGuard (const CScopeGuard &rhs)=delete | |
CScopeGuard & | operator= (const CScopeGuard &rhs)=delete |
CScopeGuard (CScopeGuard &&rhs) noexcept | |
CScopeGuard & | operator= (CScopeGuard &&rhs) noexcept |
Generic scopeguard designed to handle any type of handle.
This is not necessary but recommended to cut down on some typing using CSocketHandle = CScopeGuard<SOCKET, INVALID_SOCKET, closesocket>;
CSocketHandle sh(closesocket, open(thingy));
|
inline |
|
inlinenoexcept |
|
delete |
|
delete |
|
inlinenoexcept |
|
inline |
attach a new handle to this instance, if there's already a handle it will be closed.
[in] | handle | The handle to manage |
|
inline |
|
inline |
|
delete |
|
inlinenoexcept |
|
inline |
release the managed handle so that it won't be auto closed
|
inline |
reset the instance, closing any managed handle and setting it to invalid