chsvlib
chsv helper source code

◆ AllocateAndFormatStringByTagsV()

CHAR_TYPE* Chusov::String::AllocateAndFormatStringByTagsV ( va_list  ap,
const CHAR_TYPE *restrict  lpszTagFormatString,
unsigned int  cNumberOfTagsPresent 
)

Allocates and initializes a string defined by format specified using PrintfA_s or PrintfW_s control sequences and user-defined tags.

Template Parameters
CHAR_TYPEis a type of the allocated string. Currently the template is defined only for CHAR_TYPE=char and CHAR_TYPE=wchar_t resolving to AllocateAndFormatStringByTagsVA and AllocateAndFormatStringByTagsVW respectively.
Parameters
apis a variable list of arguments containing parameters describing tags and parameters for the PrintfA_s (if CHAR_TYPE=char) or PrintfW_s (if CHAR_TYPE=wchar_t) sequences. The first set of the parameters constitute a set of groups defining associations for the tags. The last set is processed to perform the sPrintfA_s or sPrintfW_s formatting. The parameters for the tag formatting are defined by groups. Each one consists on a tag name string,a pointer to a callback procedure associating the tag with the user-defined description, a user defined parameter for the callback and the flag signalling if the description would be the same for the all instances of the tag in the format. See descriptions of the AllocateAndFormatStringByTagsA and AllocateAndFormatStringByTagsW functions for further explanation.
[in]lpszTagFormatStringis a zero-terminated string specifying the format.
[in]cNumberOfTagsPresentis a number of different tags specified in the format string and, therefore, a number of groups of entities of the variable parameters list.
Returns
On success the function returns a pointer to the allocated memory holding the string constructed according to the specified format. The returned string buffer must be freed using one of the free functions defined in the Chusov::Memory or Chusov::String namespaces. On failure the function returns NULL. Use GetLastChsvError function to get extended error information.
Remarks
See descriptions of the AllocateAndFormatStringByTagsA and AllocateAndFormatStringByTagsW functions for more detailed information about the template instantiations.
See also
AllocateAndFormatStringByTags;
AllocateAndFormatStringByTagsIndirect;
AllocateString;
AllocateAndFormatString;
FreeString;
SecureFreeString.