HomeUnser TeamB2B Produktekeyboard_arrow_downmdz_ansikeyboard_arrow_downmdz_unicodekeyboard_arrow_downmdz_vectorkeyboard_arrow_downReferenceB2C ProdukteShopGesetzlichesKontakte | mdz_vector API Reference is generated by mdzApiRefGenerator. mdz_vector API Reference
Many functions of mdz_vector accept parameters for asynchronous execution. The only relevant parameter is: - struct mdz_asyncData* pAsyncData - pointer to shared async data for asynchronous call, or NULL if call should be synchronous Fields of struct mdz_asyncData* are following: Type | Parameter | Description | void* | m_pString | Pointer to string instance | mdz_bool | m_bFinished | mdz_true if the call is completely finished. Otherwise mdz_false (if interrupted/cancelled) | size_t | m_nResult | Result of call. Invalid if call is not completely finished (m_bFinished is mdz_false ) | void* | m_pData | Additional data returned by call (if any). Invalid if call is not completely finished (m_bFinished is mdz_false ) | mdz_bool | m_bCancel | Should be set by client in mdz_true during call execution, to cancel the call. Otherwise mdz_false | pthread_t / HANDLE | m_hThread | Handle to thread on which the call is executed. May be used by client for wait operations |
mdz_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.
mdz_vector_initInitializes vector library. This function should be caled before any other function of the library.mdz_bool mdz_vector_init(const uint32_t* pFirstNameHash, const uint32_t* pLastNameHash, const uint32_t* pEmailHash, const uint32_t* pLicenseHash); Parameter | Description |
---|
pFirstNameHash | user first name hash code | pLastNameHash | user last name hash code | pEmailHash | user e-mail hash code | pLicenseHash | license hash code |
Return | Description |
---|
mdz_true | if the initialization has succeed, otherwise false | mdz_vector Reference mdz_vector_init_attachedInitializes vector library. This function should be caled before any other function of the library. Memory for license data starts at position pStart . Size of internal initialization structure is returned in pSize.mdz_bool mdz_vector_init_attached(const uint32_t* pFirstNameHash, const uint32_t* pLastNameHash, const uint32_t* pEmailHash, const uint32_t* pLicenseHash, const char* pStart, size_t nAreaSize, size_t* pOutSize); Parameter | Description |
---|
pFirstNameHash | user first name hash code | pLastNameHash | user last name hash code | pEmailHash | user e-mail hash code | pLicenseHash | license hash code | pStart | memory start position of license data | nAreaSize | size of available memory from pStart in bytes. Should be large enough for license data (> 500 bytes) | pOutSize | actual size of placed license data in bytes |
Return | Description |
---|
mdz_true | if the initialization has succeed, otherwise false | mdz_vector Reference mdz_vector_uninitUn-initializes vector library and frees corresponding memory allocations.void mdz_vector_uninit(void); mdz_vector Reference mdz_vector_createCreate empty vector with Capacity and Size 0. Memory for vector structure is allocated using malloc() .struct mdz_Vector* mdz_vector_create(size_t nTypeSize); Parameter | Description |
---|
nTypeSize | sizeof of type used in vector. Allowed nTypeSize are 1, 2, 4 or 8 |
Return | Description |
---|
NULL | if library is not initialized with mdz_containers_init() call | NULL | if not allowed nTypeSize is used | NULL | if memory allocation failed | Result | pointer to vector for use in other mdz_vector functions | mdz_vector Reference mdz_vector_create_attachedCreate 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); Parameter | Description |
---|
nTypeSize | sizeof of type used in vector. Allowed nTypeSize are 1, 2, 4 or 8 | pStart | memory start position of vector structure | pSize | initially should contain size of available memory from pStart . After vector creation - contains actual size of internal vector structure |
Return | Description |
---|
NULL | if library is not initialized with mdz_containers_init() call | NULL | if not allowed nTypeSize is used | NULL | if pStart == NULL or pSize == NULL | NULL | if size in pSize is smaller than size of internal vector structure | Result | pointer to vector for use in other mdz_vector functions. Normally it equals to pStart | mdz_vector Reference mdz_vector_destroyDestroy 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); Parameter | Description |
---|
ppVector | pointer to pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | mdz_vector Reference mdz_vector_clearClear m_pData of vector with setting Size in 0.void mdz_vector_clear(struct mdz_Vector* pVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() | mdz_vector Reference mdz_vector_attachDataAttach 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); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | pData | pointer to pre-allocated data to attach | nOffsetFromStart | position in pre-allocated data to attach from. Can be > 0 | nCapacity | full capacity pre-allocated data in items | enAttachType | type of attachment. Only MDZ_ATTACH_ZEROSIZE and MDZ_ATTACH_SIZE_NO_TERMINATOR are allowed |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if pData == NULL (MDZ_ERROR_DATA), or nOffsetFromStart >= nCapacity (MDZ_ERROR_OFFSET), or invalid enAttachType (MDZ_ERROR_ATTACHTYPE) | mdz_true | operation succeeded | mdz_vector Reference mdz_vector_reserveReserve 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); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nNewCapacity | new capacity in items to reserve |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if 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_vector_reserveAndInitReserve 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() and nNewCapacity > Capacity mdz_bool mdz_vector_reserveAndInit(struct mdz_Vector* pVector, size_t nNewCapacity, const void* pItem); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nNewCapacity | capacity to reserve in items | pItem | item for vector initialization. If NULL , 0 will be used for initialization |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if Size > 0 (MDZ_ERROR_NONEMPTY) | mdz_false | if m_pData is attached using mdz_vector_attachData() (MDZ_ERROR_ATTACHED) | mdz_true | if nNewCapacity <= Capacity (MDZ_ERROR_CAPACITY), initialization succeeded | mdz_true | reservation and initialization succeeded | mdz_vector Reference mdz_vector_capacityReturn vector Capacity in items.size_t mdz_vector_capacity(struct mdz_Vector* pVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Capacity | otherwise | mdz_vector Reference mdz_vector_sizeReturn vector Size in items.size_t mdz_vector_size(struct mdz_Vector* pVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | otherwise | mdz_vector Reference mdz_vector_resizeSet vector Size . Size must be <= Capacity .mdz_bool mdz_vector_resize(struct mdz_Vector* pVector, size_t nNewSize); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nNewSize | new Size to set vector in |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if nNewSize > Capacity (MDZ_ERROR_CAPACITY). Vector Size is not changed | mdz_true | if succeeded | mdz_vector Reference mdz_vector_offsetFromStartReturn vector OffsetFromStart in items.size_t mdz_vector_offsetFromStart(struct mdz_Vector* pVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | OffsetFromStart | otherwise | mdz_vector Reference mdz_vector_isAttachedDataReturn if vector data is attached.mdz_bool mdz_vector_isAttachedData(struct mdz_Vector* pVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if vector data is not attached | mdz_true | if vector data is attached | mdz_vector Reference mdz_vector_insertInsert 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(struct mdz_Vector* pVector, size_t nLeftPos, const void* pItems, size_t nCount, mdz_bool bReserve); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based position to insert. If nLeftPos == Size or -1, items are appended. nLeftPos > Size is not allowed | pItems | items to insert. If NULL , 0 will be used for insertion nCount times | nCount | number of items to insert | bReserve | if mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if bReserve == mdz_true and memory allocation failed (MDZ_ERROR_ALLOCATION) | mdz_false | if bReserve == mdz_true and there is not enough capacity for inserted data but m_pData is attached using mdz_vector_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the vector (MDZ_ERROR_CAPACITY) | mdz_true | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > Size (MDZ_ERROR_BIGLEFT), or nCount is too big (MDZ_ERROR_BIGCOUNT). No insertion is made | mdz_true | insertion succeeded | mdz_vector Reference mdz_vector_findSingleFind first occurrence of pItem 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_findSingle(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItem); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of vector | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of vector | pItem | pointer to item to find. If NULL , value type of NULL (normally 0) nCount times, will be used for search |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made | Size | if item(s) not found | Result | 0-based position of first match | mdz_vector Reference mdz_vector_findFind 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, enum mdz_find_method enFindMethod); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of vector | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of vector | pItems | pointer to items to find. If NULL , value type of NULL (normally 0) nCount times, will be used for search | nCount | number of items to find | enFindMethod | find method to use. See details in mdz_find_method description |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if 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), or invalid enFindMethod (MDZ_ERROR_FINDMETHOD). No search is made | Size | if item(s) not found | Result | 0-based position of first match | mdz_vector Reference mdz_vector_firstOfFind 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of vector | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of vector | pItems | pointer to items to find. If NULL , 0 will be used for search | nCount | number of items to find. 1 if pItems == NULL |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made | Size | if item(s) not found | Result | 0-based position of first match | mdz_vector Reference mdz_vector_firstNotOfFind 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of vector | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of vector | pItems | pointer to items to check. If NULL , 0 will be used for search | nCount | number of items to check. 1 if pItems == NULL |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made | Size | if non-occurrence is not found | Result | 0-based position of first non-occurrence | mdz_vector Reference mdz_vector_rfindSingleFind last occurrence of pItem 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_rfindSingle(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItem); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of vector | nRightPos | 0-based start position to find from right. Use Size-1 to search from the end of vector | pItem | pointer to items to find. If NULL , value type of NULL (normally 0) nCount times, will be used for search |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGCOUNT). No search is made | Size | if item(s) not found | Result | 0-based position of first match | mdz_vector Reference mdz_vector_rfindFind 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, enum mdz_find_method enFindMethod); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of vector | nRightPos | 0-based start position to find from right. Use Size-1 to search from the end of vector | pItems | pointer to items to find. If NULL , value type of NULL (normally 0) nCount times, will be used for search | nCount | number of items to find | enFindMethod | find method to use. See details in mdz_find_method description |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGCOUNT), or invalid enFindMethod (MDZ_ERROR_FINDMETHOD). No search is made | Size | if item(s) not found | Result | 0-based position of first match | mdz_vector Reference mdz_vector_lastOfFind 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based end position to search up to. Use 0 to search till the beginning of vector | nRightPos | 0-based start position to search from right. Use Size-1 to search from the end of vector | pItems | pointer to items to find. If NULL , value type of NULL (normally 0) will be used for search | nCount | number of items to find |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made | Size | if item(s) not found | Result | 0-based position of first match | mdz_vector Reference mdz_vector_lastNotOfFind 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based end position to search up to. Use 0 to search till the beginning of vector | nRightPos | 0-based start position to search from right. Use Size-1 to search from the end of vector | pItems | pointer to items to find. If NULL , value type of NULL (normally 0) will be used for search | nCount | number of items to find |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | Size | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No search is made | Size | if non-occurrence is not found | Result | 0-based position - position of first match | mdz_vector Reference mdz_vector_removeFromRemove 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to remove item(s) from. Use 0 to remove from the beginning of vector | nCount | number of item(s) to remove. Assure that nLeftPos + nCount - 1 < Size - otherwise no removes will be made |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_true | if 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_true | operation succeeded | mdz_vector Reference mdz_vector_removeRemove all occurrences 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to remove item(s) from. Use 0 to search from the beginning of vector | nRightPos | 0-based end position to remove item(s) up to. Use Size-1 to search till the end of vector | pItems | pointer to items to remove. If NULL , value type of NULL (normally 0) nCount times, will be used for search | nCount | number of item(s) to remove |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_true | if 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_true | operation succeeded | mdz_vector Reference mdz_vector_trimLeftRemove 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to trim item(s) from left. Use 0 to trim from the beginning of vector | nRightPos | 0-based end position to trim item(s) up to. Use Size-1 to trim till the end of vector | pItems | pointer to items to remove. If NULL , value type of NULL (normally 0) will be used | nCount | number of items to remove. If pItems is NULL , nCount is set to 1 |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_true | if 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_true | operation succeeded | mdz_vector Reference mdz_vector_trimRightRemove 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based end position to trim item(s) up to. Use 0 to trim till the beginning of vector | nRightPos | 0-based start position to trim item(s) from right. Use Size-1 to trim from the end of vector | pItems | pointer to items to remove. If NULL , value type of NULL (normally 0) will be used | nCount | number of items to remove. If pItems is NULL , nCount is set to 1 |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_true | if 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_true | operation succeeded | mdz_vector Reference mdz_vector_trimRemove 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(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to trim item(s) from left. Use 0 to trim from the beginning of vector | nRightPos | 0-based start position to trim item(s) from right. Use Size-1 to trim from the end of vector | pItems | pointer to items to remove. If NULL , value type of NULL (normally 0) will be used | nCount | number of items to remove. If pItems is NULL , nCount is set to 1 |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_true | if 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_true | operation succeeded | mdz_vector Reference mdz_vector_compareCompare content of vector with pItems .enum mdz_compare_result mdz_vector_compare(struct mdz_Vector* pVector, size_t nLeftPos, const void* pItems, size_t nCount); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to compare from. Use 0 to compare from the beginning of vector | pItems | pointer to items to compare. If NULL , value type of NULL (normally 0) nCount times, will be used for comparison | nCount | number of items to compare |
Return | Description |
---|
MDZ_COMPARE_ERROR | if pVector == NULL | MDZ_COMPARE_NONEQUAL | if 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_NONEQUAL | Result of comparison | mdz_vector Reference mdz_vector_replaceReplace every occurrence 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(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); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to search for replace from. Use 0 to search from the beginning of vector | nRightPos | 0-based end position to search for replace up to. Use Size-1 to search till the end of vector | pItemsBefore | pointer to items to replace. If NULL , value type of NULL (normally 0) nCountBefore times, will be searched | nCountBefore | number of items to replace | pItemsAfter | pointer to items to replace with. If NULL , value type of NULL (normally 0) nCountAfter times, will be used to replace | nCountAfter | number of items to replace with | bReserve | if mdz_true reserve capacity when there is not enough space for replacement, otherwise mdz_false |
Return | Description |
---|
mdz_false | if pVector == NULL | mdz_false | if bReserve == mdz_true and there is not enough capacity for inserted data but m_pData is attached using mdz_vector_attachData() (MDZ_ERROR_ATTACHED) | mdz_false | if bReserve == mdz_false and there is not enough free Capacity in the vector (MDZ_ERROR_CAPACITY) | mdz_true | if 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_true | operation succeeded | mdz_vector Reference mdz_vector_countCounts number of pItems subvector occurrences in vector.size_t mdz_vector_count(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pItems, size_t nCount, mdz_bool bAllowOverlapped); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to count from. Use 0 to count from the beginning of vector | nRightPos | 0-based end position to count up to. Use Size-1 to count till the end of vector | pItems | items/subvector to count. If NULL , value type of NULL (normally 0) nCount times, will be counted | nCount | length of subvector to count | bAllowOverlapped | mdz_true if overlapped subvectors should be counted, otherwise mdz_false |
Return | Description |
---|
SIZE_MAX | if pVector == NULL | 0 | if 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 | Result | 0-based count of subvector occurrences. 0 if not found | mdz_vector Reference mdz_vector_copySubVectorFills pSubVector with items, starting from nLeftPos and ending with one of pSeparators or nRightPos .size_t mdz_vector_copySubVector(struct mdz_Vector* pVector, size_t nLeftPos, size_t nRightPos, const void* pSeparators, size_t nSeparatorsCount, struct mdz_Vector* pSubVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to get items from. Use 0 to start from the beginning of vector | nRightPos | 0-based end position to get items up to. Use Size-1 to proceed till the end of vector | pSeparators | separators to get items up to. If NULL , value type of NULL (normally 0) will be used | nSeparatorsCount | number of separators | pSubVector | pointer to vector where items should be copied. Data in pSubVector will be re-reserved to appropriate size if necessary |
Return | Description |
---|
SIZE_MAX | if pVector == NULL , or pSubVector == NULL (MDZ_ERROR_SUBCONTAINER), or reallocation of m_pData in pSubVector was necessary but failed (MDZ_ERROR_ALLOCATION) | Size | if nSeparatorsCount == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT). No copying is made | Result | 0-based position after separator if found, or Size if not found | mdz_vector Reference mdz_vector_copySubVectorFromFills pSubVector with items, starting from nLeftPos and containing nCount items.size_t mdz_vector_copySubVectorFrom(struct mdz_Vector* pVector, size_t nLeftPos, size_t nCount, struct mdz_Vector* pSubVector); Parameter | Description |
---|
pVector | pointer to vector returned by mdz_vector_create() or mdz_vector_create_attached() | nLeftPos | 0-based start position to get items from. Use 0 to start from the beginning of vector | nCount | number of items to copy | pSubVector | pointer to vector where items should be copied. Data in pSubVector will be re-reserved to appropriate size if necessary |
Return | Description |
---|
SIZE_MAX | if pVector == NULL , or pSubVector == NULL (MDZ_ERROR_SUBCONTAINER), or reallocation of m_pData in pSubVector was necessary but failed (MDZ_ERROR_ALLOCATION) | Size | if nCount == 0 (MDZ_ERROR_ZEROCOUNT), or nCount is too big (MDZ_ERROR_BIGCOUNT), or nLeftPos + nCount > Size (MDZ_ERROR_BIGLEFT). No copying is made | Result | 0-based position after copied data | mdz_vector Reference |