Tizen Native API
|
Functions | |
Eina_Strbuf * | eina_strbuf_new (void) |
Creates a new string buffer. | |
Eina_Strbuf * | eina_strbuf_manage_new (char *str) |
Creates a new string buffer using the passed string. The passed string is used directly as the buffer, it's somehow the opposite function of eina_strbuf_string_steal. The passed string must be malloced. | |
Eina_Strbuf * | eina_strbuf_manage_new_length (char *str, size_t length) |
Creates a new string buffer using the passed string. The passed string is used directly as the buffer, it's somehow the opposite function of eina_strbuf_string_steal. The passed string must be malloced. | |
void | eina_strbuf_free (Eina_Strbuf *buf) |
Frees a string buffer. | |
void | eina_strbuf_reset (Eina_Strbuf *buf) |
Resets a string buffer. | |
Eina_Bool | eina_strbuf_append (Eina_Strbuf *buf, const char *str) |
Appends a string to a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_append_escaped (Eina_Strbuf *buf, const char *str) |
Appends an escaped string to a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_append_n (Eina_Strbuf *buf, const char *str, size_t maxlen) |
Appends a string to a buffer, reallocating as necessary, limited by the given length. | |
Eina_Bool | eina_strbuf_append_length (Eina_Strbuf *buf, const char *str, size_t length) |
Appends a string of exact length to a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_append_char (Eina_Strbuf *buf, char c) |
Appends a character to a string buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_append_printf (Eina_Strbuf *buf, const char *fmt,...) |
Appends a string to a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_append_vprintf (Eina_Strbuf *buf, const char *fmt, va_list args) |
Appends a string to a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert (Eina_Strbuf *buf, const char *str, size_t pos) |
Inserts a string into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_escaped (Eina_Strbuf *buf, const char *str, size_t pos) |
Inserts an escaped string into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_n (Eina_Strbuf *buf, const char *str, size_t maxlen, size_t pos) |
Inserts a string into a buffer, reallocating as necessary. Limited by maxlen. | |
Eina_Bool | eina_strbuf_insert_length (Eina_Strbuf *buf, const char *str, size_t length, size_t pos) |
Inserts a string of exact length into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_char (Eina_Strbuf *buf, char c, size_t pos) |
Inserts a character into a string buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_printf (Eina_Strbuf *buf, const char *fmt, size_t pos,...) |
Inserts a string into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_vprintf (Eina_Strbuf *buf, const char *fmt, size_t pos, va_list args) |
Inserts a string into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_remove (Eina_Strbuf *buf, size_t start, size_t end) |
Removes a slice of the given string buffer. | |
const char * | eina_strbuf_string_get (const Eina_Strbuf *buf) |
Gets a pointer to the contents of a string buffer. | |
char * | eina_strbuf_string_steal (Eina_Strbuf *buf) |
Steals the contents of a string buffer. | |
void | eina_strbuf_string_free (Eina_Strbuf *buf) |
Frees the contents of a string buffer but not the buffer. | |
size_t | eina_strbuf_length_get (const Eina_Strbuf *buf) |
Gets the length of the string buffer's content. | |
Eina_Bool | eina_strbuf_replace (Eina_Strbuf *buf, const char *str, const char *with, unsigned int n) |
Replaces the nth string with another string. | |
int | eina_strbuf_replace_all (Eina_Strbuf *buf, const char *str, const char *with) |
Replaces all strings with another string. | |
void | eina_strbuf_trim (Eina_Strbuf *buf) |
Trims the string buffer. | |
void | eina_strbuf_ltrim (Eina_Strbuf *buf) |
Left trims the string buffer. | |
void | eina_strbuf_rtrim (Eina_Strbuf *buf) |
Right trims the string buffer. | |
Typedefs | |
typedef struct _Eina_Strbuf | Eina_Strbuf |
The structure type for a string buffer. | |
Defines | |
#define | eina_strbuf_prepend(buf, str) eina_strbuf_insert(buf, str, 0) |
Prepends the given string to the given buffer. | |
#define | eina_strbuf_prepend_escaped(buf, str) eina_strbuf_insert_escaped(buf, str, 0) |
Prepends the given escaped string to the given buffer. | |
#define | eina_strbuf_prepend_n(buf, str, maxlen) eina_strbuf_insert_n(buf, str, maxlen, 0) |
Prepends the given escaped string to the given buffer. | |
#define | eina_strbuf_prepend_length(buf, str, length) eina_strbuf_insert_length(buf, str, length, 0) |
Prepends the given escaped string to the given buffer. | |
#define | eina_strbuf_prepend_char(buf, c) eina_strbuf_insert_char(buf, c, 0) |
Prepends the given character to the given buffer. | |
#define | eina_strbuf_prepend_printf(buf, fmt,...) eina_strbuf_insert_printf(buf, fmt, 0, ## __VA_ARGS__) |
Prepends the given string to the given buffer. | |
#define | eina_strbuf_prepend_vprintf(buf, fmt, args) eina_strbuf_insert_vprintf(buf, fmt, 0, args) |
Prepends the given string to the given buffer. | |
#define | eina_strbuf_replace_first(buf, str, with) eina_strbuf_replace(buf, str, with, 1) |
Prepends the given character to the given buffer. |
This group discusses the functions that provide string buffers management.
#define eina_strbuf_prepend | ( | buf, | |
str | |||
) | eina_strbuf_insert(buf, str, 0) |
Prepends the given string to the given buffer.
This macro calls eina_strbuf_insert() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
str | The string to prepend |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure #define eina_strbuf_prepend_char | ( | buf, | |
c | |||
) | eina_strbuf_insert_char(buf, c, 0) |
Prepends the given character to the given buffer.
This macro calls eina_strbuf_insert_char() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
c | The character to prepend |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure. #define eina_strbuf_prepend_escaped | ( | buf, | |
str | |||
) | eina_strbuf_insert_escaped(buf, str, 0) |
Prepends the given escaped string to the given buffer.
This macro calls eina_strbuf_insert_escaped() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
str | The string to prepend |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure #define eina_strbuf_prepend_length | ( | buf, | |
str, | |||
length | |||
) | eina_strbuf_insert_length(buf, str, length, 0) |
Prepends the given escaped string to the given buffer.
This macro calls eina_strbuf_insert_length() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
str | The string to prepend |
length | The exact length to use |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure #define eina_strbuf_prepend_n | ( | buf, | |
str, | |||
maxlen | |||
) | eina_strbuf_insert_n(buf, str, maxlen, 0) |
Prepends the given escaped string to the given buffer.
This macro calls eina_strbuf_insert_n() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
str | The string to prepend |
maxlen | The maximum number of chars to prepend |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure #define eina_strbuf_prepend_printf | ( | buf, | |
fmt, | |||
... | |||
) | eina_strbuf_insert_printf(buf, fmt, 0, ## __VA_ARGS__) |
Prepends the given string to the given buffer.
This macro calls eina_strbuf_insert_printf() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
fmt | The string to prepend |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure #define eina_strbuf_prepend_vprintf | ( | buf, | |
fmt, | |||
args | |||
) | eina_strbuf_insert_vprintf(buf, fmt, 0, args) |
Prepends the given string to the given buffer.
This macro calls eina_strbuf_insert_vprintf() at position 0. If buf can't prepend it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to prepend to |
fmt | The string to prepend |
args | The variable arguments |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure #define eina_strbuf_replace_first | ( | buf, | |
str, | |||
with | |||
) | eina_strbuf_replace(buf, str, with, 1) |
Prepends the given character to the given buffer.
This macro calls eina_strbuf_replace() with the nth occurrence equal to 1
. If buf can't replace it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
buf | The string buffer to work with |
str | The string to replace |
with | The string to replace with |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_append | ( | Eina_Strbuf * | buf, |
const char * | str | ||
) |
Appends a string to a buffer, reallocating as necessary.
This function appends str to buf. It computes the length of str, so is slightly slower than eina_strbuf_append_length(). If the length is known beforehand, consider using that variant. If buf can't append it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to append to |
[in] | str | The string to append |
EINA_TRUE
on success, otherwise EINA_FALSE
on failureEina_Bool eina_strbuf_append_char | ( | Eina_Strbuf * | buf, |
char | c | ||
) |
Appends a character to a string buffer, reallocating as necessary.
This function inserts c to buf. If it cannot insert it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to append to |
[in] | c | The character to append |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_append_escaped | ( | Eina_Strbuf * | buf, |
const char * | str | ||
) |
Appends an escaped string to a buffer, reallocating as necessary.
This function escapes and then appends the string str to buf. If str cannot be appended, EINA_FALSE
is returned, otherwise, EINA_TRUE
is returned.
[in] | buf | The string buffer to append to |
[in] | str | The string to append |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_append_length | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | length | ||
) |
Appends a string of exact length to a buffer, reallocating as necessary.
This function appends str to buf. str must be at most of size length. It is slightly faster than eina_strbuf_append() as it does not compute the size of str. It is useful when dealing with strings of known size, such as eina_stringshare. If buf can't append it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to append to |
[in] | str | The string to append |
[in] | length | The exact length to use |
EINA_TRUE
on success, otherwise EINA_FALSE
on failureEina_Bool eina_strbuf_append_n | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | maxlen | ||
) |
Appends a string to a buffer, reallocating as necessary, limited by the given length.
This function appends at most maxlen characters of str to buf. It can't append more than the length of str. It computes the length of str, so it is slightly slower than eina_strbuf_append_length(). If the length is known beforehand, consider using that variant (maxlen should then be checked so that it is greater than the size of str). If str cannot be appended, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to append to |
[in] | str | The string to append |
[in] | maxlen | The maximum number of characters to append |
EINA_TRUE
on success, otherwise EINA_FALSE
on failureEina_Bool eina_strbuf_append_printf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
... | |||
) |
Appends a string to a buffer, reallocating as necessary.
This function appends the string defined by the format fmt to buf. fmt must be of a valid format from the printf family of functions. If it can't insert it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to append to |
[in] | fmt | The string to append |
EINA_TRUE
on success, otherwise EINA_FALSE
on failureEina_Bool eina_strbuf_append_vprintf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
va_list | args | ||
) |
Appends a string to a buffer, reallocating as necessary.
[in] | buf | The string buffer to append to |
[in] | fmt | The string to append |
[in] | args | The variable arguments |
EINA_TRUE
on success, otherwise EINA_FALSE
on failurevoid eina_strbuf_free | ( | Eina_Strbuf * | buf | ) |
Frees a string buffer.
This function frees the memory of buf. buf must have been created by eina_strbuf_new().
[in] | buf | The string buffer to free |
Eina_Bool eina_strbuf_insert | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | pos | ||
) |
Inserts a string into a buffer, reallocating as necessary.
This function inserts str into buf at position pos. It computes the length of str, so is slightly slower than eina_strbuf_insert_length(). If the length is known beforehand, consider using that variant. If buf can't insert it, EINA_FALSE
[in] | buf | The string buffer to insert into |
[in] | str | The string to insert |
[in] | pos | The position at which to insert the string |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_insert_char | ( | Eina_Strbuf * | buf, |
char | c, | ||
size_t | pos | ||
) |
Inserts a character into a string buffer, reallocating as necessary.
This function inserts c into buf at position pos. If buf can't append it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to insert into |
[in] | c | The character to insert |
[in] | pos | The position at which to insert the char |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_insert_escaped | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | pos | ||
) |
Inserts an escaped string into a buffer, reallocating as necessary.
This function escapes and inserts the string str into buf at position pos. If buf can't insert str, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to insert into |
[in] | str | The string to insert |
[in] | pos | The position at which to insert the string |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_insert_length | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | length, | ||
size_t | pos | ||
) |
Inserts a string of exact length into a buffer, reallocating as necessary.
This function inserts str into buf. str must be at most of size length. It is slightly faster than eina_strbuf_insert() as it does not compute the size of str. It is useful when dealing with strings of known size, such as eina_strngshare. If buf can't insert it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to insert into |
[in] | str | The string to insert |
[in] | length | The exact length to use |
[in] | pos | The position at which to insert the string |
EINA_TRUE
on success, otherwise EINA_FALSE
on failureEina_Bool eina_strbuf_insert_n | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | maxlen, | ||
size_t | pos | ||
) |
Inserts a string into a buffer, reallocating as necessary. Limited by maxlen.
This function inserts str into buf at position pos, with at most maxlen bytes. The number of inserted characters cannot be greater than the length of str. It computes the length of str, so is slightly slower than eina_strbuf_insert_length(). If the length is known beforehand, consider using that variant (maxlen should then be checked so that it is greater than the size of str). If str cannot be inserted, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to insert into |
[in] | str | The string to insert |
[in] | maxlen | The maximum number of chars to insert |
[in] | pos | The position at which to insert the string |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_insert_printf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
size_t | pos, | ||
... | |||
) |
Inserts a string into a buffer, reallocating as necessary.
This function inserts a string as described by the format fmt into buf at the position pos. fmt must be of a valid format from the printf family of functions. If it can't insert it, EINA_FALSE
is returned, otherwise EINA_TRUE
is returned.
[in] | buf | The string buffer to insert into |
[in] | fmt | The string to insert |
[in] | pos | The position at which to insert the string |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_insert_vprintf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
size_t | pos, | ||
va_list | args | ||
) |
Inserts a string into a buffer, reallocating as necessary.
[in] | buf | The string buffer to insert into |
[in] | fmt | The string to insert |
[in] | pos | The position at which to insert the string |
[in] | args | The variable arguments |
EINA_TRUE
on success, otherwise EINA_FALSE
on failuresize_t eina_strbuf_length_get | ( | const Eina_Strbuf * | buf | ) |
Gets the length of the string buffer's content.
This function returns the length of buf.
[in] | buf | The string buffer |
void eina_strbuf_ltrim | ( | Eina_Strbuf * | buf | ) |
Left trims the string buffer.
This function skips whitespaces at the beginning of the buffer.
[in] | buf | The string buffer to work with |
Eina_Strbuf* eina_strbuf_manage_new | ( | char * | str | ) |
Creates a new string buffer using the passed string. The passed string is used directly as the buffer, it's somehow the opposite function of eina_strbuf_string_steal. The passed string must be malloced.
This function creates a new string buffer. On error, NULL
is returned and Eina error is set to EINA_ERROR_OUT_OF_MEMORY. To free the resources, use eina_strbuf_free().
[in] | str | The string to manage |
Eina_Strbuf* eina_strbuf_manage_new_length | ( | char * | str, |
size_t | length | ||
) |
Creates a new string buffer using the passed string. The passed string is used directly as the buffer, it's somehow the opposite function of eina_strbuf_string_steal. The passed string must be malloced.
This function creates a new string buffer. On error, NULL
is returned and Eina error is set to EINA_ERROR_OUT_OF_MEMORY. To free the resources, use eina_strbuf_free().
[in] | str | The string to manage |
[in] | length | The length of the string |
Eina_Strbuf* eina_strbuf_new | ( | void | ) |
Creates a new string buffer.
This function creates a new string buffer. On error, NULL
is returned and Eina error is set to EINA_ERROR_OUT_OF_MEMORY. To free the resources, use eina_strbuf_free().
Eina_Bool eina_strbuf_remove | ( | Eina_Strbuf * | buf, |
size_t | start, | ||
size_t | end | ||
) |
Removes a slice of the given string buffer.
This function removes a slice of buf, starting from start (inclusive) and ending at end (non-inclusive). Both the values are in bytes. It returns EINA_FALSE
on failure, otherwise it returns EINA_TRUE
.
buf | The string buffer to remove a slice of |
start | The initial (inclusive) slice position to start removing from, in bytes |
end | The final (non-inclusive) slice position to finish removing at, in bytes |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure Eina_Bool eina_strbuf_replace | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
const char * | with, | ||
unsigned int | n | ||
) |
Replaces the nth string with another string.
This function replaces the nth occurrence of str in buf with with. It returns EINA_FALSE
on failure, otherwise EINA_TRUE
.
[in] | buf | The string buffer to work with |
[in] | str | The string to replace |
[in] | with | The string to replace with |
[in] | n | The number of the fitting string |
EINA_TRUE
on success, otherwise EINA_FALSE
on failure int eina_strbuf_replace_all | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
const char * | with | ||
) |
Replaces all strings with another string.
This function replaces all the occurrences of str in buf with the string with. This function returns the number of times str has been replaced. On failure, it returns 0
.
[in] | buf | The string buffer to work with |
[in] | str | The string to replace |
[in] | with | The string to replace with |
void eina_strbuf_reset | ( | Eina_Strbuf * | buf | ) |
Resets a string buffer.
This function resets buf: the buffer length is set to 0, and the string is set to '\0'. No memory is freed.
[in] | buf | The string buffer to reset |
void eina_strbuf_rtrim | ( | Eina_Strbuf * | buf | ) |
Right trims the string buffer.
This function skips whitespaces at the end of the buffer.
[in] | buf | The string buffer to work with |
void eina_strbuf_string_free | ( | Eina_Strbuf * | buf | ) |
Frees the contents of a string buffer but not the buffer.
This function frees the string contained in buf without freeing buf.
[in] | buf | The string buffer to free the string from |
const char* eina_strbuf_string_get | ( | const Eina_Strbuf * | buf | ) |
Gets a pointer to the contents of a string buffer.
This function returns the string contained in buf. The returned value must not be modified as it is longer valid if buf is modified. In other words, any eina_strbuf_append() or similar makes that pointer invalid. The pointer returned by this function must not be freed.
[in] | buf | The string buffer |
char* eina_strbuf_string_steal | ( | Eina_Strbuf * | buf | ) |
Steals the contents of a string buffer.
This function returns the string contained in buf. buf is then initialized and does not own the returned string anymore. The caller must release the memory of the returned string by calling free().
[in] | buf | The string buffer to steal from |
void eina_strbuf_trim | ( | Eina_Strbuf * | buf | ) |
Trims the string buffer.
This function skips whitespaces at the beginning and the end of the buffer.
[in] | buf | The string buffer to work with |