E-MailRelay
Public Member Functions | Static Public Member Functions | List of all members
GNet::Descriptor Class Reference

A class that encapsulates a network socket file descriptor and an associated windows event handle. More...

#include <gdescriptor.h>

Public Member Functions

 Descriptor () noexcept
 Default constructor. More...
 
 Descriptor (SOCKET, HANDLE=HNULL) noexcept
 Constructor. More...
 
bool valid () const noexcept
 Returns true if the socket part is valid, ignoring the handle. More...
 
SOCKET fd () const noexcept
 Returns the socket part. More...
 
HANDLE h () const noexcept
 Returns the handle part. More...
 
bool operator== (const Descriptor &other) const noexcept
 Comparison operator. More...
 
bool operator!= (const Descriptor &other) const noexcept
 Comparison operator. More...
 
bool operator< (const Descriptor &other) const noexcept
 Comparison operator. More...
 
void streamOut (std::ostream &) const
 Used by op<<(). More...
 

Static Public Member Functions

static Descriptor invalid () noexcept
 Returns a descriptor with an invalid socket part and a zero handle. More...
 

Detailed Description

A class that encapsulates a network socket file descriptor and an associated windows event handle.

Definition at line 36 of file gdescriptor.h.

Constructor & Destructor Documentation

◆ Descriptor() [1/2]

GNet::Descriptor::Descriptor ( )
noexcept

Default constructor.

Definition at line 24 of file gdescriptor_unix.cpp.

◆ Descriptor() [2/2]

GNet::Descriptor::Descriptor ( SOCKET  fd,
HANDLE  h = HNULL 
)
inlineexplicitnoexcept

Constructor.

Definition at line 77 of file gdescriptor.h.

Member Function Documentation

◆ fd()

SOCKET GNet::Descriptor::fd ( ) const
inlinenoexcept

Returns the socket part.

Definition at line 84 of file gdescriptor.h.

◆ h()

HANDLE GNet::Descriptor::h ( ) const
noexcept

Returns the handle part.

Definition at line 34 of file gdescriptor_unix.cpp.

◆ invalid()

GNet::Descriptor GNet::Descriptor::invalid ( )
inlinestaticnoexcept

Returns a descriptor with an invalid socket part and a zero handle.

Definition at line 108 of file gdescriptor.h.

◆ operator!=()

bool GNet::Descriptor::operator!= ( const Descriptor other) const
inlinenoexcept

Comparison operator.

Definition at line 96 of file gdescriptor.h.

◆ operator<()

bool GNet::Descriptor::operator< ( const Descriptor other) const
inlinenoexcept

Comparison operator.

Definition at line 102 of file gdescriptor.h.

◆ operator==()

bool GNet::Descriptor::operator== ( const Descriptor other) const
inlinenoexcept

Comparison operator.

Definition at line 90 of file gdescriptor.h.

◆ streamOut()

void GNet::Descriptor::streamOut ( std::ostream &  stream) const

Used by op<<().

Definition at line 39 of file gdescriptor_unix.cpp.

◆ valid()

bool GNet::Descriptor::valid ( ) const
noexcept

Returns true if the socket part is valid, ignoring the handle.

Definition at line 29 of file gdescriptor_unix.cpp.


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