 |
 |
 |
 |
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()) |
#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 |
) |
|
Etk_String * etk_string_new_sized |
( |
const char * |
value, |
|
|
int |
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.
- 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
References etk_object_new(), ETK_STRING, etk_string_set_vprintf(), and ETK_STRING_TYPE.
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
References etk_object_new(), ETK_STRING, etk_string_set_vprintf(), and ETK_STRING_TYPE.
const char * etk_string_get |
( |
Etk_String * |
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
References etk_string_truncate(), length, and string.
Referenced by etk_textblock_delete_range().
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
References allocated_length, ETK_OBJECT, etk_object_notify(), etk_string_clear(), etk_string_new_sized(), length, and string.
Referenced by etk_string_new_sized(), etk_string_set(), and etk_textblock2_insert_markup().
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
References etk_string_set_vprintf().
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
References etk_string_insert().
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
References etk_string_insert_sized().
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
References etk_string_insert_char().
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
References etk_string_prepend_vprintf().
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
References etk_string_insert_vprintf().
Referenced by etk_string_prepend_printf().
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
References etk_string_insert(), and length.
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
References etk_string_insert_sized(), and length.
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
References etk_string_insert_char(), and length.
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
References etk_string_append_vprintf().
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
References etk_string_insert_vprintf(), and length.
Referenced by etk_string_append_printf().
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
References allocated_length, ETK_CLAMP, ETK_OBJECT, etk_object_notify(), etk_string_new_sized(), length, and string.
Referenced by etk_string_append_sized(), etk_string_insert(), etk_string_prepend_sized(), etk_textblock2_insert(), and etk_textblock_insert().
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
References allocated_length, ETK_CLAMP, ETK_OBJECT, etk_object_notify(), etk_string_new(), etk_string_truncate(), length, and string.
Referenced by etk_string_append_char(), and etk_string_prepend_char().
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
References etk_string_insert_vprintf().
Etk_String * etk_string_insert_vprintf |
( |
Etk_String * |
string, |
|
|
int |
pos, |
|
|
const char * |
format, |
|
|
va_list |
args | |
|
) |
| | |
|
 |
 |
 |
 |
|