chsvlib
chsv helper source code

◆ SetDescription() [1/5]

auto SetDescription ( const char_t *restrict  pszDescriptionFormat,
DescriptionFormatParams ...  formatting_params 
) -> std::enable_if_t<std::is_integral<char_t>::value>
protectednoexcept

Sets a result of the Printf formatting as a new description for the exception object.

Template Parameters
char_tis a type of the description to be set which is either char or wchar_t.
DescriptionFormatParamsDeduced types of additional arguments passed to the function to format the message.
Parameters
[in]pszDescriptionFormatis a zero terminated string together with additional parameters specifying a Printf format string according to which the description is created. Also, the parameter may contain may contain <CODE> and/or <DESCRIPTION> tags to be replaced by a hexadecimal representation of the errc error code and by a corresponding description respectively. Any angle brackets in the format string are treated specially as stated for the Chusov::String::AllocateAndFormatStringByTagsW, except that in the case of the method user-defined tags are not supported.
[in]formatting_paramsis a set of variable arguments used together with the pszDescriptionFormat formatting string to synthesize a description bound with the exception according to the Printf formatting rules.

The function is a wrap around the ChsvCodeException::SetCodeAndDescription(code_t nCode, fn_t &&GetDescription, const String::TAG_DESCRIPTION_PARAM_W *restrict pTags, std::size_t cTags, std::va_list ap, const wchar_t *restrict lpszDescriptionFormat).

Remarks
The method treats angle brackets met within the formatting string specially. Any substring between the brackets is considered a tag, as specified for the Chusov::String::AllocateAndFormatStringByTagsIndirectW function. Since only <CODE> and <DESCRIPTION> tags are supported, a presence of angle brackets within the formatting string can cause errors. To specify angles for the resulting description, use doubled brackets (i.e. "<<" and ">>" to be replaced by left and right brackets respectively. Also note that at first method processes the Printf formatting, result of which is passed as a formatting string for tag formatting. Thus the presence of brackets after the Printf formatting must be taken into account.