chsvlib
chsv helper source code
ExceptionWithGenericCode< code_t, class > Class Template Reference

A class template specifying a generic exception which has a corresponding integral error code. More...

#include <chsvexception.h>

Inheritance diagram for ExceptionWithGenericCode< code_t, class >:
Collaboration diagram for ExceptionWithGenericCode< code_t, class >:

Classes

struct  noprintf
 An empty type defining an overload of SetCodeAndDescription method that discards Printf formatting during construction of an exception description. More...
 

Public Member Functions

template<class char_t , class fn_t , class = decltype(std::declval<fn_t&&>()(std::declval<code_t>()))>
 ExceptionWithGenericCode (code_t nCode, fn_t &&GetDescription, Exception::vararg_tag_t, const char_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept
 Constructs an exception object by a specified error code, a functor, mapping the code to a description text, a format string and parameters for the formatting as specified by the Chusov::String::Printf function. . More...
 
template<class char_t >
 ExceptionWithGenericCode (code_t nCode, Exception::vararg_tag_t, const char_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept
 Constructs an exception object by a specified error code, a format string and Printf formatting parameters. . More...
 
template<class char_t , class fn_t , class = decltype(std::declval<fn_t>()(code_t())), class ... DescriptionFormatParams>
 ExceptionWithGenericCode (code_t nCode, fn_t &&GetDescription, const char_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object by a specified error code, a functor, mapping the code to a description text, a format string and parameters for the formatting as specified by the Chusov::String::Printf function. . More...
 
template<class char_t , class ... DescriptionFormatParams>
 ExceptionWithGenericCode (code_t nCode, const char_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object with a specified error code, a format string and parameters for the formatting as specified by the Chusov::String::Printf function. . More...
 
template<class char_t , class ... DescriptionFormatParams>
 ExceptionWithGenericCode (code_t nCode, std::nullptr_t, const char_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object with a specified error code, a format string and parameters for the formatting as specified by the Chusov::String::Printf function. . More...
 
template<class fn_t , class = decltype(std::declval<fn_t&&>()(std::declval<code_t>()))>
 ExceptionWithGenericCode (code_t nCode, fn_t &&GetDescription) noexcept
 Constructs an exception object by a specified error code and a functor, mapping the code to a textual description. More...
 
 ExceptionWithGenericCode (code_t nCode) noexcept
 Constructs an exception object with the specified error code. . More...
 
template<class fn_t , class char_t , class traits_t , class alloc_t , class = decltype(std::declval<fn_t>()(code_t()))>
 ExceptionWithGenericCode (code_t nCode, fn_t &&GetDescription, const std::basic_string< char_t, traits_t, alloc_t > &strDescriptionFormat) noexcept
 Constructs an exception object by a specified error code, and an std::basic_string string object. . More...
 
template<class char_t , class traits_t , class alloc_t >
 ExceptionWithGenericCode (code_t nCode, const std::basic_string< char_t, traits_t, alloc_t > &strDescriptionFormat) noexcept
 Constructs an exception object by a specified error code, and a description provided by an std::basic_string object. . More...
 
template<class char_t , class traits_t , class alloc_t >
 ExceptionWithGenericCode (code_t nCode, std::nullptr_t, const std::basic_string< char_t, traits_t, alloc_t > &strDescriptionFormat) noexcept
 Constructs an exception object by a specified error code, and a description provided by an std::basic_string object. . More...
 
 ExceptionWithGenericCode (const ExceptionWithGenericCode &refRight)=default
 Default copy constructor.
 
 ExceptionWithGenericCode (ExceptionWithGenericCode &&refRight)=default
 Default move constructor.
 
code_t Code () const noexcept
 Returns an error code, the exception object is bound with.
 
- Public Member Functions inherited from Exception
 Exception ()=default
 Construct a default exception object without specified description. The default description is a valid but unspecified C string.
 
template<class ... DescriptionFormatParams>
 Exception (const char *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfA formatting rules. More...
 
template<class ... DescriptionFormatParams>
 Exception (const wchar_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfW formatting rules. More...
 
 Exception (vararg_tag_t, const char *restrict lpszDescriptionFormat, std::va_list ap) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfA formatting rules. More...
 
 Exception (vararg_tag_t, const wchar_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept
 Constructs an exception object with an optional description, specified by Chusov::String::PrintfW formatting rules. More...
 
template<class traits_t , class alloc_t >
 Exception (const std::basic_string< char, traits_t, alloc_t > &strDescription) noexcept
 Constructs an exception based on a textual description, represented as a multi-byte std::basic_string object. More...
 
template<class traits_t , class alloc_t >
 Exception (const std::basic_string< wchar_t, traits_t, alloc_t > &strDescription) noexcept
 Constructs an exception based on a textual description, represented as a wide std::basic_string object. More...
 
 Exception (const Exception &refRight)=default
 Standard copy constructor.
 
 Exception (Exception &&ex)=default
 Standard move constructor.
 
template<class StdExcept , class = std::enable_if_t<Implementation::is_std_except<StdExcept>::value>>
 Exception (StdExcept &&ex) noexcept
 
virtual ~Exception () noexcept
 A default destructor.
 
Exceptionoperator= (const Exception &)=default
 Standard copy assignment operator.
 
Exceptionoperator= (Exception &&)=default
 Standard move assignment operator.
 
virtual const char * what () const noexcept
 Returns a description, corresponding to the exception, represented as a multi-byte string constructed using the current locale.
 
virtual const wchar_t * What () const noexcept
 Returns a description, corresponding to the exception, represented as a wide string.
 

Protected Member Functions

 ExceptionWithGenericCode ()=default
 A default protected constructor of the exception object.
 
template<class char_t >
auto SetCodeAndDescription (code_t nCode, const char_t *lpszDescription) noexcept -> std::enable_if_t< std::is_integral< char_t >::value >
 Sets a new error code and description without any formatting. More...
 
template<class char_t , class fn_t , class = decltype(std::declval<fn_t&&>()(std::declval<code_t>()))>
auto SetCodeAndDescription (code_t nCode, fn_t &&GetDescription, const String::TAG_DESCRIPTION_PARAM< char_t > *restrict pTags, std::size_t cTags, noprintf, const char_t *restrict lpszDescriptionFormat) noexcept -> std::enable_if_t< std::is_integral< char_t >::value, decltype(void(std::declval< fn_t && >()(std::declval< code_t >())))>
 Sets a new exception description, according to the specified error code, formatting rules and a functor object mapping the error code to its default string description. . More...
 
template<class char_t , class fn_t , class = decltype(std::declval<fn_t&&>()(std::declval<code_t>()))>
auto SetCodeAndDescription (code_t nCode, fn_t &&GetDescription, const String::TAG_DESCRIPTION_PARAM< char_t > *restrict pTags, std::size_t cTags, Exception::vararg_tag_t, const char_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept -> std::enable_if_t< std::is_integral< char_t >::value, decltype(void(std::declval< fn_t && >()(std::declval< code_t >())))>
 Sets a new exception description, according to the specified error code, formatting rules (with custom tags), variadic list of parameters and a function object mapping the error code to its default string description. . More...
 
template<class char_t , class fn_t , class = decltype(std::declval<fn_t&&>()(std::declval<code_t>()))>
auto SetCodeAndDescription (code_t nCode, fn_t &&GetDescription, Exception::vararg_tag_t, const char_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept -> std::enable_if_t< std::is_integral< char_t >::value, decltype(void(std::declval< fn_t && >()(std::declval< code_t >())))>
 Sets a new exception description, according to the specified error code, formatting rules (without tag customization), variadic list of parameters and a function object mapping the error code to its default string description. More...
 
template<class char_t >
auto SetCodeAndDescription (code_t nCode, Exception::vararg_tag_t, const char_t *restrict lpszDescriptionFormat, std::va_list ap) noexcept -> std::enable_if_t< std::is_integral< char_t >::value >
 Sets a new exception description, according to the specified error code, formatting rules (without tag customization), variadic list of parameters and a function object mapping the error code to its default string description. More...
 
template<class char_t , class fn_t , class ... DescriptionFormatParams>
auto SetCodeAndDescription (code_t nCode, fn_t &&GetDescription, const String::TAG_DESCRIPTION_PARAM< char_t > *restrict pTags, std::size_t cTags, const char_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept -> std::enable_if_t< std::is_integral< char_t >::value &&Chusov::String::is_valid_printf_type_set_v< DescriptionFormatParams... >, decltype(void(std::declval< fn_t && >()(std::declval< code_t >())))>
 Sets a new exception description, according to the specified error code, formatting rules (with custom tags), formatting parameter pack and a functor object mapping the error code to its default string description. . More...
 
template<class char_t , class fn_t , class ... DescriptionFormatParams>
auto SetCodeAndDescription (code_t nCode, fn_t &&GetDescription, const char_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept -> std::enable_if_t< std::is_integral< char_t >::value &&Chusov::String::is_valid_printf_type_set_v< DescriptionFormatParams... >, decltype(void(std::declval< fn_t && >()(std::declval< code_t >())))>
 Sets a new exception description, according to the specified error code, formatting rules (without tag customization), formatting parameter pack and a functor object mapping the error code to its default string description. More...
 
template<class char_t , class ... DescriptionFormatParams>
auto SetCodeAndDescription (code_t nCode, const char_t *restrict lpszDescriptionFormat, DescriptionFormatParams ... formatting_params) noexcept -> std::enable_if_t< Chusov::String::is_valid_printf_type_set_v< DescriptionFormatParams... >>
 Sets a new exception description, according to the specified error code, formatting rules (without tag customization), variadic list of parameters and a function object mapping the error code to its default string description. More...
 
- Protected Member Functions inherited from Exception
void SetWhat (wchar_t *lpszOwnedWhat) noexcept
 
void SetWhat (char *lpszOwnedWhat) noexcept
 

Static Protected Member Functions

template<class char_t >
static const char_t * GetDefaultDescription (code_t) noexcept
 A default function object as a stub for methods that do not specify user-defined functors. It maps any integral code to a NULL description. More...
 

Additional Inherited Members

- Public Types inherited from Exception
enum  vararg_tag_t { vararg_tag }
 

Detailed Description

template<class code_t = unsigned long, class = typename std::enable_if<std::is_integral<code_t>::value || std::is_enum<code_t>::value>::type>
class Chusov::Exceptions::ExceptionWithGenericCode< code_t, class >

A class template specifying a generic exception which has a corresponding integral error code.

Template Parameters
code_tis a type of an error code the class is to hold. The type must correspond to one of the standard integral types.
Examples
chsvexception\nested_exceptions.cpp.

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