maxdz Software GmbH

Eng | Ger
Home

Unser Team

Kundenprojekte

B2B Produktekeyboard_arrow_down

mdz_containerskeyboard_arrow_down

Products

Downloads

Reference

Purchase

B2C Produkte

Gesetzliches

Kontakte

mdz_containers API Reference is generated by mdzApiRefGenerator.

mdz_containers API Reference

mdz_vector Reference
mdz_ascii Reference
mdz_wchar Reference
mdz_utf8 Reference
mdz_utf16 Reference
mdz_utf32 Reference


Asynchronous execution

Many functions of mdz_containers accept parameters for asynchronous execution.
For now (mdz_containers ver. 1.0.0) only mdz_ascii_insert and mdz_ascii_find support asynchronous execution as an examples.

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:

TypeParameterDescription
void* m_pContainerPointer to container instance
mdz_bool m_bFinishedmdz_true if the call is completely finished. Otherwise mdz_false (if interrupted/cancelled)
size_t m_nResultResult of call. Invalid if call is not completely finished (m_bFinished is mdz_false)
void* m_pDataAdditional data returned by call (if any). Invalid if call is not completely finished (m_bFinished is mdz_false)
mdz_bool m_bCancelShould be set by client in mdz_true during call execution, to cancel the call. Otherwise mdz_false
pthread_t / HANDLE m_hThreadHandle to thread on which the call is executed. May be used by client for wait operations


mdz_containers Reference

mdz_containers initialization functions.

mdz_containers_init

Initializes containers library. This function should be caled before any other function of the library.

mdz_bool mdz_containers_init(const char* pcFirstNameHash, const char* pcLastNameHash, const char* pcEmailHash, const char* pcLicenseHash);

ParameterDescription
pcFirstNameHashuser first name hash code
pcLastNameHashuser last name hash code
pcEmailHashuser e-mail hash code
pcLicenseHashlicense hash code

mdz_containers Reference
mdz_containers API Reference


mdz_vector Reference

mdz_vector is dynamically-sized contiguous container.

Capacity - how many items memory is reserved for.
Size - how many items are actually residing in a vector.

"reserve/AndReserve" functions allocate/reallocate memory dynamically using malloc()/realloc().
"attach" functionality allows attaching contiguous block of memory to vector, for using vector functions on it.

Init and destroy functions:

mdz_vector_create
mdz_vector_create_attached
mdz_vector_destroy
mdz_vector_clear
mdz_vector_attachData

Reserve capacity functions:

mdz_vector_reserve
mdz_vector_reserveAndInit
mdz_vector_capacity
mdz_vector_size
mdz_vector_resize
mdz_vector_offsetFromStart

Insert/remove functions:

mdz_vector_insert
mdz_vector_removeFrom
mdz_vector_remove
mdz_vector_trimLeft
mdz_vector_trimRight
mdz_vector_trim

Find functions:

mdz_vector_find
mdz_vector_firstOf
mdz_vector_firstNotOf
mdz_vector_rfind
mdz_vector_lastOf
mdz_vector_lastNotOf

Miscellaneous functions:

mdz_vector_compare
mdz_vector_replace
mdz_vector_count
mdz_vector_copySubVector
mdz_vector_copySubVectorFrom


mdz_vector_create

Create empty vector with Capacity and Size 0. Memory for vector structure is allocated using malloc().

struct mdz_Vector* mdz_vector_create(size_t nTypeSize);

ParameterDescription
nTypeSizesizeof of type used in vector. Allowed nTypeSize are 1, 2, 4 or 8

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif not allowed nTypeSize is used
NULLif memory allocation failed
if succeededpointer to vector for use in other mdz_vector functions

mdz_vector Reference
mdz_containers API Reference

mdz_vector_create_attached

Create empty vector with Capacity and Size 0. Memory for vector structure starts at position pStart. Size in bytes of internal vector structure (it is usually bigger than mdz_Vector!) is returned in pSize.

struct mdz_Vector* mdz_vector_create_attached(size_t nTypeSize, const void* pStart, size_t* pSize);

ParameterDescription
nTypeSizesizeof of type used in vector. Allowed nTypeSize are 1, 2, 4 or 8
pStartmemory start position of vector structure
pSizeinitially should contain size of available memory from pStart. After vector creation - contains actual size of internal vector structure

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif not allowed nTypeSize is used
NULLif pStart == NULL or pSize == NULL
NULLif size in pSize is smaller than size of internal vector structure
if succeededpointer to vector for use in other mdz_vector functions. Normally it equals to pStart

mdz_vector Reference
mdz_containers API Reference

mdz_vector_destroy

Destroy vector including underlying data using free(). After destroying, pointer to vector is set to NULL.
If vector is attached using mdz_vector_create_attached(), free() will not be called.
If vector data is attached using mdz_vector_attachData(), m_pData will not be destroyed.

void mdz_vector_destroy(struct mdz_Vector** ppVector);

ParameterDescription
ppVectorpointer to pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()

mdz_vector Reference
mdz_containers API Reference

mdz_vector_clear

Clear m_pData of vector with setting Size in 0.

void mdz_vector_clear(struct mdz_Vector* pVector);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create()

mdz_vector Reference
mdz_containers API Reference

mdz_vector_attachData

Attach pre-allocated data to vector, assigning pData to m_pData. If attached, m_pData will not be destroyed in mdz_vector_destroy()

mdz_bool mdz_vector_attachData(struct mdz_Vector* pVector, void* pData, size_t nOffsetFromStart, size_t nCapacity, enum mdz_attach_type enAttachType);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
pDatapointer to pre-allocated data to attach
nOffsetFromStartposition in pre-allocated data to attach from. Can be > 0
nCapacityfull capacity pre-allocated data in items
enAttachTypetype of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_NO_TERMINATOR are allowed

ReturnDescription
mdz_falseif pVector == NULL
mdz_falseif pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE)
mdz_trueoperation succeeded

mdz_vector Reference
mdz_containers API Reference

mdz_vector_reserve

Reserve nNewCapacity items for vector. Vector Size does not change. Reservation is not made if m_pData is attached using mdz_vector_attachData()

mdz_bool mdz_vector_reserve(struct mdz_Vector* pVector, size_t nNewCapacity);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nNewCapacitynew capacity in items to reserve

ReturnDescription
mdz_falseif pVector == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif m_pData is attached using mdz_vector_attachData() (MDZ_ERROR_ATTACHED)
mdz_true reservation succeeded, or nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY)

mdz_vector Reference
mdz_containers API Reference

mdz_vector_reserveAndInit

Reserve nNewCapacity items for vector and initializes all items in pItem. May be called only on empty vectors (with Size == 0). After call, vector Size equals to Capacity.
Reservation is not made if m_pData is attached using mdz_vector_attachData()

mdz_bool mdz_vector_reserveAndInit(struct mdz_Vector* pVector, size_t nNewCapacity, const void* pItem);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nNewCapacitycapacity to reserve in items
pItemitem for vector initialization. If NULL, 0 will be used for initialization

ReturnDescription
mdz_falseif pVector == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif Size > 0 (MDZ_ERROR_NONEMPTY)
mdz_falseif m_pData is attached using mdz_vector_attachData() (MDZ_ERROR_ATTACHED)
mdz_truereservation and initialization succeeded, or nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY)

mdz_vector Reference
mdz_containers API Reference

mdz_vector_capacity

Return vector Capacity.

size_t mdz_vector_capacity(struct mdz_Vector* pVector);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()

ReturnDescription
SIZE_MAXif pVector == NULL
Capacity in itemsotherwise

mdz_vector Reference
mdz_containers API Reference

mdz_vector_size

Return vector Size.

size_t mdz_vector_size(struct mdz_Vector* pVector);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()

ReturnDescription
SIZE_MAXif pVector == NULL
Size in itemsotherwise

mdz_vector Reference
mdz_containers API Reference

mdz_vector_resize

Set vector Size. Size must be <= Capacity.

mdz_bool mdz_vector_resize(struct mdz_Vector* pVector, size_t nNewSize);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nNewSizenew Size to set vector in

ReturnDescription
mdz_falseif pVector == NULL
mdz_falseif nNewSize > Capacity (MDZ_ERROR_CAPACITY). Vector Size is not changed
mdz_trueif succeeded

mdz_vector Reference
mdz_containers API Reference

mdz_vector_offsetFromStart

Return vector OffsetFromStart.

size_t mdz_vector_offsetFromStart(struct mdz_Vector* pVector);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()

ReturnDescription
SIZE_MAXif pVector == NULL
OffsetFromStart in itemsotherwise

mdz_vector Reference
mdz_containers API Reference

mdz_vector_insert

Insert nCount items in vector. Capacity should contain enough free space for nCount items. Vector m_pData and pItems cannot overlap. Size grows on nCount.

