#include <stlsoft/error/error_desc.hpp>
Consider the following example:
stlsoft::error_desc_a ed1(ENOMEM); stlsoft::error_desc ed3(ENOMEM); assert(0 == ::strcmp("Access is denied", ed1.c_str())); assert(0 == ::wcscmp(L"Access is denied", ed2.c_str())); assert(0 == ::_tcscmp(_T("Access is denied"), ed3.c_str()));
By default, the strings are looked up from the Windows system DLLs. To use a specific message-string DLL, simply specify this as the second argument to the constructor, as in (assuming MyCustomDll.DLL maps ERROR_ACCESS_DENIED
to "No Access!"
):
stlsoft::error_desc_a ed1(ERROR_ACCESS_DENIED, "MyCustomDll.DLL"); assert(0 == ::strcmp("No Access!", ed1.c_str()));
Types | |
typedef C | char_type |
The character type. | |
typedef basic_error_desc< C > | class_type |
The current parameterisation of the type. | |
typedef int | error_type |
The error type. | |
typedef size_t | size_type |
The size type. | |
Public Member Functions | |
Construction | |
basic_error_desc (error_type error=errno) | |
Loads the error string associated with the given code. | |
~basic_error_desc () throw () | |
Releases any resources. | |
Attributes | |
char_type const * | get_description () const throw () |
The error description. | |
Accessors | |
char_type const * | c_str () const throw () |
The error description. | |
size_type | length () const throw () |
The length of the error description. | |
size_type | size () const throw () |
The length of the error description. |
typedef C char_type |
The character type.
typedef basic_error_desc<C> class_type |
The current parameterisation of the type.
typedef int error_type |
The error type.
basic_error_desc | ( | error_type | error = errno |
) | [explicit] |
Loads the error string associated with the given code.
error | The errno value whose string equivalent will be searched |
~basic_error_desc | ( | ) | throw () |
Releases any resources.
char_type const* get_description | ( | ) | const throw () |
The error description.
char_type const* c_str | ( | ) | const throw () |
The error description.
size_type length | ( | ) | const throw () |
The length of the error description.
size_type size | ( | ) | const throw () |
The length of the error description.