HomeUnser TeamB2B Produktekeyboard_arrow_downmdz_ansikeyboard_arrow_downmdz_unicodekeyboard_arrow_downReferencemdz_vectorkeyboard_arrow_downB2C ProdukteShopGesetzlichesKontakte | mdz_unicode API Reference is generated by mdzApiRefGenerator. mdz_unicode API Referencemdz_unicode Reference mdz_wchar Reference mdz_utf8 Reference mdz_utf16 Reference mdz_utf32 Reference Many functions of mdz_unicode accept parameters for asynchronous execution. The only relevant parameter is: - struct mdz_asyncData* pAsyncData - pointer to shared async data for asynchronous call, or NULL if call should be synchronous Fields of struct mdz_asyncData* are following: Type | Parameter | Description | void* | m_pString | Pointer to string instance | mdz_bool | m_bFinished | mdz_true if the call is completely finished. Otherwise mdz_false (if interrupted/cancelled) | size_t | m_nResult | Result of call. Invalid if call is not completely finished (m_bFinished is mdz_false ) | void* | m_pData | Additional data returned by call (if any). Invalid if call is not completely finished (m_bFinished is mdz_false ) | mdz_bool | m_bCancel | Should be set by client in mdz_true during call execution, to cancel the call. Otherwise mdz_false | pthread_t / HANDLE | m_hThread | Handle to thread on which the call is executed. May be used by client for wait operations |
mdz_unicode initialization functions.
mdz_unicode_initInitializes unicode library. This function should be caled before any other function of the library.mdz_bool mdz_unicode_init(const uint32_t* pFirstNameHash, const uint32_t* pLastNameHash, const uint32_t* pEmailHash, const uint32_t* pLicenseHash); Parameter | Description |
---|
pFirstNameHash | user first name hash code | pLastNameHash | user last name hash code | pEmailHash | user e-mail hash code | pLicenseHash | license hash code |
Return | Description |
---|
mdz_true | if the initialization has succeed, otherwise false | mdz_unicode Referencemdz_unicode_init_attachedInitializes unicode library. This function should be caled before any other function of the library. Memory for license data starts at position pStart . Size of internal initialization structure is returned in pSize.mdz_bool mdz_unicode_init_attached(const uint32_t* pFirstNameHash, const uint32_t* pLastNameHash, const uint32_t* pEmailHash, const uint32_t* pLicenseHash, const char* pStart, size_t nAreaSize, size_t* pOutSize); Parameter | Description |
---|
pFirstNameHash | user first name hash code | pLastNameHash | user last name hash code | pEmailHash | user e-mail hash code | pLicenseHash | license hash code | pStart | memory start position of license data | nAreaSize | size of available memory from pStart in bytes. Should be large enough for license data (> 500 bytes) | pOutSize | actual size of placed license data in bytes |
Return | Description |
---|
mdz_true | if the initialization has succeed, otherwise false | mdz_unicode Referencemdz_unicode_uninitUn-initializes unicode library and frees corresponding memory allocations.void mdz_unicode_uninit(void); mdz_unicode Reference
mdz_wchar is dynamically-sized contiguous string, containing C wchar_t characters.
Capacity - how many "wide"-characters memory is reserved for.
Size - how many "wide"-characters are actually used in a string, excluding terminating 0.
Length - actual length of string in symbols, excluding terminating 0. "surrogate pairs" count as 1 symbol. "reserve/AndReserve" functions allocate/reallocate memory dynamically using malloc() /realloc() . "attach" functionality allows attaching contiguous block of memory to string, for using string functions on it.
UTF-16 "surrogate pairs" are supported and checked. Unicode "combining characters" are not specially-distinguished and counted as distinct symbols. Endianness of bytes in "wide"-character - is always endianness of platform.
Size of wchar_t in bytes - is compiler-dependend. At the moment, library supports only wchar_t with size of 2 or 4 bytes.
mdz_wchar_createCreate empty "wide"-character string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.struct mdz_Wchar* mdz_wchar_create(size_t nEmbedSize); Parameter | Description |
---|
nEmbedSize | size of "embedded part" of string. There is no "embedded part" if 0 |
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if memory allocation failed | NULL | if sizeof(wchar_t ) != 2 (see description in file header) | Result | pointer to string for use in other mdz_wchar functions | mdz_wchar Reference mdz_wchar_create_attachedCreate empty "wide"-character string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0. Memory for wchar structure starts at position pStart . Size of internal wchar structure (it is usually bigger than mdz_Wchar !) is returned in pSize.struct mdz_Wchar* mdz_wchar_create_attached(const void* pStart, size_t nAreaSizeBytes, size_t* pOutSize); Parameter | Description |
---|
pStart | memory start position of wchar structure | nAreaSizeBytes | size of available memory from pStart in bytes. Should be large enough for internal wchar structure | pOutSize | returned actual size of allocated internal wchar structure in bytes, may be NULL if not needed |
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if sizeof(wchar_t ) != 2 and sizeof(wchar_t ) != 4 (see description in file header) | NULL | if pStart == NULL or pSize == NULL | NULL | if size in nSize is smaller than size of internal wchar structure | Result | pointer to string for use in other mdz_wchar functions. Normally it equals to pStart | mdz_wchar Reference mdz_wchar_destroyDestroy "wide"-character string including underlying data. After destroying, pointer to string is set to NULL . If wchar is attached using mdz_wchar_createAttached(), free() will not be called. If wchar data is attached using mdz_wchar_attachData() , m_pData will not be destroyed.void mdz_wchar_destroy(struct mdz_Wchar** ppWchar); Parameter | Description |
---|
ppWchar | pointer to pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() | mdz_wchar Reference mdz_wchar_clearClear m_pData of "wide"-character string with setting Size in 0.void mdz_wchar_clear(struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() | mdz_wchar Reference mdz_wchar_attachDataAttach pre-allocated data to string, assigning pData to m_pData . If attached, m_pData will not be destroyed in mdz_wchar_destroy() mdz_bool mdz_wchar_attachData(struct mdz_Wchar* pWchar, wchar_t* pData, size_t nOffsetFromStart, size_t nCapacity, enum mdz_attach_type enAttachType); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() | pData | pointer to pre-allocated data to attach | nOffsetFromStart | position in pre-allocated data to attach from. Can be > 0 | nCapacity | full capacity pre-allocated data in items | enAttachType | type of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed |
Return | Description |
---|
mdz_false | if pWchar == NULL | mdz_false | if test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_false | if pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE) | mdz_false | if enAttachType == MDZ_ATTACH_SIZE_TERMINATOR and pData contains invalid "wide"-characters (MDZ_ERROR_CONTENT) | mdz_true | operation succeeded | mdz_wchar Reference mdz_wchar_reserveReserve nNewCapacity bytes for string. Size and Length do not change.mdz_bool mdz_wchar_reserve(struct mdz_Wchar* pWchar, size_t nNewCapacity); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() | nNewCapacity | new capacity in "wide"-characters to reserve |
Return | Description |
---|
mdz_false | if pWchar == NULL | mdz_false | if memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if test-license is used and nNewCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_true | reservation succeeded, or nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY) | mdz_wchar Reference mdz_wchar_capacityReturn string Capacity in "wide"-characters.size_t mdz_wchar_capacity(const struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() |
Return | Description |
---|
SIZE_MAX | if pWchar == NULL | Capacity | otherwise | mdz_wchar Reference mdz_wchar_sizeReturn string Size in "wide"-characters.size_t mdz_wchar_size(const struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() |
Return | Description |
---|
SIZE_MAX | if pWchar == NULL | Size | otherwise | mdz_wchar Reference mdz_wchar_lengthReturn string Length in symbols.size_t mdz_wchar_length(const struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() |
Return | Description |
---|
SIZE_MAX | if pWchar == NULL | Length | otherwise | mdz_wchar Reference mdz_wchar_offsetFromStartReturn string OffsetFromStart in "wide"-characters.size_t mdz_wchar_offsetFromStart(const struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() |
Return | Description |
---|
SIZE_MAX | if pWchar == NULL | OffsetFromStart | otherwise | mdz_wchar Reference mdz_wchar_isAttachedDataReturn if string data is attached.mdz_bool mdz_wchar_isAttachedData(const struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() |
Return | Description |
---|
mdz_false | if pWchar == NULL | mdz_false | if string data is not attached | mdz_true | if string data is attached | mdz_wchar Reference mdz_wchar_embedSizeReturn string "embedded part" Size in "wide" characters.size_t mdz_wchar_embedSize(const struct mdz_Wchar* pWchar); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached() |
Return | Description |
---|
SIZE_MAX | if pWchar == NULL | Result | "embedded part" Size otherwise | mdz_wchar Reference mdz_wchar_insertWchar_asyncInsert nCount "wide"-characters in string. Size grows on nCount . Length grows on symbols count.mdz_bool mdz_wchar_insertWchar_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertWchar(pWchar, nLeftPos, pwcItems, nCount, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pwcItems | "wide"-characters to insert | nCount | number of "wide"-characters to insert | 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 pWchar == 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_wchar_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 pwcItems contain invalid "wide"-character(s) (MDZ_ERROR_CONTENT) | mdz_true | if pwcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertWchar_string_asyncInsert "wide"-characters string pWcharSource in string. Size grows on nCount. Length grows on symbols count.mdz_bool mdz_wchar_insertWchar_string_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const struct mdz_Wchar* pWcharSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertWchar_string(pWchar, nLeftPos, pWcharSource, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pWcharSource | pointer to "wide"-characters string to insert. String is returned by mdz_wchar_create() or mdz_wchar_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 pWchar == 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_wchar_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pWcharSource == NULL (MDZ_ERROR_SOURCE), or pWcharSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertAnsi_asyncInsert nCount ASCII/ANSI bytes in string. Characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertAnsi_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertAnsi(pWchar, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pcItems | bytes to insert | nCount | number of bytes to insert | 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 pWchar 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_wchar_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertAnsi_string_asyncInsert ASCII/ANSI string pAnsiSource in string. Characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertAnsi_string_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const struct mdz_Ansi* pAnsiSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertAnsi_string(pWchar, nLeftPos, pAnsiSource, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pAnsiSource | pointer to ASCII/ANSI string to insert. String is returned by mdz_ansi_create() or mdz_ansi_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 pWchar 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_wchar_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pAnsiSource == NULL (MDZ_ERROR_SOURCE), or pAnsiSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertUtf8_asyncInsert nCount UTF-8 characters in string. UTF-8 characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertUtf8_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertUtf8(pWchar, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pcItems | UTF-8 characters to insert | nCount | number of UTF-8 characters to insert in bytes | 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 pWchar 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_wchar_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 pcItems contain invalid UTF-8 character(s) (MDZ_ERROR_CONTENT) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertUtf8_string_asyncInsert UTF-8 string pUtf8Source in string. UTF-8 characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertUtf8_string_async(struct mdz_Wchar* pWchar, size_t nLeftPos, struct mdz_Utf8* pUtf8Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertUtf8_string(pWchar, nLeftPos, pUtf8Source, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 pWchar 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_wchar_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf8Source == NULL (MDZ_ERROR_SOURCE), or pUtf8Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertUtf16_asyncInsert nCount UTF-16 characters in string. UTF-16 characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertUtf16_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const uint16_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertUtf16(pWchar, nLeftPos, pItems, nCount, enEndianness, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pItems | UTF-16 characters to insert | nCount | number of UTF-16 characters to insert | enEndianness | endianness of UTF-16 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pWchar 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_wchar_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 pItems contain invalid UTF-16 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertUtf16_string_asyncInsert UTF-16 string pUtf16Source in string. UTF-16 characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertUtf16_string_async(struct mdz_Wchar* pWchar, size_t nLeftPos, struct mdz_Utf16* pUtf16Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertUtf16_string(pWchar, nLeftPos, pUtf16Source, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pUtf16Source | pointer to UTF-16 string to insert. String is returned by mdz_utf16_create() or mdz_utf16_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 pWchar 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_wchar_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf16Source == NULL (MDZ_ERROR_SOURCE), or pUtf16Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertUtf32_asyncInsert nCount UTF-32 characters in string. UTF-32 characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertUtf32_async(struct mdz_Wchar* pWchar, size_t nLeftPos, const uint32_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertUtf32(pWchar, nLeftPos, pItems, nCount, enEndianness, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pItems | UTF-32 characters to insert | nCount | number of UTF-32 characters to insert | enEndianness | endianness of UTF-32 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pWchar 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_wchar_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 pItems contain invalid UTF-32 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference mdz_wchar_insertUtf32_string_asyncInsert UTF-32 string pUtf32Source in string. UTF-32 characters are converted to "wide"-characters before isertion. Size grows on added "wide"-characters count. Length grows on added symbols count.mdz_bool mdz_wchar_insertUtf32_string_async(struct mdz_Wchar* pWchar, size_t nLeftPos, struct mdz_Utf32* pUtf32Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_wchar_insertUtf32_string(pWchar, nLeftPos, pUtf32Source, bReserve); Parameter | Description |
---|
pWchar | pointer to string returned by mdz_wchar_create() or mdz_wchar_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 | pUtf32Source | pointer to UTF-32 string to insert. String is returned by mdz_utf32_create() or mdz_utf32_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 pWchar 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_wchar_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf32Source == NULL (MDZ_ERROR_SOURCE), or pUtf32Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_wchar Reference
mdz_utf8 is dynamically-sized contiguous string, containing UTF-8 characters
If only ASCII/ANSI characters should be stored/processed - use mdz_ansi instead. It is much more speedy.
Capacity - how many bytes of memory is reserved.
Size - how many bytes are actually used in a string, excluding terminating 0.
Length - actual length of string in UTF-8 symbols, excluding terminating 0.
"reserve/AndReserve" functions allocate/reallocate memory dynamically using malloc() /realloc() . "attach" functionality allows attaching contiguous block of memory to string, for using string functions on it.
Unicode "combining characters" are not specially-distinguished and counted as a distinct symbols.
mdz_utf8_createCreate empty UTF-8 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.struct mdz_Utf8* mdz_utf8_create(size_t nEmbedSize); Parameter | Description |
---|
nEmbedSize | size of "embedded part" of string. There is no "embedded part" if 0 |
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if memory allocation failed | Result | pointer to string for use in other mdz_utf8 functions | mdz_utf8 Reference mdz_utf8_create_attachedCreate empty UTF-8 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0. Memory for utf8 structure starts at position pStart . Size of internal utf8 structure (it is usually bigger than mdz_Utf8 !) is returned in pSize.struct mdz_Utf8* mdz_utf8_create_attached(const void* pStart, size_t nAreaSizeBytes, size_t* pOutSize); Parameter | Description |
---|
pStart | memory start position of utf8 structure | nAreaSizeBytes | size of available memory from pStart in bytes. Should be large enough for internal utf8 structure | pOutSize | returned actual size of placed internal utf8 structure in bytes, may be NULL if not needed |
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if pStart == NULL or pSize == NULL | NULL | if size in nSize is smaller than size of internal utf8 structure | Result | pointer to string for use in other mdz_utf8 functions. Normally it equals to pStart | mdz_utf8 Reference mdz_utf8_destroyDestroy UTF-8 string including underlying data. After destroying, pointer to string is set to NULL . If utf8 is attached using mdz_utf8_createAttached(), free() will not be called. If utf8 data is attached using mdz_utf8_attachData() , m_pData will not be destroyed.void mdz_utf8_destroy(struct mdz_Utf8** ppUtf8); Parameter | Description |
---|
ppUtf8 | pointer to pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | mdz_utf8 Reference mdz_utf8_clearClear m_pData of UTF-8 string with setting Size in 0.void mdz_utf8_clear(struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | mdz_utf8 Reference mdz_utf8_attachDataAttach pre-allocated data to UTF-8 string, assigning pData to m_pData . If attached, m_pData will not be destroyed in mdz_utf8_destroy() mdz_bool mdz_utf8_attachData(struct mdz_Utf8* pUtf8, unsigned char* pData, size_t nOffsetFromStart, size_t nCapacity, enum mdz_attach_type enAttachType); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | pData | pointer to pre-allocated data to attach | nOffsetFromStart | position in pre-allocated data to attach from. Can be > 0 | nCapacity | full capacity pre-allocated data in items | enAttachType | type of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed |
Return | Description |
---|
mdz_false | if pUtf8 == NULL | mdz_false | if test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_false | if pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE) | mdz_false | if enAttachType == MDZ_ATTACH_SIZE_TERMINATOR and pData contains invalid UTF-8 characters (MDZ_ERROR_CONTENT) | mdz_true | operation succeeded | mdz_utf8 Reference mdz_utf8_reserveReserve nNewCapacity bytes for UTF-8 string. String Size and Length do not change.mdz_bool mdz_utf8_reserve(struct mdz_Utf8* pUtf8, size_t nNewCapacity); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nNewCapacity | new capacity in bytes to reserve |
Return | Description |
---|
mdz_false | if pUtf8 == NULL | mdz_false | if memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if test-license is used and nNewCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_true | reservation succeeded, or nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY) | mdz_utf8 Reference mdz_utf8_capacityReturn string Capacity in bytes.size_t mdz_utf8_capacity(const struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() |
Return | Description |
---|
SIZE_MAX | if pUtf8 == NULL | Capacity | otherwise | mdz_utf8 Reference mdz_utf8_sizeReturn string Size in bytes.size_t mdz_utf8_size(const struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf8 == NULL | Size | otherwise | mdz_utf8 Reference mdz_utf8_lengthReturn string Length in symbols.size_t mdz_utf8_length(const struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf8 == NULL | Length | otherwise | mdz_utf8 Reference mdz_utf8_offsetFromStartReturn string OffsetFromStart in bytes.size_t mdz_utf8_offsetFromStart(const struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf8 == NULL | OffsetFromStart | otherwise | mdz_utf8 Reference mdz_utf8_isAttachedDataReturn if string data is attached.mdz_bool mdz_utf8_isAttachedData(const struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() |
Return | Description |
---|
mdz_false | if pUtf8 == NULL | mdz_false | if string data is not attached | mdz_true | if string data is attached | mdz_utf8 Reference mdz_utf8_embedSizeReturn string "embedded part" Size in bytes.size_t mdz_utf8_embedSize(const struct mdz_Utf8* pUtf8); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf8 == NULL | Result | "embedded part" Size otherwise | mdz_utf8 Reference mdz_utf8_insertUtf8_asyncInsert nCount UTF-8 bytes in string. Size grows on nCount . Length grows on symbols count.mdz_bool mdz_utf8_insertUtf8_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertUtf8(pUtf8, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pcItems | UTF-8 bytes to insert | nCount | number of UTF-8 bytes to insert or 0 if pcItems until 0-terminator should be used | 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 pUtf8 == 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_utf8_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 pcItems contain invalid UTF-8 byte(s) (MDZ_ERROR_CONTENT) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertUtf8_string_asyncInsert UTF-8 string pUtf8Source in string. Size grows on nCount. Length grows on symbols count. This function performs significantly better than mdz_utf8_insertUtf8_async() - because there is no additional validation of inserted string.mdz_bool mdz_utf8_insertUtf8_string_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const struct mdz_Utf8* pUtf8Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertUtf8_string(pUtf8, nLeftPos, pUtf8Source, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. 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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf8Source == NULL (MDZ_ERROR_SOURCE), or pUtf8Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertAnsi_asyncInsert nCount ASCII/ANSI bytes in string. Characters are converted to UTF-8 characters before isertion. Size grows on added bytes. Length grows on added symbols count.mdz_bool mdz_utf8_insertAnsi_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertAnsi(pUtf8, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pcItems | bytes to insert | nCount | number of bytes to insert or 0 if pcItems until 0-terminator should be used | 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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertAnsi_string_asyncInsert ASCII/ANSI string pAnsiSource in string. Characters are converted to UTF-8 characters before isertion. Size grows on added bytes. Length grows on added symbols count.mdz_bool mdz_utf8_insertAnsi_string_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const struct mdz_Ansi* pAnsiSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertAnsi_string(pUtf8, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pAnsiSource | pointer to ASCII/ANSI string to insert. String is returned by mdz_ansi_create() or mdz_ansi_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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pAnsiSource == NULL (MDZ_ERROR_SOURCE), or pAnsiSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertWchar_asyncInsert nCount "wide"-characters in string. Characters are converted to UTF-8 characters before isertion. Size grows on added bytes. Length grows on symbols count.mdz_bool mdz_utf8_insertWchar_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertWchar(pUtf8, nLeftPos, pwcItems, nCount, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_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 | pwcItems | "wide"-characters to insert | nCount | number of "wide"-characters to insert or 0 if characters until 0-terminator should be used | 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 pUtf8 == 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_utf8_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 pwcItems contain invalid "wide"-character(s) (MDZ_ERROR_CONTENT) | mdz_true | if pwcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertWchar_string_asyncInsert "wide"-characters string pWcharSource in string. Characters are converted to UTF-8 characters before isertion. Size grows on added bytes. Length grows on symbols count. For 2-bytes "wide"-characters - see information concerning Unicode "surrogate pairs"/"combining characters" in description of mdz_utf8_insertUtf16_async() . For 4-bytes "wide"-characters - see information concerning Unicode "combining characters" in description of mdz_utf8_insertUtf32_async() .mdz_bool mdz_utf8_insertWchar_string_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const struct mdz_Wchar* pWcharSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertWchar_string(pUtf8, nLeftPos, pWcharSource, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_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 | pWcharSource | pointer to "wide"-characters string to insert. String is returned by mdz_wchar_create() or mdz_wchar_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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pWcharSource == NULL (MDZ_ERROR_SOURCE), or pWcharSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertUtf16_asyncInsert nCount UTF-16 characters in string. UTF-16 characters are converted to UTF-8 before isertion. Size grows on added bytes. Length grows on symbols count.
UTF-16 "surrogate pairs" are supported and counted as 1 symbol (4 bytes size).
UTF-16 "combining characters" are not specially-distinguished and counted as a separate UTF-8 symbol.mdz_bool mdz_utf8_insertUtf16_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const uint16_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertUtf16(pUtf8, nLeftPos, pItems, nCount, enEndianness, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pItems | UTF-16 characters to insert | nCount | number of UTF-16 characters to insert or 0 if pcItems until 0-terminator should be used | enEndianness | endianness of UTF-16 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pUtf8 == 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_utf8_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 pItems contain invalid UTF-16 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertUtf16_string_asyncInsert UTF-16 string pUtf16Source in string. UTF-16 characters are converted to UTF-8 before isertion. Size grows on added bytes. Length grows on symbols count.
UTF-16 "surrogate pairs" are supported and counted as 1 symbol (4 bytes size).
UTF-16 "combining characters" are not specially-distinguished and counted as a separate UTF-8 symbol.mdz_bool mdz_utf8_insertUtf16_string_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const struct mdz_Utf16* pUtf16Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertUtf16_string(pUtf8, nLeftPos, pUtf16Source, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pUtf16Source | pointer to UTF16 string to insert. String is returned by mdz_utf16_create() or mdz_utf16_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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf16Source == NULL (MDZ_ERROR_SOURCE), or pUtf16Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertUtf32_asyncInsert nCount UTF-32 characters in string. UTF-32 characters are converted to UTF-8 before isertion. Size grows on added bytes. Length grows on symbols count. Unicode "combining characters" are not specially-distinguished and counted as a separate UTF-8 symbol.mdz_bool mdz_utf8_insertUtf32_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const uint32_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertUtf32(pUtf8, nLeftPos, pItems, nCount, enEndianness, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pItems | UTF-32 characters to insert | nCount | number of UTF-32 characters to insert or 0 if pcItems until 0-terminator should be used | enEndianness | endianness of UTF-32 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference mdz_utf8_insertUtf32_string_asyncInsert UTF-32 string pUtf32Source in string. UTF-32 characters are converted to UTF-8 before isertion. Size grows on added bytes. Length grows on symbols count. Unicode "combining characters" are not specially-distinguished and counted as a separate UTF-8 symbol.mdz_bool mdz_utf8_insertUtf32_string_async(struct mdz_Utf8* pUtf8, size_t nLeftPos, const struct mdz_Utf32* pUtf32Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf8_insertUtf32_string(pUtf8, nLeftPos, pUtf32Source, bReserve); Parameter | Description |
---|
pUtf8 | pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pUtf32Source | pointer to UTF-32 string to insert. String is returned by mdz_utf32_create() or mdz_utf32_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 pUtf8 == 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_utf8_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf32Source == NULL (MDZ_ERROR_SOURCE), or pUtf32Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf8 Reference
mdz_utf16 is dynamically-sized contiguous string, containing UTF-16 characters.
Capacity - how many UTF-16 characters memory is reserved for.
Size - how many UTF-16 characters are actually used in a string, excluding terminating 0.
Length - actual length of string in symbols, excluding terminating 0. "surrogate pairs" count as 1 symbol.
"reserve/AndReserve" functions allocate/reallocate memory dynamically using malloc() /realloc() . "attach" functionality allows attaching contiguous block of memory to string, for using string functions on it.
UTF-16 "surrogate pairs" are supported and checked Unicode "combining characters" are not specially-distinguished and counted as distinct symbols Endianness of bytes in UTF-16 character - is defined by m_enEndianness and set using enEndianness during string-creation in mdz_utf16_create()
mdz_utf16_createCreate empty UTF-16 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.struct mdz_Utf16* mdz_utf16_create(size_t nEmbedSize, enum mdz_endianness enEndianness); Parameter | Description |
---|
nEmbedSize | size of "embedded part" of string. There is no "embedded part" if 0 | enEndianness | endianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG
|
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if memory allocation failed | NULL | if invalid enEndianness
| Result | pointer to string for use in other mdz_utf16 functions | mdz_utf16 Reference mdz_utf16_create_attachedCreate empty UTF-16 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0. Memory for utf16 structure starts at position pStart . Size of internal utf16 structure (it is usually bigger than mdz_Utf16 !) is returned in pSize.struct mdz_Utf16* mdz_utf16_create_attached(const void* pStart, enum mdz_endianness enEndianness, size_t nAreaSizeBytes, size_t* pOutSize); Parameter | Description |
---|
pStart | memory start position of utf16 structure | enEndianness | endianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG
| nAreaSizeBytes | size of available memory from pStart in bytes. Should be large enough for internal utf16 structure | pOutSize | returned actual size of allocated internal utf16 structure in bytes, may be NULL if not needed |
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if invalid enEndianness
| NULL | if pStart == NULL or pSize == NULL | NULL | if size in nSize is smaller than size of internal utf16 structure | Result | pointer to string for use in other mdz_utf16 functions. Normally it equals to pStart | mdz_utf16 Reference mdz_utf16_destroyDestroy UTF-16 string including underlying data. After destroying, pointer to string is set to NULL . If utf16 is attached using mdz_utf16_createAttached(), free() will not be called. If utf16 data is attached using mdz_utf16_attachData() , m_pData will not be destroyed.void mdz_utf16_destroy(struct mdz_Utf16** ppUtf16); Parameter | Description |
---|
ppUtf16 | pointer to pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() | mdz_utf16 Reference mdz_utf16_clearClear m_pData of UTF-16 string with setting Size in 0.void mdz_utf16_clear(struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() | mdz_utf16 Reference mdz_utf16_attachDataAttach pre-allocated data to UTF-16 string, assigning pData to m_pData . If attached, m_pData will not be destroyed in mdz_utf16_destroy() mdz_bool mdz_utf16_attachData(struct mdz_Utf16* pUtf16, uint16_t* pData, size_t nOffsetFromStart, size_t nCapacity, enum mdz_attach_type enAttachType, enum mdz_endianness enEndianness); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() | pData | pointer to pre-allocated data to attach | nOffsetFromStart | position in pre-allocated data to attach from. Can be > 0 | nCapacity | full capacity pre-allocated data in items | enAttachType | type of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed | enEndianness | endianness of UTF-16 characters in pData . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" |
Return | Description |
---|
mdz_false | if pUtf16 == NULL | mdz_false | if test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_false | if pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE), or invalid pData endianness (MDZ_ERROR_ENDIANNESS) | mdz_false | if enAttachType == MDZ_ATTACH_SIZE_TERMINATOR and pData contains invalid UTF-16 characters (MDZ_ERROR_CONTENT) | mdz_true | operation succeeded | mdz_utf16 Reference mdz_utf16_reserveReserve nNewCapacity bytes for UTF-16 string. Size and Length do not change.mdz_bool mdz_utf16_reserve(struct mdz_Utf16* pUtf16, size_t nNewCapacity); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() | nNewCapacity | new capacity in UTF-16 characters to reserve |
Return | Description |
---|
mdz_false | if pUtf16 == NULL | mdz_false | if memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if test-license is used and nNewCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_true | reservation succeeded, or nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY) | mdz_utf16 Reference mdz_utf16_capacityReturn string Capacity in UTF-16 characters.size_t mdz_utf16_capacity(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf16 == NULL | Capacity | otherwise | mdz_utf16 Reference mdz_utf16_sizeReturn string Size in UTF-16 characters.size_t mdz_utf16_size(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf16 == NULL | Size | otherwise | mdz_utf16 Reference mdz_utf16_lengthReturn string Length in symbols.size_t mdz_utf16_length(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf16 == NULL | Length | otherwise | mdz_utf16 Reference mdz_utf16_endiannessReturn string endianness.enum mdz_endianness mdz_utf16_endianness(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
MDZ_ENDIAN_ERROR | if pUtf16 == NULL | Endianness | otherwise | mdz_utf16 Reference mdz_utf16_offsetFromStartReturn string OffsetFromStart in UTF-16 characters.size_t mdz_utf16_offsetFromStart(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf16 == NULL | OffsetFromStart | otherwise | mdz_utf16 Reference mdz_utf16_isAttachedDataReturn if string data is attached.mdz_bool mdz_utf16_isAttachedData(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
mdz_false | if pUtf16 == NULL | mdz_false | if string data is not attached | mdz_true | if string data is attached | mdz_utf16 Reference mdz_utf16_embedSizeReturn string "embedded part" Size in UTF-16 characters.size_t mdz_utf16_embedSize(const struct mdz_Utf16* pUtf16); Parameter | Description |
---|
pUtf16 | pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf16 == NULL | Result | "embedded part" Size otherwise | mdz_utf16 Reference mdz_utf16_insertUtf16_asyncInsert nCount UTF-16 characters in string. Size grows on nCount . Length grows on symbols count.mdz_bool mdz_utf16_insertUtf16_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const uint16_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertUtf16(pUtf16, nLeftPos, pItems, nCount, enEndianness, 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 | pItems | UTF-16 characters to insert | nCount | number of UTF-16 characters to insert or 0 if pcItems until 0-terminator should be used | enEndianness | endianness of UTF-16 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 == 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 pItems contain invalid UTF-16 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertUtf16_string_asyncInsert UTF-16 string pUtf16Source in string. Size grows on nCount. Length grows on symbols count. This function performs significantly better than mdz_utf16_insertUtf16_async() - because there is no additional validation of inserted string.mdz_bool mdz_utf16_insertUtf16_string_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const struct mdz_Utf16* pUtf16Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertUtf16_string(pUtf16, nLeftPos, pUtf16Source, 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 | pUtf16Source | pointer to UTF-16 string to insert. String is returned by mdz_utf16_create() or mdz_utf16_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 == 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_true | if pUtf16Source == NULL (MDZ_ERROR_SOURCE), or pUtf16Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertAnsi_asyncInsert nCount ASCII/ANSI bytes in string. Characters are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count.mdz_bool mdz_utf16_insertAnsi_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertAnsi(pUtf16, nLeftPos, pcItems, nCount, 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 | pcItems | bytes to insert | nCount | number of bytes to insert or 0 if pcItems until 0-terminator should be used | 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_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertAnsi_string_asyncInsert ASCII/ANSI string pAnsiSource in string. Characters are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count.mdz_bool mdz_utf16_insertAnsi_string_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const struct mdz_Ansi* pAnsiSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertAnsi_string(pUtf16, nLeftPos, pAnsiSource, 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 | pAnsiSource | pointer to ASCII/ANSI string to insert. String is returned by mdz_ansi_create() or mdz_ansi_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_true | if pAnsiSource == NULL (MDZ_ERROR_SOURCE), or pAnsiSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertWchar_asyncInsert nCount "wide"-characters in string. Characters are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count.mdz_bool mdz_utf16_insertWchar_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertWchar(pUtf16, nLeftPos, pwcItems, nCount, 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 | pwcItems | "wide"-characters to insert | nCount | number of "wide"-characters to insert or 0 if pcItems until 0-terminator should be used | 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_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertWchar_string_asyncInsert "wide"-characters string pWcharSource in string. Characters are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count. This function performs significantly better than mdz_utf16_insertWchar_async() - because there is no additional validation of inserted string.mdz_bool mdz_utf16_insertWchar_string_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const struct mdz_Wchar* pWcharSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertWchar_string(pUtf16, nLeftPos, pWcharSource, 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 | pWcharSource | pointer to "wide"-characters string to insert. String is returned by mdz_wchar_create() or mdz_wchar_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_true | if pWcharSource == NULL (MDZ_ERROR_SOURCE), or pWcharSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertUtf8_asyncInsert nCount UTF-8 bytes 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.mdz_bool mdz_utf16_insertUtf8_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertUtf8(pUtf16, nLeftPos, pcItems, nCount, 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 | pcItems | UTF-8 characters to insert | nCount | number of UTF-8 characters to insert in bytes or 0 if pcItems until 0-terminator should be used | 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 pcItems contain invalid UTF-8 byte(s) (MDZ_ERROR_CONTENT) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertUtf8_string_asyncInsert 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.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_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 Reference mdz_utf16_insertUtf32_asyncInsert nCount UTF-32 characters in string. UTF-32 characters are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count.mdz_bool mdz_utf16_insertUtf32_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const uint32_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertUtf32(pUtf16, nLeftPos, pItems, nCount, enEndianness, 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 | pItems | UTF-32 characters to insert | nCount | number of UTF-32 characters to insert or 0 if pcItems until 0-terminator should be used | enEndianness | endianness of UTF-32 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pItems contain invalid UTF-8 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference mdz_utf16_insertUtf32_string_asyncInsert UTF-32 string pUtf32Source in string. UTF-32 characters are converted to UTF-16 characters before isertion. Size grows on added UTF-16 characters count. Length grows on added symbols count.mdz_bool mdz_utf16_insertUtf32_string_async(struct mdz_Utf16* pUtf16, size_t nLeftPos, const struct mdz_Utf32* pUtf32Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf16_insertUtf32_string(pUtf16, nLeftPos, pUtf32Source, 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 | pUtf32Source | pointer to UTF-32 string to insert. String is returned by mdz_utf32_create() or mdz_utf32_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_true | if pUtf32Source == NULL (MDZ_ERROR_SOURCE), or pUtf32Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf16 Reference
mdz_utf32 is dynamically-sized contiguous string, containing UTF-32 characters.
Capacity - how many UTF-32 characters memory is reserved for.
Size - how many UTF-32 characters are actually used in a string, excluding terminating 0.
Length - actual length of string in symbols, excluding terminating 0.
"reserve/AndReserve" functions allocate/reallocate memory dynamically using malloc() /realloc() . "attach" functionality allows attaching contiguous block of memory to string, for using string functions on it.
Unicode "combining characters" are not specially-distinguished and counted as distinct symbols Endianness of bytes in UTF-32 character - is defined by m_enEndianness and set using enEndianness during string-creation in mdz_utf32_create()
mdz_utf32_createCreate empty UTF-32 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.struct mdz_Utf32* mdz_utf32_create(size_t nEmbedSize, enum mdz_endianness enEndianness); Parameter | Description |
---|
nEmbedSize | size of "embedded part" of string. There is no "embedded part" if 0 | enEndianness | endianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG
|
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if memory allocation failed | NULL | if invalid enEndianness
| Result | pointer to string for use in other mdz_utf32 functions | mdz_utf32 Reference mdz_utf32_create_attachedCreate empty UTF-32 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0. Memory for utf32 structure starts at position pStart . Size of internal utf32 structure (it is usually bigger than mdz_Utf32 !) is returned in pSize.struct mdz_Utf32* mdz_utf32_create_attached(const void* pStart, enum mdz_endianness enEndianness, size_t nAreaSizeBytes, size_t* pOutSize); Parameter | Description |
---|
pStart | memory start position of utf32 structure | enEndianness | endianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG
| nAreaSizeBytes | size of available memory from pStart in bytes. Should be large enough for internal utf32 structure | pOutSize | returned actual size of allocated internal utf32 structure in bytes, may be NULL if not needed |
Return | Description |
---|
NULL | if library is not initialized with mdz_string_init() call | NULL | if invalid enEndianness
| NULL | if pStart == NULL or pSize == NULL | NULL | if size in nSize is smaller than size of internal utf32 structure | Result | pointer to string for use in other mdz_utf32 functions. Normally it equals to pStart | mdz_utf32 Reference mdz_utf32_destroyDestroy UTF-32 string including underlying data. After destroying, pointer to string is set to NULL . If utf32 is attached using mdz_utf32_createAttached(), free() will not be called. If utf32 data is attached using mdz_utf32_attachData() , m_pData will not be destroyed.void mdz_utf32_destroy(struct mdz_Utf32** ppUtf32); Parameter | Description |
---|
ppUtf32 | pointer to pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | mdz_utf32 Reference mdz_utf32_clearClear m_pData of UTF-32 string with setting Size in 0.void mdz_utf32_clear(struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() | mdz_utf32 Reference mdz_utf32_attachDataAttach pre-allocated data to UTF-32 string, assigning pData to m_pData . If attached, m_pData will not be destroyed in mdz_utf32_destroy() mdz_bool mdz_utf32_attachData(struct mdz_Utf32* pUtf32, uint32_t* pData, size_t nOffsetFromStart, size_t nCapacity, enum mdz_attach_type enAttachType, enum mdz_endianness enEndianness); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | pData | pointer to pre-allocated data to attach | nOffsetFromStart | position in pre-allocated data to attach from. Can be > 0 | nCapacity | full capacity pre-allocated data in items | enAttachType | type of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed | enEndianness | endianness of UTF-32 characters in pData . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" |
Return | Description |
---|
mdz_false | if pUtf32 == NULL | mdz_false | if test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_false | if pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE), or invalid pData endianness (MDZ_ERROR_ENDIANNESS) | mdz_true | operation succeeded | mdz_utf32 Reference mdz_utf32_reserveReserve nNewCapacity bytes for UTF-32 string. Size and Length do not change.mdz_bool mdz_utf32_reserve(struct mdz_Utf32* pUtf32, size_t nNewCapacity); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nNewCapacity | new capacity in UTF-32 characters to reserve |
Return | Description |
---|
mdz_false | if pUtf32 == NULL | mdz_false | if memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if test-license is used and nNewCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY) | mdz_true | reservation succeeded, or nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY) | mdz_utf32 Reference mdz_utf32_capacityReturn string Capacity in UTF-32 characters.size_t mdz_utf32_capacity(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf32 == NULL | Capacity | otherwise | mdz_utf32 Reference mdz_utf32_sizeReturn string Size in UTF-32 characters.size_t mdz_utf32_size(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf32 == NULL | Size | otherwise | mdz_utf32 Reference mdz_utf32_lengthReturn string length in symbols.size_t mdz_utf32_length(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf32 == NULL | Size | otherwise | mdz_utf32 Reference mdz_utf32_endiannessReturn string endianness.enum mdz_endianness mdz_utf32_endianness(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
MDZ_ENDIAN_ERROR | if pUtf32 == NULL | Endianness | otherwise | mdz_utf32 Reference mdz_utf32_offsetFromStartReturn string OffsetFromStart in UTF-32 characters.size_t mdz_utf32_offsetFromStart(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf32 == NULL | OffsetFromStart | otherwise | mdz_utf32 Reference mdz_utf32_isAttachedDataReturn if string data is attached.mdz_bool mdz_utf32_isAttachedData(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
mdz_false | if pUtf32 == NULL | mdz_false | if string data is not attached | mdz_true | if string data is attached | mdz_utf32 Reference mdz_utf32_embedSizeReturn string "embedded part" Size in UTF-32 characters.size_t mdz_utf32_embedSize(const struct mdz_Utf32* pUtf32); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() |
Return | Description |
---|
SIZE_MAX | if pUtf32 == NULL | Result | "embedded part" Size otherwise | mdz_utf32 Reference mdz_utf32_insertUtf32_asyncInsert nCount UTF-32 characters in string. Size grows on nCount . Length grows on symbols count.mdz_bool mdz_utf32_insertUtf32_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const uint32_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertUtf32(pUtf32, nLeftPos, pItems, nCount, enEndianness, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pItems | UTF-32 characters to insert | nCount | number of UTF-32 characters to insert or 0 if pcItems until 0-terminator should be used | enEndianness | endianness of UTF-32 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pUtf32 == 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertUtf32_string_asyncInsert UTF-32 string pUtf32Source in string. Size grows on nCount. Length grows on symbols count. This function performs significantly better than mdz_utf32_insertUtf32_async() - because there is no additional validation of inserted string.mdz_bool mdz_utf32_insertUtf32_string_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const struct mdz_Utf32* pUtf32Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertUtf32_string(pUtf32, nLeftPos, pUtf32Source, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pUtf32Source | pointer to UTF-32 string to insert. String is returned by mdz_utf32_create() or mdz_utf32_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 pUtf32 == 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_utf32_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 invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pUtf32Source == NULL (MDZ_ERROR_SOURCE), or pUtf32Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertAnsi_asyncInsert nCount ASCII/ANSI bytes in string. Characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on added symbols count.mdz_bool mdz_utf32_insertAnsi_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertAnsi(pUtf32, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pcItems | bytes to insert | nCount | number of bytes to insert or 0 if pcItems until 0-terminator should be used | 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 pUtf32 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertAnsi_string_asyncInsert ASCII/ANSI string pAnsiSource in string. Characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on added symbols count.mdz_bool mdz_utf32_insertAnsi_string_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const struct mdz_Ansi* pAnsiSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertAnsi_string(pUtf32, nLeftPos, pAnsiSource, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pAnsiSource | pointer to ASCII/ANSI string to insert. String is returned by mdz_ansi_create() or mdz_ansi_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 pUtf32 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pAnsiSource == NULL (MDZ_ERROR_SOURCE), or pAnsiSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertWchar_asyncInsert nCount "wide"-characters in string. Characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on added symbols count.mdz_bool mdz_utf32_insertWchar_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertWchar(pUtf32, nLeftPos, pwcItems, nCount, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pwcItems | "wide"-characters to insert | nCount | number of characters to insert in bytes or 0 if pcItems until 0-terminator should be used | 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 pUtf32 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertWchar_string_asyncInsert "wide"-characters string pWcharSource in string. Characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on added symbols count.mdz_bool mdz_utf32_insertWchar_string_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const struct mdz_Wchar* pWcharSource, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertWchar_string(pUtf32, nLeftPos, pWcharSource, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pWcharSource | pointer to "wide"-characters string to insert. String is returned by mdz_wchar_create() or mdz_wchar_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 pUtf32 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pWcharSource == NULL (MDZ_ERROR_SOURCE), or pWcharSource .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertUtf8_asyncInsert nCount UTF-8 characters in string. UTF-8 characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on added symbols count.mdz_bool mdz_utf32_insertUtf8_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertUtf8(pUtf32, nLeftPos, pcItems, nCount, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pcItems | UTF-8 characters to insert | nCount | number of UTF-8 characters to insert in bytes or 0 if pcItems until 0-terminator should be used | 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 pUtf32 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_utf32_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 pcItems contain invalid UTF-8 character(s) (MDZ_ERROR_CONTENT) | mdz_true | if pcItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertUtf8_string_asyncInsert UTF-8 string pUtf8Source in string. UTF-8 characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on added symbols count.mdz_bool mdz_utf32_insertUtf8_string_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const struct mdz_Utf8* pUtf8Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertUtf8_string(pUtf32, nLeftPos, pUtf8Source, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. 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 pUtf32 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf8Source == NULL (MDZ_ERROR_SOURCE), or pUtf8Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertUtf16_asyncInsert nCount UTF-16 characters in string. Characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on symbols count.mdz_bool mdz_utf32_insertUtf16_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const uint16_t* pItems, size_t nCount, enum mdz_endianness enEndianness, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertUtf16(pUtf32, nLeftPos, pItems, nCount, enEndianness, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pItems | UTF-16 items to insert | nCount | number of UTF-16 items to insert or 0 if pcItems until 0-terminator should be used | enEndianness | endianness of UTF-16 characters in pItems . Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian" | 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 pUtf32 == 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_utf32_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 pItems contain invalid 2-byte character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS) | mdz_true | if pItems == NULL (MDZ_ERROR_ITEMS), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference mdz_utf32_insertUtf16_string_asyncInsert UTF-16 string pUtf16Source in string. Characters are converted to UTF-32 characters before isertion. Size grows on added UTF-32 characters count. Length grows on symbols count.mdz_bool mdz_utf32_insertUtf16_string_async(struct mdz_Utf32* pUtf32, size_t nLeftPos, const struct mdz_Utf16* pUtf16Source, mdz_bool bReserve, struct mdz_asyncData* pAsyncData); Synchronous version:
mdz_utf32_insertUtf16_string(pUtf32, nLeftPos, pUtf16Source, bReserve); Parameter | Description |
---|
pUtf32 | pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached() | nLeftPos | 0-based position to insert in symbols. If nLeftPos == Length or -1, items are appended. nLeftPos > Length is not allowed | pUtf16Source | pointer to UTF-16 string to insert. String is returned by mdz_utf16_create() or mdz_utf16_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 pUtf32 == 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_utf32_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY) | mdz_true | if pUtf16Source == NULL (MDZ_ERROR_SOURCE), or pUtf16Source .Size == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made | mdz_true | insertion succeeded | mdz_utf32 Reference |