|
kodi
|
Generic scopeguard designed to handle any type of handle. More...
#include <ScopeGuard.h>
Public Member Functions | |
| CScopeGuard (std::function< Deleter > del, Handle handle=invalid) | |
| 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. More... | |
| Handle | release () |
| release the managed handle so that it won't be auto closed More... | |
| void | reset () |
| reset the instance, closing any managed handle and setting it to invalid | |
| 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 |
attach a new handle to this instance, if there's already a handle it will be closed.
| [in] | handle | The handle to manage |
|
inline |
release the managed handle so that it won't be auto closed
1.8.13