chsvlib
chsv helper source code

◆ ConstructPlatformException() [4/4]

void ConstructPlatformException ( platform_code_t  nPlatformCode,
GetDescriptionFn &&  fnGetDescription,
Exception::vararg_tag_t  ,
const CharType *restrict  pszDescription,
std::va_list  ap 
)
protectednoexcept

A template function performing a construction of the class template instantiation.

Template Parameters
CharTypeis a type of the description to be set which is either char or wchar_t.
GetDescriptionFnis a type of the function object mapping the specified platform error code to the corresponding description. The default-constructed objects of the type should support the parentheses operator receiving a numeric error code of the platform_code_t type as its only parameter and mapping it to the corresponding wide string description. The latter can be represented as a C pointer to a zero-terminated wide string copied into the internal buffers or as a managed unique pointer to the wide C string, such as [std::unique_ptr] or Chusov::String::AutoCString, or as an [std::basic_string] object. The returned object can be empty in order to specify an error condition.
Parameters
[in]nPlatformCodeis a numeric value of the platform specific error code to be handled by the constructed object.
[in]fnGetDescriptionis a universal reference to a function object of the GetDescriptionFn type, which is used to map the error code to the corresponding wide string description.
[in]apis a variable argument list used during formatting using the rules defined for the Chusov::String::Printf function.
[in]pszDescriptionis a wide-string defining the format of the description to be associated with the error code. At first, the formatting is performed according to the rules defined for the Chusov::String::Printf function. The result of this operation is also processed to replace the tags in angle brackets with the corresponding text, as specified for the PlatformException class template.