Tizen Native API
5.5
|
These functions provide string buffer management.
The String Buffer data type is designed to be a mutable string, allowing the appending, prepending or insertion of a string to a buffer.
For more information see this example.
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. | |
Eina_Strbuf * | eina_strbuf_manage_new_length (char *str, size_t length) |
Creates a new string buffer using the passed string. | |
Eina_Strbuf * | eina_strbuf_manage_read_only_new_length (const char *str, size_t length) |
Creates a new string buffer using the passed string. | |
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_slice (Eina_Strbuf *buf, const Eina_Slice slice) |
Append a slice to a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_append_buffer (Eina_Strbuf *buf, const Eina_Strbuf *data) |
Appends an Eina_Strbuf 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 data elements to a buffer using printf-style formatting. | |
Eina_Bool | eina_strbuf_append_vprintf (Eina_Strbuf *buf, const char *fmt, va_list args) |
Appends data elements to a string buffer using a va_list. | |
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 of a maximum length into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_length (Eina_Strbuf *buf, const char *str, size_t length, size_t pos) |
Inserts a string of an exact length into a buffer, reallocating as necessary. | |
Eina_Bool | eina_strbuf_insert_slice (Eina_Strbuf *buf, const Eina_Slice slice, size_t pos) |
Insert a slice 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 data elements into a buffer using printf-style formatting. | |
Eina_Bool | eina_strbuf_insert_vprintf (Eina_Strbuf *buf, const char *fmt, size_t pos, va_list args) |
Inserts data elements into a buffer using a va_list. | |
Eina_Bool | eina_strbuf_remove (Eina_Strbuf *buf, size_t start, size_t end) |
Removes a section from the given string buffer. | |
const char * | eina_strbuf_string_get (const Eina_Strbuf *buf) |
Retrieves 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) |
Retrieves 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 a substring in the buffer with another string. | |
int | eina_strbuf_replace_all (Eina_Strbuf *buf, const char *str, const char *with) |
Replaces all matching substrings 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. | |
void | eina_strbuf_tolower (Eina_Strbuf *buf) |
Converts the string to lower case. | |
Eina_Strbuf * | eina_strbuf_substr_get (Eina_Strbuf *buf, size_t pos, size_t len) |
Obtains substring from a source string buffer. | |
Eina_Slice | eina_strbuf_slice_get (const Eina_Strbuf *buf) |
Gets a read-only slice of the buffer contents. | |
Eina_Rw_Slice | eina_strbuf_rw_slice_get (const Eina_Strbuf *buf) |
Gets a read-write slice of the buffer contents. | |
char * | eina_strbuf_release (Eina_Strbuf *buf) |
Frees the buffer, returning its old contents. | |
Eina_Bool | eina_strbuf_append_strftime (Eina_Strbuf *buf, const char *fmt, const struct tm *tm) |
Appends a strftime-style timestamp to the buffer. | |
Eina_Bool | eina_strbuf_insert_strftime (Eina_Strbuf *buf, const char *fmt, const struct tm *tm, size_t pos) |
Inserts a strftime-style timestamp into the buffer. | |
Typedefs | |
typedef struct _Eina_Strbuf | Eina_Strbuf |
Defines | |
#define | eina_strbuf_prepend(buf, str) eina_strbuf_insert(buf, str, 0) |
Prepends a string to the given buffer. | |
#define | eina_strbuf_prepend_escaped(buf, str) eina_strbuf_insert_escaped(buf, str, 0) |
Prepends an escaped string to the given buffer. | |
#define | eina_strbuf_prepend_n(buf, str, maxlen) eina_strbuf_insert_n(buf, str, maxlen, 0) |
Prepends an escaped string to the given buffer. | |
#define | eina_strbuf_prepend_length(buf, str, length) eina_strbuf_insert_length(buf, str, length, 0) |
Prepends an escaped string to the given buffer. | |
#define | eina_strbuf_prepend_char(buf, c) eina_strbuf_insert_char(buf, c, 0) |
Prepends a character to the given buffer. | |
#define | eina_strbuf_prepend_printf(buf, fmt,...) eina_strbuf_insert_printf(buf, fmt, 0, ## __VA_ARGS__) |
Prepends data elements to the given buffer using printf-style formatting. | |
#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) |
Replaces the first occurrence of a substring with another string. | |
#define | eina_strbuf_prepend_strftime(buf, fmt, tm) eina_strbuf_insert_strftime(buf, fmt, tm, 0) |
Prepends a strftime-style timestamp to the buffer. |
#define eina_strbuf_prepend | ( | buf, | |
str | |||
) | eina_strbuf_insert(buf, str, 0) |
Prepends a string to the given buffer.
[in,out] | buf | The string buffer. |
[in] | str | The string to prepend. |
str
could not be prepended.This macro simply calls eina_strbuf_insert() with position 0.
#define eina_strbuf_prepend_char | ( | buf, | |
c | |||
) | eina_strbuf_insert_char(buf, c, 0) |
Prepends a character to the given buffer.
[in,out] | buf | The string buffer. |
[in] | c | The character to prepend. |
This macro simply calls eina_strbuf_insert_char() with position 0.
#define eina_strbuf_prepend_escaped | ( | buf, | |
str | |||
) | eina_strbuf_insert_escaped(buf, str, 0) |
Prepends an escaped string to the given buffer.
[in,out] | buf | The string buffer. |
[in] | str | The string to prepend. |
str
could not be prepended.This macro simply calls eina_strbuf_insert_escaped() with position 0.
#define eina_strbuf_prepend_length | ( | buf, | |
str, | |||
length | |||
) | eina_strbuf_insert_length(buf, str, length, 0) |
Prepends an escaped string to the given buffer.
[in,out] | buf | The string buffer. |
[in] | str | The string to prepend. |
[in] | length | The exact length to use. |
str
could not be prepended.This macro simply calls eina_strbuf_insert_length() with position 0.
#define eina_strbuf_prepend_n | ( | buf, | |
str, | |||
maxlen | |||
) | eina_strbuf_insert_n(buf, str, maxlen, 0) |
Prepends an escaped string to the given buffer.
[in,out] | buf | The string buffer. |
[in] | str | The string to prepend. |
[in] | maxlen | The maximum number of chars to prepend. |
str
could not be prepended.This macro simply calls eina_strbuf_insert_n() with position 0.
#define eina_strbuf_prepend_printf | ( | buf, | |
fmt, | |||
... | |||
) | eina_strbuf_insert_printf(buf, fmt, 0, ## __VA_ARGS__) |
Prepends data elements to the given buffer using printf-style formatting.
[in,out] | buf | The string buffer. |
[in] | fmt | The string to prepend. |
[in] | ... | Variable list of data elements to prepend. |
This macro simply calls eina_strbuf_insert_printf() with position 0.
#define eina_strbuf_prepend_strftime | ( | buf, | |
fmt, | |||
tm | |||
) | eina_strbuf_insert_strftime(buf, fmt, tm, 0) |
Prepends a strftime-style timestamp to the buffer.
[in,out] | buf | The string buffer. |
[in] | fmt | The formatting string. |
[in] | tm | The time value. |
tm
could not be prepended.This macro simply calls eina_strbuf_insert_strftime() with position 0.
#define eina_strbuf_prepend_vprintf | ( | buf, | |
fmt, | |||
args | |||
) | eina_strbuf_insert_vprintf(buf, fmt, 0, args) |
Prepends the given string to the given buffer.
[in,out] | buf | The string buffer. |
[in] | fmt | The string to prepend. |
[in] | args | The variable arguments. |
This macro simply calls eina_strbuf_insert_vprintf() with position 0.
#define eina_strbuf_replace_first | ( | buf, | |
str, | |||
with | |||
) | eina_strbuf_replace(buf, str, with, 1) |
Replaces the first occurrence of a substring with another string.
[in,out] | buf | The string buffer. |
[in] | str | The text to match. |
[in] | with | The replacement string. |
str
could not be replaced in buf
.This macro simply calls eina_strbuf_replace() with n
equal to 1
.
Type for a string buffer.
Eina_Bool eina_strbuf_append | ( | Eina_Strbuf * | buf, |
const char * | str | ||
) |
Appends a string to a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | str | The string to append. |
str
could not be appended.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.
Eina_Bool eina_strbuf_append_buffer | ( | Eina_Strbuf * | buf, |
const Eina_Strbuf * | data | ||
) |
Appends an Eina_Strbuf to a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | data | The string buffer to append. |
data
could not be appended.This function appends data
to buf
. data
must be allocated and different from NULL
. It is slightly faster than eina_strbuf_append() as it does not compute the size of str
.
Eina_Bool eina_strbuf_append_char | ( | Eina_Strbuf * | buf, |
char | c | ||
) |
Appends a character to a string buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | c | The character to append. |
c
could not be appended.This function appends c
to buf
.
Eina_Bool eina_strbuf_append_escaped | ( | Eina_Strbuf * | buf, |
const char * | str | ||
) |
Appends an escaped string to a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | str | The string to append. |
str
could not be appended.This function escapes and then appends the string str
to buf
.
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.
[in,out] | buf | The string buffer. |
[in] | str | The string to append. |
[in] | length | The exact length to use. |
str
could not be appended.This function appends str
to buf
. str
must be of size at most 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.
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.
[in,out] | buf | The string buffer. |
[in] | str | The string to append. |
[in] | maxlen | The maximum number of characters to append. |
str
could not be appended.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
).
Eina_Bool eina_strbuf_append_printf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
... | |||
) |
Appends data elements to a buffer using printf-style formatting.
[in,out] | buf | The string buffer. |
[in] | fmt | A formatting string. |
[in] | ... | Variable list of data parameters to be appended. |
This function appends the string defined by the format fmt
to buf
, reallocating as necessary. fmt
must be of a valid format for the printf family of functions.
Eina_Bool eina_strbuf_append_slice | ( | Eina_Strbuf * | buf, |
const Eina_Slice | slice | ||
) |
Append a slice to a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | slice | The slice to append. |
slice
could not be appended.This function appends slice
to buf
.
Eina_Bool eina_strbuf_append_strftime | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
const struct tm * | tm | ||
) |
Appends a strftime-style timestamp to the buffer.
[in,out] | buf | The string buffer. |
[in] | fmt | The formatting string. |
[in] | tm | The time value. |
This function appends a timestamp to the buffer, formatted using strftime. A string of the exact size required by strftime's output is added to the end.
Example usage:
time_t curr_time; struct tm *info; Eina_Strbuf *buf = eina_strbuf_new(); curr_time = time(NULL); info = localtime(&curr_time); eina_strbuf_append_strftime(buf, "%I:%M%p", info); //after use eina_strbuf_free(buf);
Eina_Bool eina_strbuf_append_vprintf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
va_list | args | ||
) |
Appends data elements to a string buffer using a va_list.
[in,out] | buf | The string buffer. |
[in] | fmt | A formatting string. |
[in] | args | The variable arguments. |
void eina_strbuf_free | ( | Eina_Strbuf * | buf | ) |
Frees a string buffer.
[in,out] | buf | The string buffer to free. |
This function frees the memory of buf
. buf
must have been created by eina_strbuf_new().
Eina_Bool eina_strbuf_insert | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | pos | ||
) |
Inserts a string into a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | str | The string to insert. |
[in] | pos | The position to insert the string. |
str
could not be inserted.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.
Eina_Bool eina_strbuf_insert_char | ( | Eina_Strbuf * | buf, |
char | c, | ||
size_t | pos | ||
) |
Inserts a character into a string buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | c | The character to insert. |
[in] | pos | The position to insert the character. |
c
could not be inserted.This function inserts c
into buf
at position pos
.
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.
[in,out] | buf | The string buffer. |
[in] | str | The string to insert. |
[in] | pos | The position to insert the string. |
str
could not be inserted.This function escapes and inserts the string str
into buf
at position pos
.
Eina_Bool eina_strbuf_insert_length | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | length, | ||
size_t | pos | ||
) |
Inserts a string of an exact length into a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | str | The string to insert. |
[in] | length | The exact length to use. |
[in] | pos | The position to insert the string. |
string
could not be inserted.This function inserts str
into buf
. str
must be no longer than 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_stringshare.
Eina_Bool eina_strbuf_insert_n | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
size_t | maxlen, | ||
size_t | pos | ||
) |
Inserts a string of a maximum length into a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | str | The string to insert. |
[in] | maxlen | The maximum number of chars to insert. |
[in] | pos | The position to insert the string. |
str
could not be inserted.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
).
Eina_Bool eina_strbuf_insert_printf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
size_t | pos, | ||
... | |||
) |
Inserts data elements into a buffer using printf-style formatting.
[in,out] | buf | The string buffer. |
[in] | fmt | The string to insert. |
[in] | pos | The position to insert the string. |
[in] | ... | Variable list of data parameters to be inserted. |
This function inserts a string as described by the format fmt
into buf
at the position pos
. fmt
must be of a valid format for printf family of functions.
Eina_Bool eina_strbuf_insert_slice | ( | Eina_Strbuf * | buf, |
const Eina_Slice | slice, | ||
size_t | pos | ||
) |
Insert a slice into a buffer, reallocating as necessary.
[in,out] | buf | The string buffer. |
[in] | slice | The slice to insert. |
[in] | pos | The position to insert the string. |
slice
could not be inserted.This function inserts slice
into buf
at position pos
.
Eina_Bool eina_strbuf_insert_strftime | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
const struct tm * | tm, | ||
size_t | pos | ||
) |
Inserts a strftime-style timestamp into the buffer.
[in,out] | buf | The string buffer. |
[in] | fmt | The formatting string. |
[in] | tm | The time value. |
[in] | pos | The position in the buffer to insert the timestamp. |
This function inserts a timestamp into the buffer, formatted using strftime. The buffer's length will be increased by the exact amount required by strftime's output.
Example usage:
time_t curr_time; struct tm *info; Eina_Strbuf *buf = eina_strbuf_new(); curr_time = time(NULL); info = localtime(&curr_time); eina_strbuf_insert_strftime(buf, "%I:%M%p", info, 2); //after use eina_strbuf_free(buf);
Eina_Bool eina_strbuf_insert_vprintf | ( | Eina_Strbuf * | buf, |
const char * | fmt, | ||
size_t | pos, | ||
va_list | args | ||
) |
Inserts data elements into a buffer using a va_list.
[in,out] | buf | The string buffer. |
[in] | fmt | The string to insert. |
[in] | pos | The position to insert the string. |
[in] | args | The variable arguments. |
size_t eina_strbuf_length_get | ( | const Eina_Strbuf * | buf | ) |
Retrieves the length of the string buffer's content.
[in,out] | buf | The string buffer. |
This function returns the length of buf
.
void eina_strbuf_ltrim | ( | Eina_Strbuf * | buf | ) |
Left trims the string buffer.
[in,out] | buf | The string buffer. |
This function removes whitespace at the beginning of the buffer's string.
Eina_Strbuf* eina_strbuf_manage_new | ( | char * | str | ) |
Creates a new string buffer using the passed string.
[in] | str | The string to manage. |
NULL
on error.This function creates a new string buffer. The passed string is used directly as the buffer, it's effectively the inverse of eina_strbuf_string_steal(). The passed string must be malloc'd. To free the resources, use eina_strbuf_free().
Eina_Strbuf* eina_strbuf_manage_new_length | ( | char * | str, |
size_t | length | ||
) |
Creates a new string buffer using the passed string.
[in] | str | The string to manage. |
[in] | length | The length of the string. |
NULL
on error.This function creates a new string buffer. The passed string is used directly as the buffer, it's effectively the inverse of eina_strbuf_string_steal(). The passed string must be malloc'd. To free the resources, use eina_strbuf_free().
Eina_Strbuf* eina_strbuf_manage_read_only_new_length | ( | const char * | str, |
size_t | length | ||
) |
Creates a new string buffer using the passed string.
[in] | str | The string to manage. |
[in] | length | The length of the string. |
NULL
on error.This function creates a new string buffer. The passed string is used directly as the buffer, it's effectively the inverse of eina_strbuf_string_steal(). The passed string is expected to be static or otherwise on the stack rather than the malloc'd string required by eina_strbuf_manage_new_length(). To free the resources, use eina_strbuf_free().
Eina_Strbuf* eina_strbuf_new | ( | void | ) |
Creates a new string buffer.
NULL
on error.This function creates a new string buffer. To free the resources, use eina_strbuf_free().
char* eina_strbuf_release | ( | Eina_Strbuf * | buf | ) |
Frees the buffer, returning its old contents.
[in,out] | buf | The string buffer. |
Eina_Bool eina_strbuf_remove | ( | Eina_Strbuf * | buf, |
size_t | start, | ||
size_t | end | ||
) |
Removes a section from the given string buffer.
[in,out] | buf | The string buffer. |
[in] | start | The initial (inclusive) byte position to start removal. |
[in] | end | The final (non-inclusive) byte position to end removal. |
This function removes a slice of buf
, starting at start
(inclusive) and ending at end
(non-inclusive). Both values are in bytes.
Eina_Bool eina_strbuf_replace | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
const char * | with, | ||
unsigned int | n | ||
) |
Replaces a substring in the buffer with another string.
[in,out] | buf | The string buffer. |
[in] | str | The text to match. |
[in] | with | The replacement string. |
[in] | n | The indexed occurrence to be replaced. |
This function replaces the n-th occurrence of str
in buf
with with
.
int eina_strbuf_replace_all | ( | Eina_Strbuf * | buf, |
const char * | str, | ||
const char * | with | ||
) |
Replaces all matching substrings with another string.
[in,out] | buf | The string buffer. |
[in] | str | The text to match. |
[in] | with | The replacement string. |
0
on failure.This function replaces all the occurrences of str
in buf
with the string with
.
void eina_strbuf_reset | ( | Eina_Strbuf * | buf | ) |
Resets a string buffer.
[in,out] | buf | The string buffer. |
This function resets buf:
the buffer len is set to 0, and the string data is set to '\0'. No memory is freed.
void eina_strbuf_rtrim | ( | Eina_Strbuf * | buf | ) |
Right trims the string buffer.
[in,out] | buf | The string buffer. |
This function removes whitespace at the end of the buffer's string.
Eina_Rw_Slice eina_strbuf_rw_slice_get | ( | const Eina_Strbuf * | buf | ) |
Gets a read-write slice of the buffer contents.
[in] | buf | The string buffer. |
buf
is changed, such as through calls like eina_strbuf_append() or eina_strbuf_remove().Eina_Slice eina_strbuf_slice_get | ( | const Eina_Strbuf * | buf | ) |
Gets a read-only slice of the buffer contents.
[in] | buf | The string buffer. |
buf
is changed.void eina_strbuf_string_free | ( | Eina_Strbuf * | buf | ) |
Frees the contents of a string buffer but not the buffer.
[in,out] | buf | The string buffer. |
This function frees the string contained in buf
without freeing buf
.
const char* eina_strbuf_string_get | ( | const Eina_Strbuf * | buf | ) |
Retrieves a pointer to the contents of a string buffer.
[in] | buf | The string buffer. |
This function returns the string contained in buf
. The returned value must not be modified and will no longer be valid if buf
is modified. In other words, calling eina_strbuf_append() or similar functions will make this pointer invalid. The pointer returned by this function must not be freed.
char* eina_strbuf_string_steal | ( | Eina_Strbuf * | buf | ) |
Steals the contents of a string buffer.
[in,out] | buf | The string buffer. |
buf
.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().
Eina_Strbuf* eina_strbuf_substr_get | ( | Eina_Strbuf * | buf, |
size_t | pos, | ||
size_t | len | ||
) |
Obtains substring from a source string buffer.
[in] | buf | The string buffer. |
[in] | pos | The (0-based) position where the substring starts. |
[in] | len | The length from pos that should be copied. |
NULL
if invalid parameters were specified.This function creates a Eina_Strbuf containing a copy of a substring of buf starting at pos
with len
length. If len is 0, then an empty strbuf will be returned.
void eina_strbuf_tolower | ( | Eina_Strbuf * | buf | ) |
Converts the string to lower case.
[in,out] | buf | The string buffer. |
This function converts all the characters in the buffer's string to lower case.
void eina_strbuf_trim | ( | Eina_Strbuf * | buf | ) |
Trims the string buffer.
[in,out] | buf | The string buffer. |
This function removes whitespace at the beginning and end of the buffer's string.