This documentation describes the Prokee module interface.
Templates
Show templates with parameter T set to: (
T),
(
char),
(
char16_t),
(
char32_t),
(
wchar_t
)
About
This module provides basic functionality for strings (like copying, concatenation and comparison) with automated reallocation of larger memory blocks, if required.
Static Template Methods:
create
mstrs< char32_t > *mstr::create(mstrs< char32_t > **mstring,unsigned int length)
create_from_str (version 2)
mstrs< char32_t > *mstr::create_from_str(mstrs< char32_t > **mstring,const char32_t *c_str,unsigned int length)
destroy
void mstr::destroy(mstrs< char32_t > *mstring)
length
unsigned int mstr::length(mstrs< char32_t > *mstring)
buffer_length
unsigned int mstr::buffer_length(mstrs< char32_t > *mstring)
buffer_bytes
unsigned int mstr::buffer_bytes(mstrs< char32_t > *mstring)
used_memory
unsigned int mstr::used_memory(mstrs< char32_t > *mstring)
cpy
mstrs< char32_t > *mstr::cpy(mstrs< char32_t > *mstring_a,mstrs< char32_t > *mstring_b)
cat
mstrs< char32_t > *mstr::cat(mstrs< char32_t > *mstring_a,mstrs< char32_t > *mstring_b)
cmp
int mstr::cmp(mstrs< char32_t > *mstring_a,mstrs< char32_t > *mstring_b)
fit
mstrs< char32_t > *mstr::fit(mstrs< char32_t > *mstring)
reset
mstrs< char32_t > *mstr::reset(mstrs< char32_t > *mstring)
c_str
char32_t *mstr::c_str(mstrs< char32_t > *mstring)
copy_str
mstrs< char32_t > *mstr::copy_str(mstrs< char32_t > *mstring,const char32_t *c_str)
append_str
mstrs< char32_t > *mstr::append_str(mstrs< char32_t > *mstring,const char32_t *c_str)
compare_str
int mstr::compare_str(mstrs< char32_t > *mstring,const char32_t *c_str)
Static Template Methods
create
Returns a new empty string.
Signature:
mstrs< char32_t > *mstr::create(mstrs< char32_t > **mstring,unsigned int length)
Parameters:
| mstrs< char32_t > ** | mstring | [OUT] | Address of a Pointer of type (mstrs< T > *). |
| unsigned int | length | | The initial length (in number of characters) of the memory block to store the string. |
Return value:A pointer to the new allocated
mstrs structure.
create_from_str (version 1)
Constructs a new mstrs structure.
Signature:
mstrs< char32_t > *mstr::create_from_str(mstrs< char32_t > **mstring,const char32_t *c_str)
Parameters:
| mstrs< char32_t > ** | mstring | [OUT] | Address of a Pointer of type (mstrs< T > *). |
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
Return value:A pointer to the new allocated
mstrs structure.
create_from_str (version 2)
Constructs a new mstrs structure.
Signature:
mstrs< char32_t > *mstr::create_from_str(mstrs< char32_t > **mstring,const char32_t *c_str,unsigned int length)
Parameters:
| mstrs< char32_t > ** | mstring | [OUT] | Address of a Pointer of type (mstrs< T > *). |
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
| unsigned int | length | | The initial length (in number of characters) of the memory block to store the string. |
Return value:A pointer to the new allocated
mstrs structure.
destroy
Frees all memory allocated for
mstring.
Signature:
void mstr::destroy(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
length
Returnes the length (in number of characters) of the string stored in
mstring.
Signature:
unsigned int mstr::length(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:The length of the string.
buffer_length
Returnes the length (in number of characters) of the memory block used to store the string in
mstring.
The actual size of the memory block is one character larger than the returened value to account for the null-termination character.
Signature:
unsigned int mstr::buffer_length(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:The length of the memory block.
buffer_bytes
Returnes the size in bytes of the memory block used to store the string in
mstring.
Signature:
unsigned int mstr::buffer_bytes(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:The size of the memory block.
used_memory
Returnes the total memory in bytes used by
mstring.
Signature:
unsigned int mstr::used_memory(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:The size of the used memory.
cpy
Copies the string from
mstring_b to
mstring_a.
Signature:
mstrs< char32_t > *mstr::cpy(mstrs< char32_t > *mstring_a,mstrs< char32_t > *mstring_b)
Parameters:
| mstrs< char32_t > * | mstring_a | [IN/OUT] | Pointer to a mstrs structure. |
| mstrs< char32_t > * | mstring_b | [IN] | Pointer to a mstrs structure. |
Return value:A pointer to
mstring_a.
cat
Appends the string from
mstring_b to
mstring_a.
Signature:
mstrs< char32_t > *mstr::cat(mstrs< char32_t > *mstring_a,mstrs< char32_t > *mstring_b)
Parameters:
| mstrs< char32_t > * | mstring_a | [IN/OUT] | Pointer to a mstrs structure. |
| mstrs< char32_t > * | mstring_b | [IN] | Pointer to a mstrs structure. |
Return value:A pointer to
mstring_a.
cmp
Compares
mstring_b with
mstring_a.
Signature:
int mstr::cmp(mstrs< char32_t > *mstring_a,mstrs< char32_t > *mstring_b)
Parameters:
| mstrs< char32_t > * | mstring_a | [IN] | Pointer to a mstrs structure. |
| mstrs< char32_t > * | mstring_b | [IN] | Pointer to a mstrs structure. |
Return value:Returnes 0 if both strings are equal and a value other than 0 otherwise.
fit
Reduces the size of the allocated memory to fit the string stored in
mstring.
Signature:
mstrs< char32_t > *mstr::fit(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:A pointer to
mstring.
reset
Resets the string stored in
mstring to the empty string.
Signature:
mstrs< char32_t > *mstr::reset(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:A pointer to
mstring.
c_str
Returns a pointer to the null-terminated string stored in
mstring.
Signature:
char32_t *mstr::c_str(mstrs< char32_t > *mstring)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
Return value:A Pointer to the null-rerminated string.
copy_str
Copies the null-terminated string
c_str to
mstring.
Signature:
mstrs< char32_t > *mstr::copy_str(mstrs< char32_t > *mstring,const char32_t *c_str)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
Return value:A pointer to
mstring.
append_str
Appends the null-terminated string
c_str to
mstring.
Signature:
mstrs< char32_t > *mstr::append_str(mstrs< char32_t > *mstring,const char32_t *c_str)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
Return value:A pointer to
mstring.
compare_str
Compares
mstring with the null-terminated string
c_str.
Signature:
int mstr::compare_str(mstrs< char32_t > *mstring,const char32_t *c_str)
Parameters:
| mstrs< char32_t > * | mstring | [IN] | Pointer to a mstrs structure. |
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
Return value:Returnes 0 if both strings are equal and a value other than 0 otherwise.
is_prefix (version 1)
Tests if
prefix is prefix of
str.
Signature:
bool mstr::is_prefix(mstrs< char32_t > *str,mstrs< char32_t > *prefix)
Parameters:
| mstrs< char32_t > * | str | [IN] | Pointer to a mstrs structure. |
| mstrs< char32_t > * | prefix | [IN] | Pointer to a mstrs structure. |
Return value:Returns
true if the strings matches and
false otherwise.
is_prefix (version 2)
Tests if
prefix is prefix of
str.
Signature:
bool mstr::is_prefix(const char32_t *c_str,mstrs< char32_t > *prefix)
Parameters:
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
| mstrs< char32_t > * | prefix | [IN] | Pointer to a mstrs structure. |
Return value:Returns
true if the strings matches and
false otherwise.
is_prefix (version 3)
Tests if one of the strings in
prefix is prefix of
str.
Signature:
int mstr::is_prefix(const char32_t *c_str,mstrs< char32_t > **prefix)
Parameters:
| const char32_t * | c_str | [IN] | Pointer to a null-terminated string. |
| mstrs< char32_t > ** | prefix | [IN] | Pointer to a null-terminated series of pointers to mstrs structures. |
Return value:Returns the index of the first string that matches. If no string in
prefix is prefix of
c_str, the function returns -1.