basic_error_desc Class Template Reference
[Error Library]

#include <stlsoft/error/error_desc.hpp>

List of all members.


Detailed Description

template<typename C>
class stlsoft::basic_error_desc< C >

Utility class that loads the system string representation corresponding to a given error code.

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()));

Note:
Naturally, String Access Shim" functions c_str_ptr, c_str_data, c_str_len are defined for the class template, so it may be manipulated generically. (This is very handy when used with the Pantheios logging library.)

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.

Member Typedef Documentation

typedef C char_type

The character type.

The current parameterisation of the type.

typedef int error_type

The error type.

typedef size_t size_type

The size type.


Constructor & Destructor Documentation

basic_error_desc ( error_type  error = errno  )  [explicit]

Loads the error string associated with the given code.

Parameters:
error The errno value whose string equivalent will be searched

~basic_error_desc (  )  throw ()

Releases any resources.


Member Function Documentation

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.


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

Generated on Thu Jun 10 08:58:45 2010 for STLSoft by  doxygen 1.5.6