libfswatch  1.9.3
Public Member Functions | Static Public Member Functions | List of all members
fsw::win_error_message Class Reference

Helper class to get the system-defined error message for a Microsoft Windows' error code. More...

#include <win_error_message.hpp>

Public Member Functions

 win_error_message (DWORD error_code)
 Constructs an error message using the specified error_code. More...
 
 win_error_message ()
 Constructs an error message using the last error code of the calling thread, retrieved with a call to GetLastError(). More...
 
DWORD get_error_code () const
 Gets the error code. More...
 
std::wstring get_message () const
 Gets the system-defined error message. More...
 
 operator std::wstring () const
 Gets ths system-defined error message. More...
 

Static Public Member Functions

static win_error_message current ()
 Constructs an instance of this class using the last error code of the calling thread, returned by a call to GetLastError(). More...
 

Detailed Description

Helper class to get the system-defined error message for a Microsoft Windows' error code.

This class uses the FormatMessage() API to returns a std::wstring instance containing the system-defined error message for a Microsoft Windows' error code.

Constructor & Destructor Documentation

fsw::win_error_message::win_error_message ( DWORD  error_code)

Constructs an error message using the specified error_code.

Parameters
error_codeThe error code.
fsw::win_error_message::win_error_message ( )

Constructs an error message using the last error code of the calling thread, retrieved with a call to GetLastError().

See also
current()

Member Function Documentation

static win_error_message fsw::win_error_message::current ( )
static

Constructs an instance of this class using the last error code of the calling thread, returned by a call to GetLastError().

See also
win_error_message()
DWORD fsw::win_error_message::get_error_code ( ) const

Gets the error code.

Returns
The error code.
std::wstring fsw::win_error_message::get_message ( ) const

Gets the system-defined error message.

The system-defined error message is retrieved with a call to FormatMessage with the FORMAT_MESSAGE_FROM_SYSTEM formatting option.

Returns
The error message.
fsw::win_error_message::operator std::wstring ( ) const

Gets ths system-defined error message.

See also
get_message()

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