Module strman [Version: ]
[Main Page] [Details] [Tests]
This documentation describes the Prokee module interface.
Templates
Show templates with parameter T set to: (
T) -- (
char) -- (
wchar_t)
Static Template Methods:
explode
explode
template< class T > T **strman::explode(const T *sep,const T *str)
explode_count
template< class T > int strman::explode_count(T **explosion_parts)
explode_free
template< class T > void strman::explode_free(T **explosion_parts)
findItem
template< class T > int strman::findItem(const T *item,T **explosion_parts)
getItem
template< class T > T *strman::getItem(int index,T **explosion_parts)
level2
level2_create
template< class T > T **strman::level2_create(int ln,T ***itemlist)
level2_free
template< class T > void strman::level2_free(T **itemlist)
level2_replaceItem_realloc
template< class T > bool strman::level2_replaceItem_realloc(T **itemlist,const T *old_item,const T *new_item)
level2_setItem_realloc
template< class T > bool strman::level2_setItem_realloc(int itemid,T **itemlist,const T *item)
level2_setItem_malloc
template< class T > bool strman::level2_setItem_malloc(int itemid,T **itemlist,const T *item)
level2_freeItem
template< class T > bool strman::level2_freeItem(int itemid,T **itemlist)
nvlist
nvlist_create
template< class T > bool strman::nvlist_create(T ***names,T ***values,int ln)
nvlist_free
template< class T > void strman::nvlist_free(T **names,T **values)
nvlist_add
template< class T > bool strman::nvlist_add(T **names,T **values,const T *item_name)
nvlist_add_if_missing
template< class T > bool strman::nvlist_add_if_missing(T **names,T **values,const T *item_name)
nvlist_remove
template< class T > bool strman::nvlist_remove(T **names,T **values,const T *item_name)
nvlist_get
template< class T > T *strman::nvlist_get(T **names,T **values,const T *item_name)
nvlist_set
template< class T > bool strman::nvlist_set(T **names,T **values,const T *item_name,const T *item_value)
nvlist_print_all
template< class T > void strman::nvlist_print_all(T **names,T **values)
multistr
nullconcat
template< class T > T *strman::nullconcat(T *a,T *b)
nullcopy
template< class T > T *strman::nullcopy(T *a,T *b)
nullcopy_new
template< class T > T *strman::nullcopy_new(T **a,T *b)
isprefix, issuffix, ...
isprefix
template< class T > bool strman::isprefix(const T *a,const T *b)
issuffix
template< class T > bool strman::issuffix(const T *a,const T *b)
issubstr
template< class T > bool strman::issubstr(const T *a,const T *b)
findsubstr
template< class T > unsigned int strman::findsubstr(const T *a,const T *b)
substrmatch
template< class T > bool strman::substrmatch(const T *searchpat,const T *text)
matchpat
template< class T > bool strman::matchpat(T *a,T *b)
matchpat_i
template< class T > bool strman::matchpat_i(T *a,T *b,unsigned int pos_a,unsigned int pos_b)
matchsymbol
matchsymbol (version 0)
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols)
matchsymbol (version 1)
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols0,const T *symbols1)
matchsymbol (version 2)
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols0,const T *symbols1,const T *symbols2)
matchsymbol (version 3)
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols0,const T *symbols1,const T *symbols2,const T *symbols3)
Static Template Methods
explode
Explodes a string by a separator character.
Signature:
template< class T > T **strman::explode(const T *sep,const T *str)
Parameters:| const T * | sep | [IN] | One or more separator characters (as null-terminated string). |
| const T * | str | [IN] | The null-terminated string to be exploded. |
Return value:Pointer to a (null-terminated) series of pointers of the generated substrings.
Remarks:
If more than one separator character is provided, the string is splitted on all occurrences of any of the given separator characters.

All generated substrings are copied into one single and new allocated buffer. The original string
str will remain unchanged. Use
explode_free to free all memory allocated by this method.
Examples:
1)
char **a=strman::explode(",;","red, green, blue,,orange;black;");
The array
a will then contain the following substrings:
a[0]=="red"
a[1]==" green" //spaces are preserved
a[2]==" blue"
a[3]=="" //empty strings do also count
a[4]=="orange"
a[5]=="black"
a[6]=="" //a separator character at the beginning or at the and of the string will produce an additional empty string.
a[7]==null //the array of pointers is terminated by a NULL-pointer.
In this example
explode_count(a) will return 7.

