Time Shield Library 2.0.0
C++ library for working with time
Loading...
Searching...
No Matches
time_shield::WsaGuard Class Reference

Singleton guard for WinSock initialization. More...

#include <wsa_guard.hpp>

Public Member Functions

bool success () const noexcept
 Returns whether WSAStartup was successful.
 
int ret_code () const noexcept
 Returns the result code from WSAStartup.
 
const WSADATA & data () const noexcept
 Returns the WSAData structure (valid only if successful).
 

Static Public Member Functions

static const WsaGuard & instance ()
 Returns the singleton instance, initializing WSA if needed.
 

Private Member Functions

 WsaGuard ()
 
 ~WsaGuard ()=default
 
 WsaGuard (const WsaGuard &)=delete
 
WsaGuard & operator= (const WsaGuard &)=delete
 

Private Attributes

WSADATA m_wsa_data {}
 
int m_ret_code = -1
 

Detailed Description

Singleton guard for WinSock initialization.

Definition at line 30 of file wsa_guard.hpp.

Constructor & Destructor Documentation

◆ WsaGuard() [1/2]

time_shield::WsaGuard::WsaGuard ( )
inlineprivate

Definition at line 54 of file wsa_guard.hpp.

◆ ~WsaGuard()

time_shield::WsaGuard::~WsaGuard ( )
privatedefault

◆ WsaGuard() [2/2]

time_shield::WsaGuard::WsaGuard ( const WsaGuard & )
privatedelete

Member Function Documentation

◆ data()

const WSADATA & time_shield::WsaGuard::data ( ) const
inlinenoexcept

Returns the WSAData structure (valid only if successful).

Definition at line 49 of file wsa_guard.hpp.

◆ instance()

static const WsaGuard & time_shield::WsaGuard::instance ( )
inlinestatic

Returns the singleton instance, initializing WSA if needed.

Definition at line 33 of file wsa_guard.hpp.

◆ operator=()

WsaGuard & time_shield::WsaGuard::operator= ( const WsaGuard & )
privatedelete

◆ ret_code()

int time_shield::WsaGuard::ret_code ( ) const
inlinenoexcept

Returns the result code from WSAStartup.

Definition at line 44 of file wsa_guard.hpp.

◆ success()

bool time_shield::WsaGuard::success ( ) const
inlinenoexcept

Returns whether WSAStartup was successful.

Definition at line 39 of file wsa_guard.hpp.

Member Data Documentation

◆ m_ret_code

int time_shield::WsaGuard::m_ret_code = -1
private

Definition at line 64 of file wsa_guard.hpp.

◆ m_wsa_data

WSADATA time_shield::WsaGuard::m_wsa_data {}
private

Definition at line 63 of file wsa_guard.hpp.


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