|
|
|
|
Etk_String
Detailed Description
An object that offers convenient methods to manipulate a string.
TODOC
- Object Hierarchy:
-
- Properties:
- "string": the value of the string
Type: String (char *)Access: Read/WriteDefault Value: NULL
|
Data Structures |
struct | Etk_String |
| [Widget] Etk_String is an object that offers convenient methods to manipulate a string More...
|
Defines |
#define | ETK_STRING_TYPE (etk_string_type_get()) |
#define | ETK_STRING(obj) (ETK_OBJECT_CAST((obj), ETK_STRING_TYPE, Etk_String)) |
#define | ETK_IS_STRING(obj) (ETK_OBJECT_CHECK_TYPE((obj), ETK_STRING_TYPE)) |
Functions |
Etk_String * | etk_string_new (const char *value) |
| Creates a new string.
|
Etk_String * | etk_string_new_sized (const char *value, int size) |
| Creates a new string, with a specific size.
|
Etk_String * | etk_string_new_printf (const char *format,...) |
| Creates a new string, and sets its default value from the given format and arguments.
|
Etk_String * | etk_string_new_vprintf (const char *format, va_list args) |
| Creates a new string, and sets its default value from the given format and arguments.
|
Etk_String * | etk_string_copy (const Etk_String *string) |
| Creates a new string and copies the text from string.
|
const char * | etk_string_get (Etk_String *string) |
| Gets the string as an array of chars.
|
int | etk_string_length_get (Etk_String *string) |
| Gets the length of the string.
|
Etk_String * | etk_string_truncate (Etk_String *string, int length) |
| Truncates the string.
|
Etk_String * | etk_string_delete (Etk_String *string, int pos, int size) |
| Removes from the string a segment of size chars from the position pos.
|
Etk_String * | etk_string_clear (Etk_String *string) |
| Clears the string: all the allocated memory will be freed, and the length of the string will be set to 0.
|
Etk_String * | etk_string_set (Etk_String *string, const char *value) |
| Sets the value of a string.
|
Etk_String * | etk_string_set_sized (Etk_String *string, const char *value, int size) |
| Sets the value of a string, with a specific size.
|
Etk_String * | etk_string_set_printf (Etk_String *string, const char *format,...) |
| Sets the value of the string from the given format and arguments.
|
Etk_String * | etk_string_set_vprintf (Etk_String *string, const char *format, va_list args) |
| Sets the value of the string from the format and the arguments.
|
Etk_String * | etk_string_prepend (Etk_String *string, const char *text) |
| Prepends a text to a string.
|
Etk_String * | etk_string_prepend_sized (Etk_String *string, const char *text, int length) |
| Prepends a text with a specific length to a string.
|
Etk_String * | etk_string_prepend_char (Etk_String *string, char c) |
| Prepends a character to a string.
|
Etk_String * | etk_string_prepend_printf (Etk_String *string, const char *format,...) |
| Prepends a text to the string, from the given format and arguments.
|
Etk_String * | etk_string_prepend_vprintf (Etk_String *string, const char *format, va_list args) |
| Prepends a text to the string, from the given format and arguments.
|
Etk_String * | etk_string_append (Etk_String *string, const char *text) |
| Appends a text to a string.
|
Etk_String * | etk_string_append_sized (Etk_String *string, const char *text, int length) |
| Appends a text with a specific length to a string.
|
Etk_String * | etk_string_append_char (Etk_String *string, char c) |
| Appends a character to a string.
|
Etk_String * | etk_string_append_printf (Etk_String *string, const char *format,...) |
| Appends a text to the string, from the given format and arguments.
|
Etk_String * | etk_string_append_vprintf (Etk_String *string, const char *format, va_list args) |
| Appends a text to the string, from the given format and arguments.
|
Etk_String * | etk_string_insert (Etk_String *string, int pos, const char *text) |
| Inserts a text into a string, at a given position.
|
Etk_String * | etk_string_insert_sized (Etk_String *string, int pos, const char *text, int length) |
| Inserts a text with a specific length into a string, at a given position.
|
Etk_String * | etk_string_insert_char (Etk_String *string, int pos, char c) |
| Inserts a character into a string, at a given position.
|
Etk_String * | etk_string_insert_printf (Etk_String *string, int pos, const char *format,...) |
| Inserts a text into a string, from the given format and arguments, at a given position.
|
Etk_String * | etk_string_insert_vprintf (Etk_String *string, int pos, const char *format, va_list args) |
| Inserts a text into a string, from the given format and arguments, at a given position.
|
Define Documentation
#define ETK_STRING_TYPE (etk_string_type_get()) |
Gets the type of a string
#define ETK_STRING |
( |
obj |
|
) |
(ETK_OBJECT_CAST((obj), ETK_STRING_TYPE, Etk_String)) |
#define ETK_IS_STRING |
( |
obj |
|
) |
(ETK_OBJECT_CHECK_TYPE((obj), ETK_STRING_TYPE)) |
Function Documentation
Etk_String * etk_string_new |
( |
const char * |
value |
) |
|
Creates a new string.
- Parameters:
-
| value | the default value of the string. It can be NULL |
- Returns:
- Returns the new string
Etk_String * etk_string_new_sized |
( |
const char * |
value, |
|
|
int |
size | |
|
) |
| | |
Creates a new string, with a specific size.
- Parameters:
-
| value | the default value of the string. It can be NULL |
| size | If size is lower than the length of value, the value will be truncated. Otherwise, if size is greater than the length of value, extra memory will be allocated. It may be useful if you plan to often insert text and want to avoid too many reallocations. |
- Returns:
- Returns the new string
Etk_String * etk_string_new_printf |
( |
const char * |
format, |
|
|
|
... | |
|
) |
| | |
Creates a new string, and sets its default value from the given format and arguments.
- Parameters:
-
| format | the format to set to the string. It uses the same arguments as printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the new string
Etk_String * etk_string_new_vprintf |
( |
const char * |
format, |
|
|
va_list |
args | |
|
) |
| | |
Creates a new string, and sets its default value from the given format and arguments.
- Parameters:
-
| format | the format to set to the string. It uses the same arguments as printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the new string
Creates a new string and copies the text from string.
- Parameters:
-
| string | the string to copy |
- Returns:
- Returns the new copied string
const char * etk_string_get |
( |
Etk_String * |
string |
) |
|
Gets the string as an array of chars.
- Parameters:
-
| string | a string |
| Returns | the string as an array of chars (i.e a pointer on the first character) |
Gets the length of the string.
- Parameters:
-
- Returns:
- Returns the length of the string
Truncates the string.
- Parameters:
-
| string | a string |
| length | the new length of the string. If length is greater than the current length of the string, the function does nothing |
- Returns:
- Returns the truncated string
Removes from the string a segment of size chars from the position pos.
- Parameters:
-
| string | a string |
| pos | the position where to start the deletion (starting from 0) |
| size | the number of chars to remove |
- Returns:
- Returns the string
Clears the string: all the allocated memory will be freed, and the length of the string will be set to 0.
- Parameters:
-
| string | the string to clear |
- Returns:
- Returns the cleared string
Sets the value of a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| value | the value to assign to the string |
- Returns:
- Returns the string
Sets the value of a string, with a specific size.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| value | the value to assign to the string |
| size | If size is lower than the length of value, the value will be truncated. Otherwise, if size is greater than the length of value, extra memory will be allocated. It may be useful if you plan to often insert text and want to avoid too many reallocations. |
- Returns:
- Returns the string
Sets the value of the string from the given format and arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to set to the string. It uses the same arguments as printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Sets the value of the string from the format and the arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format to set to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
Prepends a text to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to prepend to the string |
- Returns:
- Returns the string
Prepends a text with a specific length to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to prepend to the string |
| length | the length of the text to prepend |
- Returns:
- Returns the string
Prepends a character to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| c | the character to prepend to the string |
- Returns:
- Returns the string
Prepends a text to the string, from the given format and arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format of the text to prepend to the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Prepends a text to the string, from the given format and arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format of the text to prepend to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
Appends a text to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to append to the string |
- Returns:
- Returns the string
Appends a text with a specific length to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| text | the text to append to the string |
| length | the length of the text to append |
- Returns:
- Returns the string
Appends a character to a string.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| c | the character to append to the string |
- Returns:
- Returns the string
Appends a text to the string, from the given format and arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format of the text to append to the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Appends a text to the string, from the given format and arguments.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| format | the format of the text to append to the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
Inserts a text into a string, at a given position.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the text (starting from 0) |
| text | the text to insert into the string |
- Returns:
- Returns the string
Etk_String * etk_string_insert_sized |
( |
Etk_String * |
string, |
|
|
int |
pos, |
|
|
const char * |
text, |
|
|
int |
length | |
|
) |
| | |
Inserts a text with a specific length into a string, at a given position.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the text (starting from 0) |
| text | the text to insert into the string |
| length | the maximum length of the text to insert |
- Returns:
- Returns the string
Inserts a character into a string, at a given position.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the char |
| c | the character to insert into the string |
- Returns:
- Returns the string
Inserts a text into a string, from the given format and arguments, at a given position.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the text |
| format | the format to insert into the string. It uses the same arguments than printf() |
| ... | the arguments corresponding to the format |
- Returns:
- Returns the string
Etk_String * etk_string_insert_vprintf |
( |
Etk_String * |
string, |
|
|
int |
pos, |
|
|
const char * |
format, |
|
|
va_list |
args | |
|
) |
| | |
Inserts a text into a string, from the given format and arguments, at a given position.
- Parameters:
-
| string | a string. If string is NULL, a new string is created |
| pos | the position where to insert the text |
| format | the format to insert into the string. It uses the same arguments than printf() |
| args | the arguments corresponding to the format |
- Returns:
- Returns the string
|
|
|
|
|
|