2)
char **a=strman::explode("#","HELLO#WORLD#!");
The substrings are copied into one single buffer as illustrated below.
explode_count
Counts the number of substrings generated by
explode().
Signature:
template< class T > int strman::explode_count(T **explosion_parts)
Parameters:| T ** | explosion_parts | [IN] | The pointers to substrings, as returned by explode(). |
Return value:The number of substrings.
explode_free
Frees the buffers allocated by
explode().
Signature:
template< class T > void strman::explode_free(T **explosion_parts)
Parameters:| T ** | explosion_parts | [IN] | The pointers to substrings, as returned by explode(). |
findItem
Searches for a string within the list of substrings generated by
explode().
Signature:
template< class T > int strman::findItem(const T *item,T **explosion_parts)
Parameters:| const T * | item | [IN] | the null-terminated string to be searched for within the substrings generated by explode(). |
| T ** | explosion_parts | [IN] | The pointers to substrings, as returned by explode(). |
Return value:The index of the first match. If no match is found, the function returns -1.
Remarks:
Only the first occurrence of the string is returned by this function.
getItem
Returns the substring given by its index within the substrings generated by
explode().
Signature:
template< class T > T *strman::getItem(int index,T **explosion_parts)
Parameters:| int | index | | a index position of a substring within the substrings generated by explode(). |
| T ** | explosion_parts | [IN] | The pointers to substrings, as returned by explode(). |
Return value:A pointer to the substring given by its index position.
Remarks:
The function performs a range check for the given index. If the index is out of range, the function returns 0.
level2_create
Signature:
template< class T > T **strman::level2_create(int ln,T ***itemlist)
Parameters:| int | ln | | ln |
| T *** | itemlist | [IN] | itemlist |
Examples:
1)
char **itemlist;
strman::level2_create(3,&itemlist);
strman::level2_addItem_malloc(itemlist,"HELLO");
strman::level2_addItem_malloc(itemlist,"WORLD");
strman::level2_addItem_malloc(itemlist,"!");
Memory is allocated for each string as illustrated below. Mind the difference to the result of
explode().
level2_free
Signature:
template< class T > void strman::level2_free(T **itemlist)
Parameters:
level2_replaceItem_realloc
Signature:
template< class T > bool strman::level2_replaceItem_realloc(T **itemlist,const T *old_item,const T *new_item)
Parameters:| T ** | itemlist | [IN] | itemlist |
| const T * | old_item | [IN] | old_item |
| const T * | new_item | [IN] | new_item |
level2_setItem_realloc
Signature:
template< class T > bool strman::level2_setItem_realloc(int itemid,T **itemlist,const T *item)
Parameters:| int | itemid | | itemid |
| T ** | itemlist | [IN] | itemlist |
| const T * | item | [IN] | item |
level2_setItem_malloc
Signature:
template< class T > bool strman::level2_setItem_malloc(int itemid,T **itemlist,const T *item)
Parameters:| int | itemid | | itemid |
| T ** | itemlist | [IN] | itemlist |
| const T * | item | [IN] | item |
level2_addItem_malloc
Signature:
template< class T > bool strman::level2_addItem_malloc(T **itemlist,const T *item)
Parameters:| T ** | itemlist | [IN] | itemlist |
| const T * | item | [IN] | item |
level2_freeItem
Signature:
template< class T > bool strman::level2_freeItem(int itemid,T **itemlist)
Parameters:| int | itemid | | itemid |
| T ** | itemlist | [IN] | itemlist |
nvlist_create
Signature:
template< class T > bool strman::nvlist_create(T ***names,T ***values,int ln)
Parameters:| T *** | names | [IN] | names |
| T *** | values | [IN] | values |
| int | ln | | ln |
nvlist_free
Signature:
template< class T > void strman::nvlist_free(T **names,T **values)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
nvlist_add
Signature:
template< class T > bool strman::nvlist_add(T **names,T **values,const T *item_name)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
| const T * | item_name | [IN] | item_name |
nvlist_add_if_missing
Signature:
template< class T > bool strman::nvlist_add_if_missing(T **names,T **values,const T *item_name)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
| const T * | item_name | [IN] | item_name |
nvlist_remove
Signature:
template< class T > bool strman::nvlist_remove(T **names,T **values,const T *item_name)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
| const T * | item_name | [IN] | item_name |
nvlist_get
Signature:
template< class T > T *strman::nvlist_get(T **names,T **values,const T *item_name)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
| const T * | item_name | [IN] | item_name |
nvlist_set
Signature:
template< class T > bool strman::nvlist_set(T **names,T **values,const T *item_name,const T *item_value)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
| const T * | item_name | [IN] | item_name |
| const T * | item_value | [IN] | item_value |
nvlist_print_all
Signature:
template< class T > void strman::nvlist_print_all(T **names,T **values)
Parameters:| T ** | names | [IN] | names |
| T ** | values | [IN] | values |
nullconcat
Signature:
template< class T > T *strman::nullconcat(T *a,T *b)
Parameters:
nullcopy
Signature:
template< class T > T *strman::nullcopy(T *a,T *b)
Parameters:
nullcopy_new
Signature:
template< class T > T *strman::nullcopy_new(T **a,T *b)
Parameters:
isprefix
Signature:
template< class T > bool strman::isprefix(const T *a,const T *b)
Parameters:| const T * | a | [IN] | a |
| const T * | b | [IN] | b |
issuffix
Signature:
template< class T > bool strman::issuffix(const T *a,const T *b)
Parameters:| const T * | a | [IN] | a |
| const T * | b | [IN] | b |
issubstr
Signature:
template< class T > bool strman::issubstr(const T *a,const T *b)
Parameters:| const T * | a | [IN] | a |
| const T * | b | [IN] | b |
findsubstr
Signature:
template< class T > unsigned int strman::findsubstr(const T *a,const T *b)
Parameters:| const T * | a | [IN] | a |
| const T * | b | [IN] | b |
substrmatch
Signature:
template< class T > bool strman::substrmatch(const T *searchpat,const T *text)
Parameters:| const T * | searchpat | [IN] | searchpat |
| const T * | text | [IN] | text |
matchpat
Signature:
template< class T > bool strman::matchpat(T *a,T *b)
Parameters:
matchpat_i
Signature:
template< class T > bool strman::matchpat_i(T *a,T *b,unsigned int pos_a,unsigned int pos_b)
Parameters:| T * | a | [IN] | a |
| T * | b | [IN] | b |
| unsigned int | pos_a | | pos_a |
| unsigned int | pos_b | | pos_b |
matchsymbol (version 0)
Checks if the character at position
pos_in_str in string
str matches with one of the symbols in the string
symbols.
Signature:
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols)
Parameters:| const T * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const T * | symbols | [IN] | a null-terminated string. |
Return value:Returns
true, if a match is found and
false otherwise.
matchsymbol (version 1)
Checks if the character at position
pos_in_str in string
str matches with one of the symbols in the strings
symbols0 or
symbols1.
Signature:
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols0,const T *symbols1)
Parameters:| const T * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const T * | symbols0 | [IN] | a null-terminated string. |
| const T * | symbols1 | [IN] | a null-terminated string. |
Return value:Returns
true, if a match is found and
false otherwise.
matchsymbol (version 2)
Checks if the character at position
pos_in_str in string
str matches with one of the symbols in the strings
symbols0,
symbols1 or
symbols2.
Signature:
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols0,const T *symbols1,const T *symbols2)
Parameters:| const T * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const T * | symbols0 | [IN] | a null-terminated string. |
| const T * | symbols1 | [IN] | a null-terminated string. |
| const T * | symbols2 | [IN] | a null-terminated string. |
Return value:Returns
true, if a match is found and
false otherwise.
matchsymbol (version 3)
Checks if the character at position
pos_in_str in string
str matches with one of the symbols in the strings
symbols0,
symbols1,
symbols2 or
symbols3.
Signature:
template< class T > bool strman::matchsymbol(const T *str,size_t pos_in_str,const T *symbols0,const T *symbols1,const T *symbols2,const T *symbols3)
Parameters:| const T * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const T * | symbols0 | [IN] | a null-terminated string. |
| const T * | symbols1 | [IN] | a null-terminated string. |
| const T * | symbols2 | [IN] | a null-terminated string. |
| const T * | symbols3 | [IN] | a null-terminated string. |
Return value:Returns
true, if a match is found and
false otherwise.