Tizen Native API
|
Functions | |
Eina_Binbuf * | eina_binbuf_new (void) |
Create a new string buffer. | |
Eina_Binbuf * | eina_binbuf_manage_new_length (unsigned char *str, size_t length) |
Create a new string buffer using the passed string. The passed string is used directly as the buffer, it's somehow the opposite function of. | |
void | eina_binbuf_free (Eina_Binbuf *buf) |
Free a string buffer. | |
void | eina_binbuf_reset (Eina_Binbuf *buf) |
Reset a string buffer. | |
Eina_Bool | eina_binbuf_append_length (Eina_Binbuf *buf, const unsigned char *str, size_t length) |
Append a string of exact length to a buffer, reallocating as necessary. | |
Eina_Bool | eina_binbuf_append_char (Eina_Binbuf *buf, unsigned char c) |
Append a character to a string buffer, reallocating as necessary. | |
Eina_Bool | eina_binbuf_insert_length (Eina_Binbuf *buf, const unsigned char *str, size_t length, size_t pos) |
Insert a string of exact length to a buffer, reallocating as necessary. | |
Eina_Bool | eina_binbuf_insert_char (Eina_Binbuf *buf, unsigned char c, size_t pos) |
Insert a character to a string buffer, reallocating as necessary. | |
Eina_Bool | eina_binbuf_remove (Eina_Binbuf *buf, size_t start, size_t end) |
Remove a slice of the given string buffer. | |
const unsigned char * | eina_binbuf_string_get (const Eina_Binbuf *buf) |
Retrieve a pointer to the contents of a string buffer. | |
unsigned char * | eina_binbuf_string_steal (Eina_Binbuf *buf) |
Steal the contents of a string buffer. | |
void | eina_binbuf_string_free (Eina_Binbuf *buf) |
Free the contents of a string buffer but not the buffer. | |
size_t | eina_binbuf_length_get (const Eina_Binbuf *buf) |
Retrieve the length of the string buffer content. | |
Typedefs | |
typedef struct _Eina_Strbuf | Eina_Binbuf |
These functions provide string buffers management.
The Binary Buffer data type is designed to be a mutable string, allowing to append, prepend or insert a string to a buffer.
Typedef Documentation
Type for a string buffer.
Function Documentation
Eina_Bool eina_binbuf_append_char | ( | Eina_Binbuf * | buf, |
unsigned char | c | ||
) |
Append a character to a string buffer, reallocating as necessary.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to append to. [in] c The char to append.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Remarks:
- This function inserts
c
tobuf
. If it can not insert it, EINA_FALSE is returned, otherwise EINA_TRUE is returned.
Eina_Bool eina_binbuf_append_length | ( | Eina_Binbuf * | buf, |
const unsigned char * | str, | ||
size_t | length | ||
) |
Append a string of exact length to a buffer, reallocating as necessary.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to append to. [in] str The string to append. [in] length The exact length to use.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Remarks:
- This function appends
str
tobuf
.str
must be of size at mostlength
. It is slightly faster than eina_binbuf_append() as it does not compute the size ofstr
. It is useful when dealing with strings of known size, such as eina_strngshare. Ifbuf
can't append it, EINA_FALSE is returned, otherwise EINA_TRUE is returned.
- See also:
- eina_stringshare_length()
- eina_binbuf_append()
- eina_binbuf_append_n()
void eina_binbuf_free | ( | Eina_Binbuf * | buf | ) |
Free a string buffer.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to free.
- Remarks:
- This function frees the memory of
buf
.buf
must have been created by eina_binbuf_new().
Eina_Bool eina_binbuf_insert_char | ( | Eina_Binbuf * | buf, |
unsigned char | c, | ||
size_t | pos | ||
) |
Insert a character to a string buffer, reallocating as necessary.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to insert to. [in] c The char to insert. [in] pos The position to insert the char.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Remarks:
- This function inserts
c
tobuf
at positionpos
. Ifbuf
can't append it, EINA_FALSE is returned, otherwise EINA_TRUE is returned.
Eina_Bool eina_binbuf_insert_length | ( | Eina_Binbuf * | buf, |
const unsigned char * | str, | ||
size_t | length, | ||
size_t | pos | ||
) |
Insert a string of exact length to a buffer, reallocating as necessary.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to insert to. [in] str The string to insert. [in] length The exact length to use. [in] pos The position to insert the string.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Remarks:
- This function inserts
str
tobuf
.str
must be of size at mostlength
. It is slightly faster than eina_binbuf_insert() as it does not compute the size ofstr
. It is useful when dealing with strings of known size, such as eina_strngshare. Ifbuf
can't insert it, EINA_FALSE is returned, otherwise EINA_TRUE is returned.
- See also:
- eina_stringshare_length()
- eina_binbuf_insert()
- eina_binbuf_insert_n()
size_t eina_binbuf_length_get | ( | const Eina_Binbuf * | buf | ) |
Retrieve the length of the string buffer content.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer.
- Returns:
- The current length of the string, in bytes.
- Remarks:
- This function returns the length of
buf
.
Eina_Binbuf* eina_binbuf_manage_new_length | ( | unsigned char * | str, |
size_t | length | ||
) |
Create a new string buffer using the passed string. The passed string is used directly as the buffer, it's somehow the opposite function of.
- Since :
- 2.3
eina_binbuf_string_steal . The passed string must be malloced.
- Parameters:
-
[in] str the string to manage [in] length the length of the string.
- Returns:
- Newly allocated string buffer instance.
- Remarks:
- This function creates a new string buffer. On error,
NULL
is returned. To free the resources, use eina_binbuf_free().
- See also:
- eina_binbuf_manage_new()
- Since (EFL) :
- 1.2.0
Eina_Binbuf* eina_binbuf_new | ( | void | ) |
Create a new string buffer.
- Since :
- 2.3
- Returns:
- Newly allocated string buffer instance.
- Remarks:
- This function creates a new string buffer. On error,
NULL
is returned. To free the resources, use eina_binbuf_free().
- See also:
- eina_binbuf_free()
- eina_binbuf_append()
- eina_binbuf_string_get()
Eina_Bool eina_binbuf_remove | ( | Eina_Binbuf * | buf, |
size_t | start, | ||
size_t | end | ||
) |
Remove a slice of the given string buffer.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to remove a slice. [in] start The initial (inclusive) slice position to start removing, in bytes. [in] end The final (non-inclusive) slice position to finish removing, in bytes.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Remarks:
- This function removes a slice of
buf
, starting atstart
(inclusive) and ending atend
(non-inclusive). Both values are in bytes. It returns EINA_FALSE on failure, EINA_TRUE otherwise.
void eina_binbuf_reset | ( | Eina_Binbuf * | buf | ) |
Reset a string buffer.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to reset.
- Remarks:
- This function reset
buf:
the buffer len is set to 0, and the string is set to '\0'. No memory is free'd.
void eina_binbuf_string_free | ( | Eina_Binbuf * | buf | ) |
Free the contents of a string buffer but not the buffer.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to free the string of.
- Remarks:
- This function frees the string contained in
buf
without freeingbuf
.
const unsigned char* eina_binbuf_string_get | ( | const Eina_Binbuf * | buf | ) |
Retrieve a pointer to the contents of a string buffer.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer.
- Returns:
- The current string in the string buffer.
- Remarks:
- This function returns the string contained in
buf
. The returned value must not be modified and will no longer be valid ifbuf
is modified. In other words, any eina_binbuf_append() or similar will make that pointer invalid.
- See also:
- eina_binbuf_string_steal()
unsigned char* eina_binbuf_string_steal | ( | Eina_Binbuf * | buf | ) |
Steal the contents of a string buffer.
- Since :
- 2.3
- Parameters:
-
[in] buf The string buffer to steal.
- Returns:
- The current string in the string buffer.
- Remarks:
- 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().
- See also:
- eina_binbuf_string_get()