mdz_bool mdz_vector_insert_generic(struct mdz_Vector* pVector, size_t nLeftPos, const void* pItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based position to insert. If nLeftPos == Size, items are appended. nLeftPos > Size is not allowed
pItemsitems to insert. If NULL, 0 will be used for insertion nCount times
nCountnumber of items to insert
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif bReserve == mdz_true and there is not enough capacity for inserted data but m_pData is attached using mdz_ascii_attach() (MDZ_ERROR_ATTACHED)
mdz_falseif bReserve == mdz_false and there is not enough free Capacity in the vector (MDZ_ERROR_CAPACITY)
mdz_trueif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Size (MDZ_ERROR_BIGLEFT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_vector_insert_generic():
mdz_vector_insert(pVector, nLeftPos, pItems, nCount);

Synchronous execution of mdz_vector_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_vector_insertAndReserve(pVector, nLeftPos, pItems, nCount);

Asynchronous execution of mdz_vector_insert_generic(). Not yet implemented:
mdz_vector_insert_async(pVector, nLeftPos, pItems, nCount, pAsyncData);

Asynchronous execution of mdz_vector_insert_generic(), with reservation if there is not enough capacity for insertion. Not yet implemented:
mdz_vector_insertAndReserve_async(pVector, nLeftPos, pItems, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_find

Find first occurrence of pItems in vector. Returns 0-based position of match (if found), or vector Size if not found, or SIZE_MAX if error.

size_t mdz_vector_find_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of vector
nRightPos0-based end position to search up to. Use Size-1 to search till the end of vector
pItemspointer to items to find. If NULL, value type of NULL (normally 0) nCount times, will be used for search
nCountnumber of items to find
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nLeftPos + nCount > nRightPos (MDZ_ERROR_BIGCOUNT). No search is made
Size of vectorif item(s) not found
0based position - position of first match

Synchronous execution of mdz_vector_find_generic():
mdz_vector_find(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_find_generic(). Not yet implemented:
mdz_vector_find_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_firstOf

Find first occurrence of any item of pItems in vector. Returns 0-based position of match (if found), or vector Size if not found, or SIZE_MAX if error.

size_t mdz_vector_firstOf_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of vector
nRightPos0-based end position to search up to. Use Size-1 to serch till the end of vector
pItemspointer to items to find. If NULL, 0 will be used for search
nCountnumber of items to find. 1 if pItems == NULL
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of vectorif item(s) not found
0based position - position of first match

Synchronous execution of mdz_vector_firstOf_generic():
mdz_vector_firstOf(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_firstOf_generic(). Not yet implemented:
mdz_vector_firstOf_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_firstNotOf

Find first non-occurrence of any item of pItems in vector. Returns 0-based position of match (if found), or vector Size if not found, or SIZE_MAX if error.

size_t mdz_vector_firstNotOf_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of vector
nRightPos0-based end position to search up to. Use Size-1 to serch till the end of vector
pItemspointer to items to check. If NULL, 0 will be used for search
nCountnumber of items to check. 1 if pItems == NULL
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of vectorif non-occurence is not found
0based position - position of first non-occurence

Synchronous execution of mdz_vector_firstNotOf_generic():
mdz_vector_firstNotOf(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_firstNotOf_generic(). Not yet implemented:
mdz_vector_firstNotOf_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_rfind

Find last occurrence of pItems in vector. Returns 0-based position of match (if found), or vector Size if not found, or SIZE_MAX if error.

size_t mdz_vector_rfind_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of vector
nRightPos0-based start position to find from right. Use Size-1 to serch from the end of vector
pItemspointer to items to find. If NULL, value type of NULL (normally 0) nCount times, will be used for search
nCountnumber of items to find
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGCOUNT). No search is made
Size of vectorif item(s) not found
0based position - position of first match

Synchronous execution of mdz_vector_rfind_generic():
mdz_vector_rfind(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_rfind_generic(). Not yet implemented:
mdz_vector_rfind_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_lastOf

Find last occurrence of any item of pItems in vector. Returns 0-based position of match (if found), or vector Size if not found, or SIZE_MAX if error.

size_t mdz_vector_lastOf_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based end position to search up to. Use 0 to search till the beginning of vector
nRightPos0-based start position to search from right. Use Size-1 to serch from the end of vector
pItemspointer to items to find. If NULL, value type of NULL (normally 0) will be used for search
nCountnumber of items to find
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of vectorif item(s) not found
0based position - position of first match

Synchronous execution of mdz_vector_lastOf_generic():
mdz_vector_lastOf(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_lastOf_generic(). Not yet implemented:
mdz_vector_lastOf_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_lastNotOf

Find last non-occurrence of any item of pItems in vector. Returns 0-based position of match (if found), or vector Size if not found, or SIZE_MAX if error.

size_t mdz_vector_lastNotOf_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based end position to search up to. Use 0 to search till the beginning of vector
nRightPos0-based start position to search from right. Use Size-1 to serch from the end of vector
pItemspointer to items to find. If NULL, value type of NULL (normally 0) will be used for search
nCountnumber of items to find
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of vectorif non-occurence is not found
0based position - position of first match

Synchronous execution of mdz_vector_lastNotOf_generic():
mdz_vector_lastNotOf(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_lastNotOf_generic(). Not yet implemented:
mdz_vector_lastNotOf_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_removeFrom

Remove nCount item(s) starting from 0-based nLeftPos position. After the operation, Capacity doesn't change, Size decreases on nCount.

mdz_bool mdz_vector_removeFrom_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to remove item(s) from. Use 0 to remove from the beginning of vector
nCountnumber of item(s) to remove. Assure that nLeftPos + nCount - 1 < Size - otherwise no removes will be made
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_trueif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_vector_removeFrom_generic():
mdz_vector_removeFrom(pVector, nLeftPos, nCount);

Asynchronous execution of mdz_vector_removeFrom_generic(). Not yet implemented:
mdz_vector_removeFrom_async(pVector, nLeftPos, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_remove

Remove all ocurrences of nCount item(s) matching to pItems, residing between nLeftPos and nRightPos. Vector m_pData and pItems cannot overlap. After remove(s) Capacity doesn't change, Size decreases on nCount of removed items.

mdz_bool mdz_vector_remove_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to remove item(s) from. Use 0 to search from the beginning of vector
nRightPos0-based end position to remove item(s) up to. Use Size-1 to serch till the end of vector
pItemspointer to items to remove. If NULL, value type of NULL (normally 0) nCount times, will be used for search
nCountnumber of item(s) to remove
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_trueif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_vector_remove_generic():
mdz_vector_remove(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_remove_generic(). Not yet implemented:
mdz_vector_remove_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_trimLeft

Remove items which are contained in pItems from left, until first non-contained in pItems item is reached. Vector m_pData and pItems cannot overlap.

mdz_bool mdz_vector_trimLeft_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to trim item(s) from left. Use 0 to trim from the beginning of vector
nRightPos0-based end position to trim item(s) up to. Use Size-1 to trim till the end of vector
pItemspointer to items to remove. If NULL, value type of NULL (normally 0) will be used
nCountnumber of items to remove. If pItems is NULL, nCount is set to 1
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_trueif vector is empty (MDZ_ERROR_EMPTY), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No trims are made
mdz_trueoperation succeeded

Synchronous execution of mdz_vector_trimLeft_generic():
mdz_vector_trimLeft(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_trimLeft_generic(). Not yet implemented:
mdz_vector_trimLeft_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_trimRight

Remove items which are contained in pItems from right, until first non-contained in pItems item is reached. Vector m_pData and pItems cannot overlap.

mdz_bool mdz_vector_trimRight_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based end position to trim item(s) up to. Use 0 to trim till the beginning of vector
nRightPos0-based start position to trim item(s) from right. Use Size-1 to trim from the end of vector
pItemspointer to items to remove. If NULL, value type of NULL (normally 0) will be used
nCountnumber of items to remove. If pItems is NULL, nCount is set to 1
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_trueif vector is empty (MDZ_ERROR_EMPTY), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_vector_trimRight_generic():
mdz_vector_trimRight(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_trimRight_generic(). Not yet implemented:
mdz_vector_trimRight_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_trim

Remove items which are contained in pItems from left and from right, until first non-contained in pItems item is reached. Vector m_pData and pItems cannot overlap.

mdz_bool mdz_vector_trim_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to trim item(s) from left. Use 0 to trim from the beginning of vector
nRightPos0-based start position to trim item(s) from right. Use Size-1 to trim from the end of vector
pItemspointer to items to remove. If NULL, value type of NULL (normally 0) will be used
nCountnumber of items to remove. If pItems is NULL, nCount is set to 1
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_trueif vector is empty (MDZ_ERROR_EMPTY), or nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_vector_trim_generic():
mdz_vector_trim(pVector, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_vector_trim_generic(). Not yet implemented:
mdz_vector_trim_async(pVector, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_compare

Compare content of vector with pItems.

enum mdz_compare_result mdz_vector_compare_generic(struct mdz_Vector* pVector, size_t nLeftPos, const void* pItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to compare from. Use 0 to compare from the beginning of vector
pItemspointer to items to compare. If NULL, value type of NULL (normally 0) nCount times, will be used for comparison
nCountnumber of items to compare
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
MDZ_COMPARE_ERRORif pVector == NULL
MDZ_COMPARE_NONEQUALif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No comparison is made
MDZ_COMPARE_EQUAL or MDZ_COMPARE_NONEQUALResult of comparison

Synchronous execution of mdz_vector_compare_generic():
mdz_vector_compare(pVector, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_vector_compare_generic(). Not yet implemented:
mdz_vector_compare_async(pVector, nLeftPos, pcItems, nCount, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_replace

Replace every occurence of pItemsBefore with pItemsAfter. There should be enough Capacity for replacing data. Vector m_pData and pItemsBefore/pItemsAfter cannot overlap.

mdz_bool mdz_vector_replace_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItemsBefore, size_t nCountBefore, const void* pItemsAfter, size_t nCountAfter, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to search for replace from. Use 0 to search from the beginning of vector
nRightPos0-based end position to search for replace up to. Use Size-1 to seach till the end of vector
pItemsBeforepointer to items to replace. If NULL, value type of NULL (normally 0) nCountBefore times, will be searched
nCountBeforenumber of items to replace
pItemsAfterpointer to items to replace with. If NULL, value type of NULL (normally 0) nCountAfter times, will be used to replace
nCountAfternumber of items to replace with
bReserveif mdz_true reserve capacity when there is not enough space for replacement, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pVector == NULL
mdz_falseif there is not enough capacity to insert replacing data (MDZ_ERROR_CAPACITY)
mdz_trueif nCountBefore == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCountBefore is too big (MDZ_ERROR_BIGCOUNT). No replacements is made
mdz_trueoperation succeeded

Synchronous execution of mdz_vector_replace_generic():
mdz_vector_replace(pVector, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter);

Synchronous execution of mdz_vector_replace_generic(), with reservation if there is not enough capacity for insertion:
mdz_vector_replaceAndReserve(pVector, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter);

Asynchronous execution of mdz_vector_replace_generic(). Not yet implemented:
mdz_vector_replace_async(pVector, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter, pAsyncData);

Asynchronous execution of mdz_vector_replace_generic(). Not yet implemented:
mdz_vector_replaceAndReserve_async(pVector, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_count

Counts number of pItems subvector occurences in vector.

size_t mdz_vector_count_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, mdz_bool bAllowOverlapped, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to count from. Use 0 to count from the beginning of vector
nRightPos0-based end position to count up to. Use Size-1 to count till the end of vector
pItemsitems/subvector to count. If NULL, value type of NULL (normally 0) nCount times, will be counted
nCountlength of subvector to count
bAllowOverlappedmdz_true if overlapped subvectors should be counted, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL
0if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No counting is made
0based count - number of subvector occurences. 0 if not found

Synchronous execution of mdz_vector_count_generic():
mdz_vector_count(pVector, nLeftPos, nRightPos, pcItems, nCount, bAllowOverlapped);

Asynchronous execution of mdz_vector_count_generic(). Not yet implemented:
mdz_vector_count_async(pVector, nLeftPos, nRightPos, pcItems, nCount, bAllowOverlapped, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_copySubVector

Fills pSubVector with items, starting from nLeftPos and ending with one of pSeparators or nRightPos.

size_t mdz_vector_copySubVector_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pSeparators, size_t nSeparatorsCount, struct mdz_Vector* pSubVector, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to get items from. Use 0 to start from the beginning of vector
nRightPos0-based end position to get items up to. Use Size-1 to proceed till the end of vector
pSeparatorsseparators to get items up to. If NULL, value type of NULL (normally 0) will be used
nSeparatorsCountnumber of separators
pSubVectorpointer to vector where items should be copied. Data in pSubVector will be re-reserved to appropriate size if necessary
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL, or pSubVector == NULL (MDZ_ERROR_SUBCONTAINER), or reallocation of m_pData in pSubVector was necessary but failed (MDZ_ERROR_ALLOCATION)
Size of vectorif nSeparatorsCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No copying is made
operation succeeded0-based position after separator if found, or Size if not found

Synchronous execution of mdz_vector_copySubVector_generic():
mdz_vector_copySubVector(pVector, nLeftPos, nRightPos, pcSeparators, nSeparatorsCount, pSubVector);

Asynchronous execution of mdz_vector_copySubVector_generic(). Not yet implemented:
mdz_vector_copySubVector_async(pVector, nLeftPos, nRightPos, pcSeparators, nSeparatorsCount, pSubVector, pAsyncData);

mdz_vector Reference
mdz_containers API Reference

mdz_vector_copySubVectorFrom

Fills pSubVector with items, starting from nLeftPos and containing nCount items.

size_t mdz_vector_copySubVectorFrom_generic(struct mdz_Vector* pVector, size_t nLeftPos, size_t nCount, struct mdz_Vector* pSubVector, struct mdz_asyncData* pAsyncData);

ParameterDescription
pVectorpointer to vector returned by mdz_vector_create() or mdz_vector_create_attached()
nLeftPos0-based start position to get items from. Use 0 to start from the beginning of vector
nCountnumber of items to copy
pSubVectorpointer to vector where items should be copied. Data in pSubVector will be re-reserved to appropriate size if necessary
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pVector == NULL, or pSubVector == NULL (MDZ_ERROR_SUBCONTAINER), or reallocation of m_pData in pSubVector was necessary but failed (MDZ_ERROR_ALLOCATION)
Size of vectorif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No copying is made
operation succeeded0-based position after copied data

Synchronous execution of mdz_vector_copySubVectorFrom_generic():
mdz_vector_copySubVectorFrom(pVector, nLeftPos, nCount, pSubVector);

Asynchronous execution of mdz_vector_copySubVectorFrom_generic(). Not yet implemented:
mdz_vector_copySubVectorFrom_async(pVector, nLeftPos, nCount, pSubVector, pAsyncData);

mdz_vector Reference
mdz_containers API Reference


mdz_ascii Reference

mdz_ascii is dynamically-sized contiguous string, containing ASCII characters.

Capacity - how many bytes of memory is reserved.
Size - how many characters are actually residing in a string, excluding terminating 0.

"reserve" functions allocate/reallocate memory dynamically using malloc()/realloc().
"attach" functionality allows attaching contiguous block of memory to string, for using string functions on it.

Init and destroy functions:

mdz_ascii_create
mdz_ascii_create_attached
mdz_ascii_destroy
mdz_ascii_clear
mdz_ascii_attachData

Reserve capacity functions:

mdz_ascii_reserve
mdz_ascii_reserveAndInit
mdz_ascii_capacity
mdz_ascii_size
mdz_ascii_resize
mdz_ascii_offsetFromStart

Insert/remove functions:

mdz_ascii_insert
mdz_ascii_removeFrom
mdz_ascii_remove
mdz_ascii_trimLeft
mdz_ascii_trimRight
mdz_ascii_trim

Find functions:

mdz_ascii_find
mdz_ascii_firstOf
mdz_ascii_firstNotOf
mdz_ascii_rfind
mdz_ascii_lastOf
mdz_ascii_lastNotOf

Miscellaneous functions:

mdz_ascii_compare
mdz_ascii_replace
mdz_ascii_count
mdz_ascii_copySubAscii
mdz_ascii_copySubAsciiFrom


mdz_ascii_create

Create empty string with Capacity and Size 0.

struct mdz_Ascii* mdz_ascii_create(void);

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif memory allocation failed
if succeededpointer to string for use in other mdz_ascii functions

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_create_attached

Create empty string with Capacity and Size 0. Memory for ascii structure starts at position pStart. Size of internal ascii structure (it is usually bigger than mdz_Ascii!) is returned in pSize.

struct mdz_Ascii* mdz_ascii_create_attached(const void* pStart, size_t* pSize);

ParameterDescription
pStartmemory start position of ascii structure
pSizeinitially should contain size of available memory from pStart. After ascii creation - contains actual size of internal ascii structure

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif pStart == NULL or pSize == NULL
NULLif size in pSize is smaller than size of internal ascii structure
if succeededpointer to string for use in other mdz_ascii functions. Normally it equals to pStart

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_destroy

Destroy string including underlying data. After destroying, pointer to string is set to NULL.
If string is attached using mdz_ascii_createAttached(), free() will not be called.
If string data is attached using mdz_ascii_attachData(), m_pData will not be destroyed.

void mdz_ascii_destroy(struct mdz_Ascii** ppAscii);

ParameterDescription
ppAsciipointer to pointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_clear

Clear m_pData of string with setting Size in 0.

void mdz_ascii_clear(struct mdz_Ascii* pAscii);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create()

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_attachData

Attach pre-allocated data to string, assigning pcData to m_pData. If attached, m_pData will not be destroyed in mdz_ascii_destroy()

mdz_bool mdz_ascii_attachData(struct mdz_Ascii* pAscii, char* pData, size_t nOffsetFromStart, size_t nCapacity, enum mdz_attach_type enAttachType);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
pDatapointer to pre-allocated data to attach
nOffsetFromStartposition in pre-allocated data to attach from. Can be > 0
nCapacityfull capacity pre-allocated data in items
enAttachTypetype of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed

ReturnDescription
mdz_falseif pAscii == NULL
mdz_falseif pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE)
mdz_trueoperation succeeded

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_reserve

Reserve nNewCapacity items for string. String Size does not change. Reservation is not made if m_pData is attached using mdz_ascii_attachData()

mdz_bool mdz_ascii_reserve(struct mdz_Ascii* pAscii, size_t nNewCapacity);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nNewCapacitynew capacity in items to reserve

ReturnDescription
mdz_falseif pAscii == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif m_pData is attached using mdz_ascii_attachData() (MDZ_ERROR_ATTACHED)
mdz_true reservation succeeded

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_reserveAndInit

Reserve nNewCapacity items for string and initializes all items in cItem. May be called only on empty string (with Size == 0). After call, string Size equals to Capacity.
Reservation is not made if m_pData is attached using mdz_ascii_attachData()

mdz_bool mdz_ascii_reserveAndInit(struct mdz_Ascii* pAscii, size_t nNewCapacity, char cItem);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nNewCapacitycapacity to reserve in items
cItemitem for string initialization

ReturnDescription
mdz_falseif pAscii == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif Size > 0 (MDZ_ERROR_NONEMPTY)
mdz_falseif m_pData is attached using mdz_ascii_attachData() (MDZ_ERROR_ATTACHED)
mdz_truereservation and initialization succeeded

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_capacity

Return string Capacity.

size_t mdz_ascii_capacity(struct mdz_Ascii* pAscii);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()

ReturnDescription
SIZE_MAXif pAscii == NULL
Capacity in itemsotherwise

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_size

Return string Size.

size_t mdz_ascii_size(struct mdz_Ascii* pAscii);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()

ReturnDescription
SIZE_MAXif pAscii == NULL
Size in itemsotherwise

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_resize

Set string Size. Size must be < Capacity (because of terminating 0)

mdz_bool mdz_ascii_resize(struct mdz_Ascii* pAscii, size_t nNewSize);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nNewSizenew Size to set string in

ReturnDescription
mdz_falseif pAscii == NULL
mdz_falseif nNewSize >= Capacity (MDZ_ERROR_CAPACITY). String Size is not changed
mdz_trueif succeeded

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_offsetFromStart

Return string OffsetFromStart.

size_t mdz_ascii_offsetFromStart(struct mdz_Ascii* pAscii);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()

ReturnDescription
SIZE_MAXif pAscii == NULL
OffsetFromStart in itemsotherwise

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_insert

Insert nCount items in string. Capacity should contain enough free space for nCount items. Size grows on nCount.

mdz_bool mdz_ascii_insert_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, const char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based position to insert. If nLeftPos == Size, items are appended. nLeftPos > Size is not allowed
pcItemsitems to insert
nCountnumber of items to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pAscii == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif bReserve == mdz_true and there is not enough capacity for inserted data, but m_pData is attached using mdz_ascii_attachData() (MDZ_ERROR_ATTACHED)
mdz_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif nLeftPos > Size (MDZ_ERROR_BIGLEFT), or pcItems == NULL (MDZ_ERROR_ITEMS), or nCount is too big (MDZ_ERROR_BIGCOUNT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_ascii_insert_generic():
mdz_ascii_insert(pAscii, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_ascii_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_ascii_insertAndReserve(pAscii, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_insert_generic():
mdz_ascii_insert_async(pAscii, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_ascii_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_ascii_insertAndReserve_async(pAscii, nLeftPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_find

Find first occurrence of pcItems in string. Returns 0-based position of match (if found), or string Size if not found, or SIZE_MAX if error.

size_t mdz_ascii_find_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos0-based end position to search up to. Use Size-1 to search till the end of string
pcItemspointer to items to find
nCountnumber of items to find. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
Size of stringif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No search is made
Size of stringif item(s) not found
0based position - position of first match

Synchronous execution of mdz_ascii_find_generic():
mdz_ascii_find(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_find_generic():
mdz_ascii_find_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_firstOf

Find first occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or string Size if not found, or SIZE_MAX if error.

size_t mdz_ascii_firstOf_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos0-based end position to search up to. Use Size-1 to serch till the end of string
pcItemspointer to items to find
nCountnumber of items to find. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
Size of stringif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of stringif item(s) not found
0based position - position of first match

Synchronous execution of mdz_ascii_firstOf_generic():
mdz_ascii_firstOf(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_firstOf_generic() using thread-pool. Not yet implemented:
mdz_ascii_firstOf_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_firstNotOf

Find first non-occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or string Size if not found, or SIZE_MAX if error.

size_t mdz_ascii_firstNotOf_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos0-based end position to search up to. Use Size-1 to serch till the end of string
pcItemspointer to items to find
nCountnumber of items to find. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
Size of stringif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of stringif non-occurence is not found
0based position - position of first match

Synchronous execution of mdz_ascii_firstNotOf_generic():
mdz_ascii_firstNotOf(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_firstNotOf_generic() using thread-pool. Not yet implemented:
mdz_ascii_firstNotOf_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_rfind

Find last occurrence of pcItems in string. Returns 0-based position of match (if found), or string Size if not found, or SIZE_MAX if error.

size_t mdz_ascii_rfind_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to serch from the end of string
pcItemspointer to items to find
nCountnumber of items to find. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
Size of stringif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No search is made
Size of stringif item(s) not found
0based position - position of first match

Synchronous execution of mdz_ascii_rfind_generic():
mdz_ascii_rfind(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_rfind_generic() using thread-pool. Not yet implemented:
mdz_ascii_rfind_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_lastOf

Find last occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or string Size if not found, or SIZE_MAX if error.

size_t mdz_ascii_lastOf_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based end position to search up to. Use 0 to search till the beginning of string
nRightPos0-based start position to search from right. Use Size-1 to serch from the end of string
pcItemspointer to items to find
nCountnumber of items to find. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
Size of stringif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of stringif item(s) not found
0based position - position of first match

Synchronous execution of mdz_ascii_lastOf_generic():
mdz_ascii_lastOf(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_lastOf_generic() using thread-pool. Not yet implemented:
mdz_ascii_lastOf_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_lastNotOf

Find last non-occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or string Size if not found, or SIZE_MAX if error.

size_t mdz_ascii_lastNotOf_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based end position to search up to. Use 0 to search till the beginning of string
nRightPos0-based start position to search from right. Use Size-1 to serch from the end of string
pcItemspointer to items to find
nCountnumber of items to find. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
Size of stringif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made
Size of stringif non-occurence is not found
0based position - position of first match

Synchronous execution of mdz_ascii_lastNotOf_generic():
mdz_ascii_lastNotOf(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_lastNotOf_generic() using thread-pool. Not yet implemented:
mdz_ascii_lastNotOf_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_removeFrom

Remove nCount item(s) starting from 0-based nLeftPos position. After the operation, Capacity doesn't change, Size decreases on nCount.

mdz_bool mdz_ascii_removeFrom_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to remove item(s) from. Use 0 to remove from the beginning of string
nCountnumber of item(s) to remove
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pAscii == NULL
mdz_trueif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_ascii_removeFrom_generic():
mdz_ascii_removeFrom(pAscii, nLeftPos, nCount);

Asynchronous execution of mdz_ascii_removeFrom_generic(). Not yet implemented:
mdz_ascii_removeFrom_async(pAscii, nLeftPos, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_remove

Remove all ocurrences of nCount item(s) matching to pcItems, residing between nLeftPos and nRightPos. After remove(s) Capacity doesn't change, Size decreases on nCount of removed items.

mdz_bool mdz_ascii_remove_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to remove item(s) from. Use 0 to search from the beginning of string
nRightPos0-based end position to remove item(s) up to. Use Size-1 to serch till the end of string
pcItemspointer to items to remove
nCountnumber of item(s) to remove. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pAscii == NULL
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_ascii_remove_generic():
mdz_ascii_remove(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_remove_generic(). Not yet implemented:
mdz_ascii_remove_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_trimLeft

Remove items which are contained in pcItems from left, until first non-contained in pcItems item is reached.

mdz_bool mdz_ascii_trimLeft_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to trim item(s) from left. Use 0 to trim from the beginning of string
nRightPos0-based end position to trim item(s) up to. Use Size-1 to trim till the end of string
pcItemspointer to items to remove
nCountnumber of items to remove. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pAscii == NULL
mdz_trueif string is empty (MDZ_ERROR_EMPTY), or pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No trims are made
mdz_trueoperation succeeded

Synchronous execution of mdz_ascii_trimLeft_generic():
mdz_ascii_trimLeft(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_trimLeft_generic(). Not yet implemented:
mdz_ascii_trimLeft_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_trimRight

Remove items which are contained in pcItems from right, until first non-contained in pcItems item is reached.

mdz_bool mdz_ascii_trimRight_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based end position to trim item(s) up to. Use 0 to trim till the beginning of string
nRightPos0-based start position to trim item(s) from right. Use Size-1 to trim from the end of string
pcItemspointer to items to remove
nCountnumber of items to remove. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pAscii == NULL
mdz_trueif string is empty (MDZ_ERROR_EMPTY), or pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No removes are made
mdz_trueoperation succeeded

Synchronous execution of mdz_ascii_trimRight_generic():
mdz_ascii_trimRight(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_trimRight_generic(). Not yet implemented:
mdz_ascii_trimRight_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_trim

Remove items which are contained in pcItems from left and from right, until first non-contained in pcItems item is reached.

mdz_bool mdz_ascii_trim_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to trim item(s) from left. Use 0 to trim from the beginning of string
nRightPos0-based start position to trim item(s) from right. Use Size-1 to trim from the end of string
pcItemspointer to items to remove
nCountnumber of items to remove. Use 0 if pcItems until 0-terminator should be used
pAsyncData

ReturnDescription
mdz_falseif pAscii == NULL
mdz_trueif string is empty (MDZ_ERROR_EMPTY), or pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No removes are made
mdz_trueoperation succeeded, otherwise mdz_false

Synchronous execution of mdz_ascii_trim_generic():
mdz_ascii_trim(pAscii, nLeftPos, nRightPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_trim_generic(). Not yet implemented:
mdz_ascii_trim_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_compare

Compare content of string with pcItems.

enum mdz_compare_result mdz_ascii_compare_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, const char* pcItems, size_t nCount, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to compare from. Use 0 to compare from the beginning of string
pcItemspointer to items to compare
nCountnumber of items to compare. Use 0 if pcItems until 0-terminator should be used
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
MDZ_COMPARE_ERRORif pAscii == NULL
MDZ_COMPARE_NONEQUALif pcItems == NULL (MDZ_ERROR_ITEMS), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No comparison is made
MDZ_COMPARE_EQUAL or MDZ_COMPARE_NONEQUALResult of comparison

Synchronous execution of mdz_ascii_compare_generic():
mdz_ascii_compare(pAscii, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_ascii_compare_generic(). Not yet implemented:
mdz_ascii_compare_async(pAscii, nLeftPos, pcItems, nCount, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_replace

Replace every occurence of pcItemsBefore with pcItemsAfter. There should be enough Capacity for replacing data.

mdz_bool mdz_ascii_replace_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItemsBefore, size_t nCountBefore, const char* pcItemsAfter, size_t nCountAfter, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to astring returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to search for replace from. Use 0 to search from the beginning of string
nRightPos0-based end position to search for replace up to. Use Size-1 to seach till the end of string
pcItemsBeforepointer to items to replace
nCountBeforenumber of items to replace. Use 0 if pcItemsBefore until 0-terminator should be used
pcItemsAfterpointer to items to replace with
nCountAfternumber of items to replace with
bReserveif mdz_true reserve capacity when there is not enough space for replacement, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pAscii == NULL
mdz_falseif there is not enough capacity to insert replacing data (MDZ_ERROR_CAPACITY)
mdz_trueif pcItemsBefore == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCountBefore is too big (MDZ_ERROR_BIGCOUNT). No replacements are made
mdz_trueoperation succeeded

Synchronous execution of mdz_ascii_replace_generic():
mdz_ascii_replace(pAscii, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter);

Synchronous execution of mdz_ascii_replace_generic(), with reservation if there is not enough capacity for insertion:
mdz_ascii_replaceAndReserve(pAscii, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter);

Asynchronous execution of mdz_ascii_replace_generic(). Not yet implemented:
mdz_ascii_replace_async(pAscii, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter, pAsyncData);

Asynchronous execution of mdz_ascii_replace_generic(), with reservation if there is not enough capacity for insertion. Not yet implemented:
mdz_ascii_replaceAndReserve_async(pAscii, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_count

Counts number of pcItems substring occurences in string.

size_t mdz_ascii_count_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, mdz_bool bAllowOverlapped, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to count from. Use 0 to count from the beginning of string
nRightPos0-based end position to count up to. Use Size-1 to count till the end of string
pcItemsitems/substring to count
nCountSize of substring to count. Use 0 if pcItems until 0-terminator should be used
bAllowOverlappedmdz_true if overlapped substrings should be counted, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL
0if pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No counting is made
0based count - number of substring occurences. 0 if not found

Synchronous execution of mdz_ascii_count_generic():
mdz_ascii_count(pAscii, nLeftPos, nRightPos, pcItems, nCount, bAllowOverlapped);

Asynchronous execution of mdz_ascii_count_generic(). Not yet implemented:
mdz_ascii_count_async(pAscii, nLeftPos, nRightPos, pcItems, nCount, bAllowOverlapped, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_copySubAscii

Fills pSubAscii with items, starting from nLeftPos and ending with one of pSeparators or nRightPos.

size_t mdz_ascii_copySubAscii_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nRightPos, const char* pcSeparators, size_t nSeparatorsCount, struct mdz_Ascii* pSubAscii, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to get items from. Use 0 to start from the beginning of string
nRightPos0-based end position to get items up to. Use Size-1 to proceed till the end of string
pcSeparatorsseparators to get items up to
nSeparatorsCountnumber of separators. Use 0 if pcSeparators until 0-terminator should be used
pSubAsciipointer to string where items should be copied. Data in pSubAscii will be re-reserved to appropriate size if necessary
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL, or pSubAscii == NULL (MDZ_ERROR_SUBCONTAINER), or reallocation of m_pData in pSubAscii was necessary but failed (MDZ_ERROR_ALLOCATION)
Size of stringif pcSeparators == NULL (MDZ_ERROR_ITEMS), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No copying is made
operation succeeded0-based position after separator if found, or Size if not found

Synchronous execution of mdz_ascii_copySubAscii_generic():
mdz_ascii_copySubAscii(pAscii, nLeftPos, nRightPos, pcSeparators, nSeparatorsCount, pSubAscii);

Asynchronous execution of mdz_ascii_copySubAscii_generic(). Not yet implemented:
mdz_ascii_copySubAscii_async(pAscii, nLeftPos, nRightPos, pcSeparators, nSeparatorsCount, pSubAscii, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference

mdz_ascii_copySubAsciiFrom

Fills pSubAscii with items, starting from nLeftPos and containing nCount items.

size_t mdz_ascii_copySubAsciiFrom_generic(struct mdz_Ascii* pAscii, size_t nLeftPos, size_t nCount, struct mdz_Ascii* pSubAscii, struct mdz_asyncData* pAsyncData);

ParameterDescription
pAsciipointer to string returned by mdz_ascii_create() or mdz_ascii_create_attached()
nLeftPos0-based start position to get items from. Use 0 to start from the beginning of string
nCountnumber of items to copy
pSubAsciipointer to string where items should be copied. Data in pSubAscii will be re-reserved to appropriate size if necessary
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
SIZE_MAXif pAscii == NULL, or pSubAscii == NULL (MDZ_ERROR_SUBCONTAINER), or reallocation of m_pData in pSubAscii was necessary but failed (MDZ_ERROR_ALLOCATION)
Size of stringif nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No copying is made
operation succeeded0-based position after copied data, or Size if not found

Synchronous execution of mdz_ascii_copySubAsciiFrom_generic():
mdz_ascii_copySubAsciiFrom(pAscii, nLeftPos, nCount, pSubAscii);

Asynchronous execution of mdz_ascii_copySubAsciiFrom_generic(). Not yet implemented:
mdz_ascii_copySubAsciiFrom_async(pAscii, nLeftPos, nCount, pSubAscii, pAsyncData);

mdz_ascii Reference
mdz_containers API Reference


mdz_wchar 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 bytes.

Init and destroy functions:

mdz_wchar_create
mdz_wchar_create_attached
mdz_wchar_destroy
mdz_wchar_clear
mdz_wchar_attachData

Reserve capacity functions:

mdz_wchar_reserve
mdz_wchar_capacity
mdz_wchar_size
mdz_wchar_length
mdz_wchar_offsetFromStart

Insert/remove functions:

mdz_wchar_insert
mdz_wchar_insertBytes
mdz_wchar_insertUtf8
mdz_wchar_insertUtf16
mdz_wchar_insertUtf32


mdz_wchar_create

Create empty "wide"-character string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.

struct mdz_Wchar* mdz_wchar_create(void);

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif memory allocation failed
NULLif sizeof(wchar_t) != 2 (see description in file header)
if succeededpointer to string for use in other mdz_wchar functions

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_create_attached

Create 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* pSize);

ParameterDescription
pStartmemory start position of wchar structure
pSizeinitially should contain size of available memory from pStart. After wchar creation - contains actual size of internal wchar structure

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif sizeof(wchar_t) != 2 (see description in file header)
NULLif pStart == NULL or pSize == NULL
NULLif size in pSize is smaller than size of internal wchar structure
if succeededpointer to string for use in other mdz_wchar functions. Normally it equals to pStart

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_destroy

Destroy "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);

ParameterDescription
ppWcharpointer to pointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_clear

Clear m_pData of "wide"-character string with setting Size in 0.

void mdz_wchar_clear(struct mdz_Wchar* pWchar);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create()

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_attachData

Attach 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);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
pDatapointer to pre-allocated data to attach
nOffsetFromStartposition in pre-allocated data to attach from. Can be > 0
nCapacityfull capacity pre-allocated data in items
enAttachTypetype of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed

ReturnDescription
mdz_falseif pWchar == NULL
mdz_falseif test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY)
mdz_falseif pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE)
mdz_falseif enAttachType == MDZ_ATTACH_SIZE_TERMINATOR and pData contains invalid "wide"-characters (MDZ_ERROR_CONTENT)
mdz_trueoperation succeeded

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_reserve

Reserve nNewCapacity bytes for string. Size and Length do not change.

mdz_bool mdz_wchar_reserve(struct mdz_Wchar* pWchar, size_t nNewCapacity);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
nNewCapacitynew capacity in "wide"-characters to reserve

ReturnDescription
mdz_falseif pWchar == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_containers API Reference

mdz_wchar_capacity

Return string Capacity.

size_t mdz_wchar_capacity(struct mdz_Wchar* pWchar);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()

ReturnDescription
SIZE_MAXif pWchar == NULL
Capacity in "wide"characters - otherwise

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_size

Return string Size.

size_t mdz_wchar_size(struct mdz_Wchar* pWchar);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()

ReturnDescription
SIZE_MAXif pWchar == NULL
Size in "wide"characters - otherwise

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_length

Return string Length.

size_t mdz_wchar_length(struct mdz_Wchar* pWchar);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()

ReturnDescription
SIZE_MAXif pWchar == NULL
Length in symbolsotherwise

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_offsetFromStart

Return string OffsetFromStart.

size_t mdz_wchar_offsetFromStart(struct mdz_Wchar* pWchar);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()

ReturnDescription
SIZE_MAXif pWchar == NULL
OffsetFromStart in "wide"characters - otherwise

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_insert

Insert nCount "wide"-characters in string. Capacity should contain enough free space for nCount "wide"-characters. Size grows on nCount. Length grows on symbols count.

mdz_bool mdz_wchar_insert_generic(struct mdz_Wchar* pWchar, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pwcItems"wide"-characters to insert
nCountnumber of "wide"-characters to insert. Use 0 if pwcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pWchar == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pwcItems contain invalid "wide"-character(s) (MDZ_ERROR_CONTENT)
mdz_trueif pwcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_wchar_insert_generic():
mdz_wchar_insert(pWchar, nLeftPos, pwcItems, nCount);

Synchronous execution of mdz_wchar_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserve(pWchar, nLeftPos, pwcItems, nCount);

Asynchronous execution of mdz_wchar_insert_generic():
mdz_wchar_insert_async(pWchar, nLeftPos, pwcItems, nCount, pAsyncData);

Asynchronous execution of mdz_wchar_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserve_async(pWchar, nLeftPos, pwcItems, nCount, pAsyncData);

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_insertBytes

Insert nCount ASCII/ANSI bytes in string. Characters are converted to "wide"-characters before isertion.
Capacity should contain enough free space for added "wide"-characters. Size grows on added "wide"-characters count. Length grows on added symbols count.

mdz_bool mdz_wchar_insertBytes_generic(struct mdz_Wchar* pWchar, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsbytes to insert
nCountnumber of bytes to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pWchar is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_wchar_insertBytes_generic():
mdz_wchar_insertBytes(pWchar, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_wchar_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveBytes(pWchar, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_wchar_insertBytes_generic():
mdz_wchar_insertBytes_async(pWchar, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_wchar_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveBytes_async(pWchar, nLeftPos, pcItems, nCount, pAsyncData);

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_insertUtf8

Insert nCount UTF-8 characters in string. UTF-8 characters are converted to "wide"-characters before isertion.
Capacity should contain enough free space for added "wide"-characters. Size grows on added "wide"-characters count. Length grows on added symbols count.

mdz_bool mdz_wchar_insertUtf8_generic(struct mdz_Wchar* pWchar, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsUTF-8 characters to insert
nCountnumber of UTF-8 characters to insert in bytes. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pWchar is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pcItems contain invalid UTF-8 character(s) (MDZ_ERROR_CONTENT)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_wchar_insertUtf8_generic():
mdz_wchar_insertUtf8(pWchar, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_wchar_insertUtf8_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveUtf8(pWchar, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_wchar_insertUtf8_generic():
mdz_wchar_insertUtf8_async(pWchar, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_wchar_insertUtf8_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveUtf8_async(pWchar, nLeftPos, pcItems, nCount, pAsyncData);

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_insertUtf16

Insert nCount UTF-16 characters in string. UTF-16 characters are converted to "wide"-characters before isertion.
Capacity should contain enough free space for added "wide"-characters. Size grows on added "wide"-characters count. Length grows on added symbols count.

mdz_bool mdz_wchar_insertUtf16_generic(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);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-16 characters to insert
nCountnumber of UTF-16 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-16 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pWchar is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid UTF-16 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_wchar_insertUtf16_generic():
mdz_wchar_insertUtf16(pWchar, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_wchar_insertUtf16_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveUtf16(pWchar, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_wchar_insertUtf16_generic():
mdz_wchar_insertUtf16_async(pWchar, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_wchar_insertUtf16_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveUtf16_async(pWchar, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_wchar Reference
mdz_containers API Reference

mdz_wchar_insertUtf32

Insert nCount UTF-32 characters in string. UTF-32 characters are converted to "wide"-characters before isertion.
Capacity should contain enough free space for added "wide"-characters. Size grows on added "wide"-characters count. Length grows on added symbols count.

mdz_bool mdz_wchar_insertUtf32_generic(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);

ParameterDescription
pWcharpointer to string returned by mdz_wchar_create() or mdz_wchar_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-32 characters to insert
nCountnumber of UTF-32 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-32 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pWchar is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid UTF-32 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_wchar_insertUtf32_generic():
mdz_wchar_insertUtf32(pWchar, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_wchar_insertUtf32_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveUtf32(pWchar, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_wchar_insertUtf32_generic():
mdz_wchar_insertUtf32_async(pWchar, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_wchar_insertUtf32_generic(), with reservation if there is not enough capacity for insertion:
mdz_wchar_insertAndReserveUtf32_async(pWchar, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_wchar Reference
mdz_containers API Reference


mdz_utf8 Reference

mdz_utf8 is dynamically-sized contiguous string, containing UTF-8 characters

If only ASCII/ANSI characters should be stored/processed - use mdz_ascii 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.

Init and destroy functions:

mdz_utf8_create
mdz_utf8_create_attached
mdz_utf8_destroy
mdz_utf8_clear
mdz_utf8_attachData

Reserve capacity functions:

mdz_utf8_reserve
mdz_utf8_capacity
mdz_utf8_size
mdz_utf8_length
mdz_utf8_offsetFromStart

Insert/remove functions:

mdz_utf8_insert
mdz_utf8_insertBytes
mdz_utf8_insertWchar
mdz_utf8_insertUtf16
mdz_utf8_insertUtf32


mdz_utf8_create

Create empty UTF-8 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.

struct mdz_Utf8* mdz_utf8_create(void);

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif memory allocation failed
if succeededpointer to string for use in other mdz_utf8 functions

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_create_attached

Create 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* pSize);

ParameterDescription
pStartmemory start position of utf8 structure
pSizeinitially should contain size of available memory from pStart. After utf8 creation - contains actual size of internal utf8 structure

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif pStart == NULL or pSize == NULL
NULLif size in pSize is smaller than size of internal utf8 structure
if succeededpointer to string for use in other mdz_utf8 functions. Normally it equals to pStart

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_destroy

Destroy 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);

ParameterDescription
ppUtf8pointer to pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_clear

Clear m_pData of UTF-8 string with setting Size in 0.

void mdz_utf8_clear(struct mdz_Utf8* pUtf8);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_attachData

Attach 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);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
pDatapointer to pre-allocated data to attach
nOffsetFromStartposition in pre-allocated data to attach from. Can be > 0
nCapacityfull capacity pre-allocated data in items
enAttachTypetype of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY)
mdz_falseif pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE)
mdz_falseif enAttachType == MDZ_ATTACH_SIZE_TERMINATOR and pData contains invalid UTF-8 characters (MDZ_ERROR_CONTENT)
mdz_trueoperation succeeded

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_reserve

Reserve 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);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
nNewCapacitynew capacity in bytes to reserve

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_containers API Reference

mdz_utf8_capacity

Return string Capacity.

size_t mdz_utf8_capacity(struct mdz_Utf8* pUtf8);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create()

ReturnDescription
SIZE_MAXif pUtf8 == NULL
Capacity in bytesotherwise

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_size

Return string Size.

size_t mdz_utf8_size(struct mdz_Utf8* pUtf8);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()

ReturnDescription
SIZE_MAXif pUtf8 == NULL
Size in bytesotherwise

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_length

Return string Length.

size_t mdz_utf8_length(struct mdz_Utf8* pUtf8);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()

ReturnDescription
SIZE_MAXif pUtf8 == NULL
Length in symbolsotherwise

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_offsetFromStart

Return string OffsetFromStart.

size_t mdz_utf8_offsetFromStart(struct mdz_Utf8* pUtf8);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()

ReturnDescription
SIZE_MAXif pUtf8 == NULL
OffsetFromStart in bytesotherwise

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_insert

Insert nCount UTF-8 bytes in string. Capacity should contain enough free space for nCount bytes. Size grows on nCount. Length grows on symbols count.

mdz_bool mdz_utf8_insert_generic(struct mdz_Utf8* pUtf8, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsUTF-8 bytes to insert
nCountnumber of UTF-8 bytes to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pcItems contain invalid UTF-8 byte(s) (MDZ_ERROR_CONTENT)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf8_insert_generic():
mdz_utf8_insert(pUtf8, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_utf8_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserve(pUtf8, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_utf8_insert_generic():
mdz_utf8_insert_async(pUtf8, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf8_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserve_async(pUtf8, nLeftPos, pcItems, nCount, pAsyncData);

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_insertBytes

Insert nCount ASCII/ANSI bytes in string. Characters are converted to UTF-8 characters before isertion.
Capacity should contain enough free space for added UTF-8 characters. Size grows on added bytes. Length grows on added symbols count.

mdz_bool mdz_utf8_insertBytes_generic(struct mdz_Utf8* pUtf8, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsbytes to insert
nCountnumber of bytes to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf8_insertBytes_generic():
mdz_utf8_insertBytes(pUtf8, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_utf8_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveBytes(pUtf8, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_utf8_insertBytes_generic():
mdz_utf8_insertBytes_async(pUtf8, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf8_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveBytes_async(pUtf8, nLeftPos, pcItems, nCount, pAsyncData);

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_insertWchar

Insert nCount "wide"-characters in string. Characters are converted to UTF-8 characters before isertion.
Capacity should contain enough free space for added UTF-8 characters. Size grows on added bytes. Length grows on symbols count.

mdz_bool mdz_utf8_insertWchar_generic(struct mdz_Utf8* pUtf8, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pwcItems"wide"-characters to insert
nCountnumber of "wide"-characters to insert. Use 0 if pwcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pwcItems contain invalid "wide"-character(s) (MDZ_ERROR_CONTENT)
mdz_trueif pwcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf8_insertWchar_generic():
mdz_utf8_insertWchar(pUtf8, nLeftPos, pwcItems, nCount);

Synchronous execution of mdz_utf8_insertWchar_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveWchar(pUtf8, nLeftPos, pwcItems, nCount);

Asynchronous execution of mdz_utf8_insertWchar_generic():
mdz_utf8_insertWchar_async(pUtf8, nLeftPos, pwcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf8_insertWchar_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveWchar_async(pUtf8, nLeftPos, pwcItems, nCount, pAsyncData);

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_insertUtf16

Insert nCount UTF-16 characters in string. UTF-16 characters are converted to UTF-8 before isertion.
Capacity should contain enough free space for added bytes. 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_generic(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);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-16 characters to insert
nCountnumber of UTF-16 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-16 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid UTF-16 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf8_insertUtf16_generic():
mdz_utf8_insertUtf16(pUtf8, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_utf8_insertUtf16_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveUtf16(pUtf8, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_utf8_insertUtf16_generic():
mdz_utf8_insertUtf16_async(pUtf8, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_utf8_insertUtf16_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveUtf16_async(pUtf8, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_utf8 Reference
mdz_containers API Reference

mdz_utf8_insertUtf32

Insert nCount UTF-32 characters in string. UTF-32 characters are converted to UTF-8 before isertion.
Capacity should contain enough free space for added bytes. 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_generic(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);

ParameterDescription
pUtf8pointer to string returned by mdz_utf8_create() or mdz_utf8_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-32 characters to insert
nCountnumber of UTF-32 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-32 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf8 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid UTF-32 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf8_insertUtf32_generic():
mdz_utf8_insertUtf32(pUtf8, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_utf8_insertUtf32_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveUtf32(pUtf8, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_utf8_insertUtf32_generic():
mdz_utf8_insertUtf32_async(pUtf8, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_utf8_insertUtf32_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf8_insertAndReserveUtf32_async(pUtf8, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_utf8 Reference
mdz_containers API Reference


mdz_utf16 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()

Init and destroy functions:

mdz_utf16_create
mdz_utf16_create_attached
mdz_utf16_destroy
mdz_utf16_clear
mdz_utf16_attachData

Reserve capacity functions:

mdz_utf16_reserve
mdz_utf16_capacity
mdz_utf16_size
mdz_utf16_length
mdz_utf16_endianness
mdz_utf16_offsetFromStart

Insert/remove functions:

mdz_utf16_insert
mdz_utf16_insertBytes
mdz_utf16_insertWchar
mdz_utf16_insertUtf8
mdz_utf16_insertUtf32


mdz_utf16_create

Create empty UTF-16 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.

struct mdz_Utf16* mdz_utf16_create(enum mdz_endianness enEndianness);

ParameterDescription
enEndiannessendianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif memory allocation failed
NULLif invalid enEndianness
if succeededpointer to string for use in other mdz_utf16 functions

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_create_attached

Create 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(enum mdz_endianness enEndianness, const void* pStart, size_t* pSize);

ParameterDescription
enEndiannessendianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG
pStartmemory start position of utf16 structure
pSizeinitially should contain size of available memory from pStart. After utf16 creation - contains actual size of internal utf16 structure

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif invalid enEndianness
NULLif pStart == NULL or pSize == NULL
NULLif size in pSize is smaller than size of internal utf16 structure
if succeededpointer to string for use in other mdz_utf16 functions. Normally it equals to pStart

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_destroy

Destroy 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);

ParameterDescription
ppUtf16pointer to pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_clear

Clear m_pData of UTF-16 string with setting Size in 0.

void mdz_utf16_clear(struct mdz_Utf16* pUtf16);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create()

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_attachData

Attach 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);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
pDatapointer to pre-allocated data to attach
nOffsetFromStartposition in pre-allocated data to attach from. Can be > 0
nCapacityfull capacity pre-allocated data in items
enAttachTypetype of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed
enEndiannessendianness of UTF-16 characters in pData. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"

ReturnDescription
mdz_falseif pUtf16 == NULL
mdz_falseif test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY)
mdz_falseif 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_falseif enAttachType == MDZ_ATTACH_SIZE_TERMINATOR and pData contains invalid UTF-16 characters (MDZ_ERROR_CONTENT)
mdz_trueoperation succeeded

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_reserve

Reserve nNewCapacity bytes for UTF-16 string. Size and Length do not change.

mdz_bool mdz_utf16_reserve(struct mdz_Utf16* pUtf16, size_t nNewCapacity);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nNewCapacitynew capacity in UTF-16 characters to reserve

ReturnDescription
mdz_falseif pUtf16 == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_containers API Reference

mdz_utf16_capacity

Return string Capacity.

size_t mdz_utf16_capacity(struct mdz_Utf16* pUtf16);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()

ReturnDescription
SIZE_MAXif pUtf16 == NULL
Capacity in UTF16 characters - otherwise

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_size

Return string Size.

size_t mdz_utf16_size(struct mdz_Utf16* pUtf16);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()

ReturnDescription
SIZE_MAXif pUtf16 == NULL
Size in UTF16 characters - otherwise

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_length

Return string Length.

size_t mdz_utf16_length(struct mdz_Utf16* pUtf16);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()

ReturnDescription
SIZE_MAXif pUtf16 == NULL
Length in symbolsotherwise

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_endianness

Return string endianness.

enum mdz_endianness mdz_utf16_endianness(struct mdz_Utf16* pUtf16);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()

ReturnDescription
MDZ_ENDIAN_ERRORif pUtf16 == NULL
string endiannessotherwise

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_offsetFromStart

Return string OffsetFromStart.

size_t mdz_utf16_offsetFromStart(struct mdz_Utf16* pUtf16);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()

ReturnDescription
SIZE_MAXif pUtf16 == NULL
OffsetFromStart in UTF16 characters - otherwise

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_insert

Insert nCount UTF-16 characters in string. Capacity should contain enough free space for nCount UTF-16 characters. Size grows on nCount. Length grows on symbols count.

mdz_bool mdz_utf16_insert_generic(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);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-16 characters to insert
nCountnumber of UTF-16 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-16 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf16 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid UTF-16 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf16_insert_generic():
mdz_utf16_insert(pUtf16, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_utf16_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserve(pUtf16, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_utf16_insert_generic():
mdz_utf16_insert_async(pUtf16, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_utf16_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserve_async(pUtf16, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_insertBytes

Insert nCount ASCII/ANSI bytes in string. Characters are converted to UTF-16 characters before isertion.
Capacity should contain enough free space for added UTF_16 characters. Size grows on added UTF-16 characters count. Length grows on added symbols count.

mdz_bool mdz_utf16_insertBytes_generic(struct mdz_Utf16* pUtf16, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsbytes to insert
nCountnumber of bytes to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf16 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf16_insertBytes_generic():
mdz_utf16_insertBytes(pUtf16, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_utf16_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveBytes(pUtf16, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_utf16_insertBytes_generic():
mdz_utf16_insertBytes_async(pUtf16, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf16_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveBytes_async(pUtf16, nLeftPos, pcItems, nCount, pAsyncData);

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_insertWchar

Insert nCount "wide"-characters in string. Characters are converted to UTF-16 characters before isertion.
Capacity should contain enough free space for added UTF-16 characters. Size grows on added UTF-16 characters count. Length grows on added symbols count.

mdz_bool mdz_utf16_insertWchar_generic(struct mdz_Utf16* pUtf16, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pwcItems"wide"-characters to insert
nCountnumber of "wide"-characters to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf16 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf16_insertWchar_generic():
mdz_utf16_insertWchar(pUtf16, nLeftPos, pwcItems, nCount);

Synchronous execution of mdz_utf16_insertWchar_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveWchar(pUtf16, nLeftPos, pwcItems, nCount);

Asynchronous execution of mdz_utf16_insertWchar_generic():
mdz_utf16_insertWchar_async(pUtf16, nLeftPos, pwcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf16_insertWchar_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveWchar_async(pUtf16, nLeftPos, pwcItems, nCount, pAsyncData);

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_insertUtf8

Insert nCount UTF-8 bytes in string. UTF-8 bytes are converted to UTF-16 characters before isertion.
Capacity should contain enough free space for added UTF-16 characters. Size grows on added UTF-16 characters count. Length grows on added symbols count.

mdz_bool mdz_utf16_insertUtf8_generic(struct mdz_Utf16* pUtf16, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsUTF-8 characters to insert
nCountnumber of UTF-8 characters to insert in bytes. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf16 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pcItems contain invalid UTF-8 byte(s) (MDZ_ERROR_CONTENT)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf16_insertUtf8_generic():
mdz_utf16_insertUtf8(pUtf16, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_utf16_insertUtf8_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveUtf8(pUtf16, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_utf16_insertUtf8_generic():
mdz_utf16_insertUtf8_async(pUtf16, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf16_insertUtf8_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveUtf8_async(pUtf16, nLeftPos, pcItems, nCount, pAsyncData);

mdz_utf16 Reference
mdz_containers API Reference

mdz_utf16_insertUtf32

Insert nCount UTF-32 characters in string. UTF-32 characters are converted to UTF-16 characters before isertion.
Capacity should contain enough free space for added UTF-16 characters. Size grows on added UTF-16 characters count. Length grows on added symbols count.

mdz_bool mdz_utf16_insertUtf32_generic(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);

ParameterDescription
pUtf16pointer to string returned by mdz_utf16_create() or mdz_utf16_create_attached()
nLeftPos0-based position to insert in symbols. "surrogate pairs" count as 1 symbol. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-32 characters to insert
nCountnumber of UTF-32 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-32 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf16 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid UTF-8 character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf16_insertUtf32_generic():
mdz_utf16_insertUtf32(pUtf16, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_utf16_insertUtf32_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveUtf32(pUtf16, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_utf16_insertUtf32_generic():
mdz_utf16_insertUtf32_async(pUtf16, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_utf16_insertUtf32_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf16_insertAndReserveUtf32_async(pUtf16, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_utf16 Reference
mdz_containers API Reference


mdz_utf32 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()

Init and destroy functions:

mdz_utf32_create
mdz_utf32_create_attached
mdz_utf32_destroy
mdz_utf32_clear
mdz_utf32_attachData

Reserve capacity functions:

mdz_utf32_reserve
mdz_utf32_capacity
mdz_utf32_size
mdz_utf32_length
mdz_utf32_endianness
mdz_utf32_offsetFromStart

Insert/remove functions:

mdz_utf32_insert
mdz_utf32_insertBytes
mdz_utf32_insertWchar
mdz_utf32_insertUtf8
mdz_utf32_insertUtf16


mdz_utf32_create

Create empty UTF-32 string with Capacity == 1 (for 0-terminator), Size == 0 and Length == 0.

struct mdz_Utf32* mdz_utf32_create(enum mdz_endianness enEndianness);

ParameterDescription
enEndiannessendianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif memory allocation failed
NULLif invalid enEndianness
if succeededpointer to string for use in other mdz_utf32 functions

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_create_attached

Create 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(enum mdz_endianness enEndianness, const void* pStart, size_t* pSize);

ParameterDescription
enEndiannessendianness of string. Should be MDZ_ENDIAN_LITTLE or MDZ_ENDIAN_BIG
pStartmemory start position of utf32 structure
pSizeinitially should contain size of available memory from pStart. After utf32 creation - contains actual size of internal utf32 structure

ReturnDescription
NULLif library is not initialized with mdz_containers_init() call
NULLif invalid enEndianness
NULLif pStart == NULL or pSize == NULL
NULLif size in pSize is smaller than size of internal utf32 structure
if succeededpointer to string for use in other mdz_utf32 functions. Normally it equals to pStart

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_destroy

Destroy 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);

ParameterDescription
ppUtf32pointer to pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_clear

Clear m_pData of UTF-32 string with setting Size in 0.

void mdz_utf32_clear(struct mdz_Utf32* pUtf32);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create()

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_attachData

Attach 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);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
pDatapointer to pre-allocated data to attach
nOffsetFromStartposition in pre-allocated data to attach from. Can be > 0
nCapacityfull capacity pre-allocated data in items
enAttachTypetype of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_TERMINATOR are allowed
enEndiannessendianness of UTF-32 characters in pData. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"

ReturnDescription
mdz_falseif pUtf32 == NULL
mdz_falseif test-license is used and nCapacity > 1200 (MDZ_ERROR_TEST_CAPACITY)
mdz_falseif 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_trueoperation succeeded

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_reserve

Reserve nNewCapacity bytes for UTF-32 string. Size and Length do not change.

mdz_bool mdz_utf32_reserve(struct mdz_Utf32* pUtf32, size_t nNewCapacity);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
nNewCapacitynew capacity in UTF-32 characters to reserve

ReturnDescription
mdz_falseif pUtf32 == NULL
mdz_falseif memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_containers API Reference

mdz_utf32_capacity

Return string Capacity.

size_t mdz_utf32_capacity(struct mdz_Utf32* pUtf32);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()

ReturnDescription
SIZE_MAXif pUtf32 == NULL
Capacity in UTF32 characters - otherwise

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_size

Return string Size.

size_t mdz_utf32_size(struct mdz_Utf32* pUtf32);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()

ReturnDescription
SIZE_MAXif pUtf32 == NULL
Size in UTF32 characters - otherwise

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_length

Return string length.

size_t mdz_utf32_length(struct mdz_Utf32* pUtf32);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()

ReturnDescription
SIZE_MAXif pUtf32 == NULL
Size in symbolsotherwise

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_endianness

Return string endianness.

enum mdz_endianness mdz_utf32_endianness(struct mdz_Utf32* pUtf32);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()

ReturnDescription
MDZ_ENDIAN_ERRORif pUtf32 == NULL
string endiannessotherwise

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_offsetFromStart

Return string OffsetFromStart.

size_t mdz_utf32_offsetFromStart(struct mdz_Utf32* pUtf32);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()

ReturnDescription
SIZE_MAXif pUtf32 == NULL
OffsetFromStart in UTF32 characters - otherwise

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_insert

Insert nCount UTF-32 characters in string. Capacity should contain enough free space for nCount UTF-32 characters. Size grows on nCount. Length grows on symbols count.

mdz_bool mdz_utf32_insert_generic(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);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-32 characters to insert
nCountnumber of UTF-32 characters to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-32 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf32 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf32_insert_generic():
mdz_utf32_insert(pUtf32, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_utf32_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserve(pUtf32, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_utf32_insert_generic():
mdz_utf32_insert_async(pUtf32, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_utf32_insert_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserve_async(pUtf32, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_insertBytes

Insert nCount ASCII/ANSI bytes in string. Characters are converted to UTF-32 characters before isertion.
Capacity should contain enough free space for added UTF-32 characters. Size grows on added UTF-32 characters count. Length grows on added symbols count.

mdz_bool mdz_utf32_insertBytes_generic(struct mdz_Utf32* pUtf32, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsbytes to insert
nCountnumber of bytes to insert. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf32 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf32_insertBytes_generic():
mdz_utf32_insertBytes(pUtf32, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_utf32_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveBytes(pUtf32, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_utf32_insertBytes_generic():
mdz_utf32_insertBytes_async(pUtf32, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf32_insertBytes_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveBytes_async(pUtf32, nLeftPos, pcItems, nCount, pAsyncData);

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_insertWchar

Insert nCount "wide"-characters in string. Characters are converted to UTF-32 characters before isertion.
Capacity should contain enough free space for added UTF-32 characters. Size grows on added UTF-32 characters count. Length grows on added symbols count.

mdz_bool mdz_utf32_insertWchar_generic(struct mdz_Utf32* pUtf32, size_t nLeftPos, const wchar_t* pwcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
nLeftPos0-based position to insert in symbols symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pwcItems"wide"-characters to insert
nCountnumber of characters to insert in bytes. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf32 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf32_insertWchar_generic():
mdz_utf32_insertWchar(pUtf32, nLeftPos, pwcItems, nCount);

Synchronous execution of mdz_utf32_insertWchar_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveWchar(pUtf32, nLeftPos, pwcItems, nCount);

Asynchronous execution of mdz_utf32_insertWchar_generic():
mdz_utf32_insertWchar_async(pUtf32, nLeftPos, pwcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf32_insertWchar_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveWchar_async(pUtf32, nLeftPos, pwcItems, nCount, pAsyncData);

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_insertUtf8

Insert nCount UTF-8 characters in string. UTF-8 characters are converted to UTF-32 characters before isertion.
Capacity should contain enough free space for added UTF-32 characters. Size grows on added UTF-32 characters count. Length grows on added symbols count.

mdz_bool mdz_utf32_insertUtf8_generic(struct mdz_Utf32* pUtf32, size_t nLeftPos, const unsigned char* pcItems, size_t nCount, mdz_bool bReserve, struct mdz_asyncData* pAsyncData);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pcItemsUTF-8 characters to insert
nCountnumber of UTF-8 characters to insert in bytes. Use 0 if pcItems until 0-terminator should be used
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf32 is NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pcItems contain invalid UTF-8 character(s) (MDZ_ERROR_CONTENT)
mdz_trueif pcItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf32_inserttUtf8_generic():
mdz_utf32_insertUtf8(pUtf32, nLeftPos, pcItems, nCount);

Synchronous execution of mdz_utf32_inserttUtf8_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveUtf8(pUtf32, nLeftPos, pcItems, nCount);

Asynchronous execution of mdz_utf32_inserttUtf8_generic():
mdz_utf32_insertUtf8_async(pUtf32, nLeftPos, pcItems, nCount, pAsyncData);

Asynchronous execution of mdz_utf32_inserttUtf8_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveUtf8_async(pUtf32, nLeftPos, pcItems, nCount, pAsyncData);

mdz_utf32 Reference
mdz_containers API Reference

mdz_utf32_insertUtf16

Insert nCount UTF-16 characters in string. Characters are converted to UTF-32 characters before isertion.
Capacity should contain enough free space for added UTF-32 characters. Size grows on added UTF-32 characters count. Length grows on symbols count.

mdz_bool mdz_utf32_insertUtf16_generic(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);

ParameterDescription
pUtf32pointer to string returned by mdz_utf32_create() or mdz_utf32_create_attached()
nLeftPos0-based position to insert in symbols. If nLeftPos == Length, items are appended. nLeftPos > Length is not allowed
pItemsUTF-16 items to insert
nCountnumber of UTF-16 items to insert. Use 0 if pItems until 0-terminator should be used
enEndiannessendianness of UTF-16 characters in pItems. Can be MDZ_ENDIAN_LITTLE for "little-endian" or MDZ_ENDIAN_BIG for "big-endian"
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false
pAsyncDatapointer to shared async data for asynchronous call, or NULL if call should be synchronous. Only NULL is supported by this function at present

ReturnDescription
mdz_falseif pUtf32 == NULL
mdz_falseif bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION)
mdz_falseif 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_falseif bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_falseif pItems contain invalid 2-byte character(s) (MDZ_ERROR_CONTENT), or invalid enEndianness (MDZ_ERROR_ENDIANNESS)
mdz_trueif pItems == NULL (MDZ_ERROR_ITEMS), or nLeftPos > Length (MDZ_ERROR_BIGLEFT). No insertion is made
mdz_trueinsertion succeeded

Synchronous execution of mdz_utf32_inserttUtf16_generic():
mdz_utf32_insertUtf16(pUtf32, nLeftPos, pItems, nCount, enEndianness);

Synchronous execution of mdz_utf32_inserttUtf16_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveUtf16(pUtf32, nLeftPos, pItems, nCount, enEndianness);

Asynchronous execution of mdz_utf32_inserttUtf16_generic():
mdz_utf32_insertUtf16_async(pUtf32, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

Asynchronous execution of mdz_utf32_inserttUtf16_generic(), with reservation if there is not enough capacity for insertion:
mdz_utf32_insertAndReserveUtf16_async(pUtf32, nLeftPos, pItems, nCount, enEndianness, pAsyncData);

mdz_utf32 Reference
mdz_containers API Reference
Copyright Ⓒ 2017 - 2020 maxdz Software GmbH. All rights reserved.
Site content generated by mdzWebSiteGenerator Ⓒ 2017 - 2020 maxdz Software GmbH. All rights reserved.