chsvlib
chsv helper source code

◆ AllocateAndCopyString()

RETURN_CHAR_TYPE* Chusov::String::AllocateAndCopyString ( const SOURCE_CHAR_TYPE *  pszRight)
noexcept

Allocates and returns a copy of a string.

Template Parameters
RETURN_CHAR_TYPEis defines a type of a string to create, that is multibyte string for RETURN_CHAR_TYPE=char or wide string for RETURN_CHAR_TYPE=wchar_t.
SOURCE_CHAR_TYPEis a type of a string to initialize the allocated buffer with. If it is the same type as RETURN_CHAR_TYPE the source string is copied to the allocated buffer without any transform. Otherwise the input string is converted to the appropriate format internally. See remarks.
Parameters
[in]pszRightis an input string used to initialize the output.
Returns
Returns a pointer to a copy of the input string. The allocated buffer returned should be deallocated using the FreeString function or any other free functions defined in chsvmem.h. On failure the function returns NULL setting corresponding chsvlib error code.
Remarks
The template is currently resolved to one of four wraps over functions depending on template parameters as follows:
RETURN_CHAR_TYPE SOURCE_CHAR_TYPE Resolves to a wrap over
char char AllocateAndCopyStringA
wchar_t wchar_t AllocateAndCopyStringW
char wchar_t AllocateMBSFromWide
wchar_t char AllocateWideFromMBS


FreeString;
AllocateString;
AllocateAndFormatString;
AllocateAndFormatStringByTags;
AllocateAndFormatStringByTagsIndirect.