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
char **strman::explode(const char *sep,const char *str)
explode_free
void strman::explode_free(char **explosion_parts)
findItem
int strman::findItem(const char *item,char **explosion_parts)
getItem
char *strman::getItem(int index,char **explosion_parts)
level2
level2_create
char **strman::level2_create(int ln,char ***itemlist)
nvlist
nvlist_create
bool strman::nvlist_create(char ***names,char ***values,int ln)
nvlist_free
void strman::nvlist_free(char **names,char **values)
nvlist_add
bool strman::nvlist_add(char **names,char **values,const char *item_name)
nvlist_add_if_missing
bool strman::nvlist_add_if_missing(char **names,char **values,const char *item_name)
nvlist_remove
bool strman::nvlist_remove(char **names,char **values,const char *item_name)
nvlist_get
char *strman::nvlist_get(char **names,char **values,const char *item_name)
nvlist_set
bool strman::nvlist_set(char **names,char **values,const char *item_name,const char *item_value)
multistr
nullconcat
char *strman::nullconcat(char *a,char *b)
nullcopy
char *strman::nullcopy(char *a,char *b)
isprefix, issuffix, ...
isprefix
bool strman::isprefix(const char *a,const char *b)
issuffix
bool strman::issuffix(const char *a,const char *b)
issubstr
bool strman::issubstr(const char *a,const char *b)
findsubstr
unsigned int strman::findsubstr(const char *a,const char *b)
substrmatch
bool strman::substrmatch(const char *searchpat,const char *text)
matchpat
bool strman::matchpat(char *a,char *b)
matchpat_i
bool strman::matchpat_i(char *a,char *b,unsigned int pos_a,unsigned int pos_b)
matchsymbol
matchsymbol (version 1)
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols0,const char *symbols1)
matchsymbol (version 2)
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols0,const char *symbols1,const char *symbols2)
matchsymbol (version 3)
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols0,const char *symbols1,const char *symbols2,const char *symbols3)
Static Template Methods
explode
Explodes a string by a separator character.
Signature:
char **strman::explode(const char *sep,const char *str)
Parameters:| const char * | sep | [IN] | One or more separator characters (as null-terminated string). |
| const char * | 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:
int strman::explode_count(char **explosion_parts)
Parameters:| char ** | 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:
void strman::explode_free(char **explosion_parts)
Parameters:| char ** | 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:
int strman::findItem(const char *item,char **explosion_parts)
Parameters:| const char * | item | [IN] | the null-terminated string to be searched for within the substrings generated by explode(). |
| char ** | 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:
char *strman::getItem(int index,char **explosion_parts)
Parameters:| int | index | | a index position of a substring within the substrings generated by explode(). |
| char ** | 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:
char **strman::level2_create(int ln,char ***itemlist)
Parameters:| int | ln | | ln |
| char *** | 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:
void strman::level2_free(char **itemlist)
Parameters:| char ** | itemlist | [IN] | itemlist |
level2_replaceItem_realloc
Signature:
bool strman::level2_replaceItem_realloc(char **itemlist,const char *old_item,const char *new_item)
Parameters:| char ** | itemlist | [IN] | itemlist |
| const char * | old_item | [IN] | old_item |
| const char * | new_item | [IN] | new_item |
level2_setItem_realloc
Signature:
bool strman::level2_setItem_realloc(int itemid,char **itemlist,const char *item)
Parameters:| int | itemid | | itemid |
| char ** | itemlist | [IN] | itemlist |
| const char * | item | [IN] | item |
level2_setItem_malloc
Signature:
bool strman::level2_setItem_malloc(int itemid,char **itemlist,const char *item)
Parameters:| int | itemid | | itemid |
| char ** | itemlist | [IN] | itemlist |
| const char * | item | [IN] | item |
level2_addItem_malloc
Signature:
bool strman::level2_addItem_malloc(char **itemlist,const char *item)
Parameters:| char ** | itemlist | [IN] | itemlist |
| const char * | item | [IN] | item |
level2_freeItem
Signature:
bool strman::level2_freeItem(int itemid,char **itemlist)
Parameters:| int | itemid | | itemid |
| char ** | itemlist | [IN] | itemlist |
nvlist_create
Signature:
bool strman::nvlist_create(char ***names,char ***values,int ln)
Parameters:| char *** | names | [IN] | names |
| char *** | values | [IN] | values |
| int | ln | | ln |
nvlist_free
Signature:
void strman::nvlist_free(char **names,char **values)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
nvlist_add
Signature:
bool strman::nvlist_add(char **names,char **values,const char *item_name)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
| const char * | item_name | [IN] | item_name |
nvlist_add_if_missing
Signature:
bool strman::nvlist_add_if_missing(char **names,char **values,const char *item_name)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
| const char * | item_name | [IN] | item_name |
nvlist_remove
Signature:
bool strman::nvlist_remove(char **names,char **values,const char *item_name)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
| const char * | item_name | [IN] | item_name |
nvlist_get
Signature:
char *strman::nvlist_get(char **names,char **values,const char *item_name)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
| const char * | item_name | [IN] | item_name |
nvlist_set
Signature:
bool strman::nvlist_set(char **names,char **values,const char *item_name,const char *item_value)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
| const char * | item_name | [IN] | item_name |
| const char * | item_value | [IN] | item_value |
nvlist_print_all
Signature:
void strman::nvlist_print_all(char **names,char **values)
Parameters:| char ** | names | [IN] | names |
| char ** | values | [IN] | values |
nullconcat
Signature:
char *strman::nullconcat(char *a,char *b)
Parameters:| char * | a | [IN] | a |
| char * | b | [IN] | b |
nullcopy
Signature:
char *strman::nullcopy(char *a,char *b)
Parameters:| char * | a | [IN] | a |
| char * | b | [IN] | b |
nullcopy_new
Signature:
char *strman::nullcopy_new(char **a,char *b)
Parameters:| char ** | a | [IN] | a |
| char * | b | [IN] | b |
isprefix
Signature:
bool strman::isprefix(const char *a,const char *b)
Parameters:| const char * | a | [IN] | a |
| const char * | b | [IN] | b |
issuffix
Signature:
bool strman::issuffix(const char *a,const char *b)
Parameters:| const char * | a | [IN] | a |
| const char * | b | [IN] | b |
issubstr
Signature:
bool strman::issubstr(const char *a,const char *b)
Parameters:| const char * | a | [IN] | a |
| const char * | b | [IN] | b |
findsubstr
Signature:
unsigned int strman::findsubstr(const char *a,const char *b)
Parameters:| const char * | a | [IN] | a |
| const char * | b | [IN] | b |
substrmatch
Signature:
bool strman::substrmatch(const char *searchpat,const char *text)
Parameters:| const char * | searchpat | [IN] | searchpat |
| const char * | text | [IN] | text |
matchpat
Signature:
bool strman::matchpat(char *a,char *b)
Parameters:| char * | a | [IN] | a |
| char * | b | [IN] | b |
matchpat_i
Signature:
bool strman::matchpat_i(char *a,char *b,unsigned int pos_a,unsigned int pos_b)
Parameters:| char * | a | [IN] | a |
| char * | 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:
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols)
Parameters:| const char * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const char * | 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:
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols0,const char *symbols1)
Parameters:| const char * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const char * | symbols0 | [IN] | a null-terminated string. |
| const char * | 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:
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols0,const char *symbols1,const char *symbols2)
Parameters:| const char * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const char * | symbols0 | [IN] | a null-terminated string. |
| const char * | symbols1 | [IN] | a null-terminated string. |
| const char * | 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:
bool strman::matchsymbol(const char *str,size_t pos_in_str,const char *symbols0,const char *symbols1,const char *symbols2,const char *symbols3)
Parameters:| const char * | str | [IN] | a null-terminated string. |
| size_t | pos_in_str | | index within the string str. |
| const char * | symbols0 | [IN] | a null-terminated string. |
| const char * | symbols1 | [IN] | a null-terminated string. |
| const char * | symbols2 | [IN] | a null-terminated string. |
| const char * | symbols3 | [IN] | a null-terminated string. |
Return value:Returns
true, if a match is found and
false otherwise.