ReactOS  0.4.15-dev-4614-ga5a6101
ATL::CHandle Class Reference

#include <atlbase.h>

Inheritance diagram for ATL::CHandle:
Collaboration diagram for ATL::CHandle:

Public Member Functions

 CHandle ()
 
 CHandle (_Inout_ CHandle &handle)
 
 CHandle (_In_ HANDLE handle)
 
 ~CHandle ()
 
CHandleoperator= (_Inout_ CHandle &handle)
 
 operator HANDLE () const
 
void Attach (_In_ HANDLE handle)
 
HANDLE Detach ()
 
void Close ()
 

Public Attributes

HANDLE m_handle
 

Detailed Description

Definition at line 252 of file atlbase.h.

Constructor & Destructor Documentation

◆ CHandle() [1/3]

ATL::CHandle::CHandle ( )
inline

Definition at line 258 of file atlbase.h.

258  :
259  m_handle(NULL)
260  {
261  }
HANDLE m_handle
Definition: atlbase.h:255
#define NULL
Definition: types.h:112

◆ CHandle() [2/3]

ATL::CHandle::CHandle ( _Inout_ CHandle handle)
inline

Definition at line 263 of file atlbase.h.

263  :
264  m_handle(NULL)
265  {
266  Attach(handle.Detach());
267  }
HANDLE m_handle
Definition: atlbase.h:255
void Attach(_In_ HANDLE handle)
Definition: atlbase.h:301
#define NULL
Definition: types.h:112

◆ CHandle() [3/3]

ATL::CHandle::CHandle ( _In_ HANDLE  handle)
inlineexplicit

Definition at line 269 of file atlbase.h.

269  :
271  {
272  }
HANDLE m_handle
Definition: atlbase.h:255

◆ ~CHandle()

ATL::CHandle::~CHandle ( )
inline

Definition at line 274 of file atlbase.h.

275  {
276  if (m_handle)
277  {
278  Close();
279  }
280  }
void Close()
Definition: atlbase.h:314
HANDLE m_handle
Definition: atlbase.h:255

Member Function Documentation

◆ Attach()

void ATL::CHandle::Attach ( _In_ HANDLE  handle)
inline

Definition at line 301 of file atlbase.h.

302  {
303  ATLASSERT(m_handle == NULL);
304  m_handle = handle;
305  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HANDLE m_handle
Definition: atlbase.h:255
#define NULL
Definition: types.h:112

Referenced by CHandle(), ATL::CEvent::Create(), ATL::CMutex::Create(), ATL::CSemaphore::Create(), ATL::CEvent::Open(), ATL::CMutex::Open(), ATL::CSemaphore::Open(), and operator=().

◆ Close()

void ATL::CHandle::Close ( void  )
inline

Definition at line 314 of file atlbase.h.

315  {
316  if (m_handle)
317  {
319  m_handle = NULL;
320  }
321  }
#define CloseHandle
Definition: compat.h:598
HANDLE m_handle
Definition: atlbase.h:255
#define NULL
Definition: types.h:112

Referenced by operator=(), and ~CHandle().

◆ Detach()

HANDLE ATL::CHandle::Detach ( )
inline

Definition at line 307 of file atlbase.h.

308  {
310  m_handle = NULL;
311  return handle;
312  }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HANDLE m_handle
Definition: atlbase.h:255
#define NULL
Definition: types.h:112

◆ operator HANDLE()

ATL::CHandle::operator HANDLE ( ) const
inline

Definition at line 296 of file atlbase.h.

297  {
298  return m_handle;
299  }
HANDLE m_handle
Definition: atlbase.h:255

◆ operator=()

Definition at line 282 of file atlbase.h.

283  {
284  if (this != &handle)
285  {
286  if (m_handle)
287  {
288  Close();
289  }
290  Attach(handle.Detach());
291  }
292 
293  return *this;
294  }
void Close()
Definition: atlbase.h:314
HANDLE m_handle
Definition: atlbase.h:255
void Attach(_In_ HANDLE handle)
Definition: atlbase.h:301

Member Data Documentation

◆ m_handle

HANDLE ATL::CHandle::m_handle

Definition at line 255 of file atlbase.h.

Referenced by Attach(), Close(), Detach(), operator HANDLE(), operator=(), and ~CHandle().


The documentation for this class was generated from the following file: