Skip to content

mdz_utf16_insertUtf8_string_async

Maksym Dzyubenko edited this page Feb 7, 2024 · 1 revision

Insert UTF-8 string pUtf8Source in string. UTF-8 bytes are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count.
String reserved area and pUtf8Source->m_pData should not overlap.

mdz_bool mdz_utf16_insertUtf8_string_async(
  struct mdz_Utf16* pUtf16,
  size_t nLeftPos,
  const struct mdz_Utf8* pUtf8Source,
  mdz_bool bReserve,
  struct mdz_asyncData* pAsyncData);

Synchronous version:
mdz_utf16_insertUtf8_string(pUtf16, nLeftPos, pUtf8Source, bReserve);

Parameter Description
pUtf16 pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nLeftPos 0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed
pUtf8Source pointer to UTF-8 string to insert. String is returned by mdz_utf8_create() or mdz_utf8_create_attached()
bReserve if mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncData pointer to shared async data for asynchronous call, or NULL if call should be synchronous
Return Description
mdz_false if pUtf16 is NULL
mdz_false if bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_false if bReserve == mdz_true and there is not enough capacity for inserted data, but m_pData is attached using mdz_utf16_attachData() (MDZ_ERROR_ATTACHED)
mdz_false if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_false if string reserved area and pUtf8Source->m_pData overlap (MDZ_ERROR_OVERLAP)
mdz_true if pUtf8Source == NULL (MDZ_ERROR_SOURCE), or pUtf8Source.Size == 0 (MDZ_ERROR_ZEROCOUNT), nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_true insertion succeeded
mdz_utf16 API Reference is generated using mdzApiRefGenerator.

mdz_string functions

mdz_ansi functions

mdz_utf8 functions

mdz_wchar functions

mdz_utf16 functions

mdz_utf32 functions

mdz_string API Reference is generated using mdzApiRefGenerator.
Clone this wiki locally