This documenta- tion describes the current state of development.
Note that interfaces and functionality may still change.

Prokee Modules:
  A
  B
  C
  D
  E
  F
  G
  I
  L
  M
  N
  O
  P
  R
  S
  T
  U
  W

     open all    |    close all

GUI Elements:
  B
  C
  I
  M
  P
  R
  S
  T

     open all    |    close all

GUI Interactions:
  B
  F
  H
  S

     open all    |    close all

GUI Layouts:
  L

     open all    |    close all

Games/Demos:
  M

     open all    |    close all

Third Party Libraries:
  P
  F
  Z

     open all    |    close all

Information about this Website / Informationen zu dieser Webseite:
In case of any questions, or comments, please feel free to contact me via email at apoll500@gmail.com.

Module explode [Version: v01]

This documentation describes the Prokee module interface.

Templates

Show templates with parameter T set to: (T), (char), (char16_t), (char32_t), (wchar_t )


Static Methods:
cssval
char **explode::cssval(const char *str)
cssval2
char ***explode::cssval2(const char *str)
cssval2_free
void explode::cssval2_free(char ***b)
prepare_cssvalradius4
char *explode::prepare_cssvalradius4(const char *str)
tokenstr
char **explode::tokenstr(char sep,const char *str,const char **tokens,char suffix)

Static Template Methods:
expl
char16_t **explode::expl(const char16_t *sep,const char16_t *str)
count
int explode::count(char16_t **explosion_parts)
destroy
void explode::destroy(char16_t **explosion_parts)
find
int explode::find(const char16_t *item,char16_t **explosion_parts)
get
char16_t *explode::get(int index,char16_t **explosion_parts)

Motivation


Static Methods

   cssval


Explodes a combined css value string.

Signature:
char **explode::cssval(const char *str)

Parameters:
Type Name Direction Description
const char *str

Return value:
Pointer to a (null-terminated) series of pointers of the generated substrings.

   cssval2


Explodes a combined css value string with optional slash separation for two dimensions. (Only the first slash is recognized as separator. The function will never return more than two blocks.)

Signature:
char ***explode::cssval2(const char *str)

Parameters:
Type Name Direction Description
const char *str

Return value:
...

   cssval2_free


Frees substrings returned by function explode::cssval2().

Signature:
void explode::cssval2_free(char ***b)

Parameters:
Type Name Direction Description
char ***bReturn value from function explode::cssval2().

   prepare_cssvalradius4


Example: The string "5px 3px 2px / 1px 7px" is translated to "5px|1px 3px|7px 2px|1px 3px|7px".
This can be used to process the css value for the border-radius shorthand. The returned string contains pairs of radii of the four corners.

Signature:
char *explode::prepare_cssvalradius4(const char *str)

Parameters:
Type Name Direction Description
const char *str

Return value:
...

   tokenstr


Explodes a string of concatenated tokens and strings.

This function may return a NULL pointer, if no tokens or strings are fond.

Signature:
char **explode::tokenstr(char sep,const char *str,const char **tokens,char suffix)

Parameters:
Type Name Direction Description
char sep
const char *str
const char **tokens
char suffix

Return value:
...


Static Template Methods

   expl


Explodes a string by a separator character.

Signature:
char16_t **explode::expl(const char16_t *sep,const char16_t *str)

Parameters:
Type Name Direction Description
const char16_t *sep[IN]One or more separator characters (as null-terminated string).
const char16_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=explode::expl(",;","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=explode::expl("#","HELLO#WORLD#!");
The substrings are copied into one single buffer as illustrated below.



   count


Counts the number of substrings generated by expl().

Signature:
int explode::count(char16_t **explosion_parts)

Parameters:
Type Name Direction Description
char16_t **explosion_parts[IN]The pointers to substrings, as returned by explode().

Return value:
The number of substrings.

   destroy


Frees the buffers allocated by expl().

Signature:
void explode::destroy(char16_t **explosion_parts)

Parameters:
Type Name Direction Description
char16_t **explosion_parts[IN]The pointers to substrings, as returned by explode().

   find


Searches for a string within the list of substrings generated by explode().

Signature:
int explode::find(const char16_t *item,char16_t **explosion_parts)

Parameters:
Type Name Direction Description
const char16_t *item[IN]the null-terminated string to be searched for within the substrings generated by explode().
char16_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.

   get


Returns the substring given by its index within the substrings generated by explode().

Signature:
char16_t *explode::get(int index,char16_t **explosion_parts)

Parameters:
Type Name Direction Description
int indexa index position of a substring within the substrings generated by explode().
char16_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.


Copyright © 2017 - 2019 by Andreas Pollhammer