forked from enlightenment/efl
parent
14478ee124
commit
1c640c7704
|
@ -6,6 +6,17 @@
|
|||
|
||||
#include "eina_types.h"
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_String_Buffer_Group String Buffer
|
||||
*
|
||||
* @brief These functions provide string buffers management.
|
||||
*
|
||||
* The String Buffer data type is designed to be a mutable string,
|
||||
* allowing to append, prepend or insert a string to a buffer.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Data_Types_Group Data Types
|
||||
*
|
||||
|
@ -447,6 +458,19 @@ EAPI void eina_strbuf_string_free(Eina_Strbuf *buf) EINA_ARG_NONNULL(1);
|
|||
*/
|
||||
EAPI size_t eina_strbuf_length_get(const Eina_Strbuf *buf) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Replace the n-th string with an other string.
|
||||
*
|
||||
* @param buf The string buffer to work with.
|
||||
* @param str The string to replace.
|
||||
* @param with The replaceing string.
|
||||
* @param n The number of the fitting string.
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE on failure.
|
||||
*
|
||||
* This function replaces the n-th occurrence of @p str in @p buf with
|
||||
* @p with. It returns #EINA_FALSE on failure, #EINA_TRUE otherwise.
|
||||
*/
|
||||
EAPI Eina_Bool eina_strbuf_replace(Eina_Strbuf *buf, const char *str, const char *with, unsigned int n) EINA_ARG_NONNULL(1, 2, 3);
|
||||
|
||||
/**
|
||||
|
@ -464,6 +488,19 @@ EAPI Eina_Bool eina_strbuf_replace(Eina_Strbuf *buf, const char *str, const char
|
|||
*/
|
||||
#define eina_strbuf_replace_first(buf, str, with) eina_strbuf_replace(buf, str, with, 1)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Replace all strings with an other string.
|
||||
|
||||
* @param buf the string buffer to work with.
|
||||
* @param str The string to replace.
|
||||
* @param with The replaceing string.
|
||||
* @return How often the string was replaced.
|
||||
*
|
||||
* This function replaces all the occurrences of @p str in @ buf with
|
||||
* the string @p with. This function returns the number of times @p str
|
||||
* has been replaced. On failure, it returns 0.
|
||||
*/
|
||||
EAPI int eina_strbuf_replace_all(Eina_Strbuf *buf, const char *str, const char *with) EINA_ARG_NONNULL(1, 2, 3);
|
||||
|
||||
/**
|
||||
|
@ -474,4 +511,8 @@ EAPI int eina_strbuf_replace_all(Eina_Strbuf *buf, const char *str, const char *
|
|||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* EINA_STRBUF_H */
|
||||
|
|
|
@ -81,17 +81,6 @@ static const char __STRBUF_MAGIC_STR[] = "Eina Strbuf";
|
|||
*============================================================================*/
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_String_Buffer_Group String Buffer
|
||||
*
|
||||
* @brief These functions provide string buffers management.
|
||||
*
|
||||
* The String Buffer data type is designed to be a mutable string,
|
||||
* allowing to append, prepend or insert a string to a buffer.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
EAPI Eina_Bool
|
||||
eina_strbuf_append_printf(Eina_Strbuf *buf, const char *fmt, ...)
|
||||
{
|
||||
|
@ -172,7 +161,3 @@ eina_strbuf_insert_vprintf(Eina_Strbuf *buf,
|
|||
/* Unicode */
|
||||
|
||||
#include "eina_strbuf_template_c.x"
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -204,6 +204,7 @@ _eina_strbuf_common_insert_length(size_t csize,
|
|||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Create a new string buffer.
|
||||
*
|
||||
* @return Newly allocated string buffer instance.
|
||||
|
@ -237,6 +238,7 @@ eina_strbuf_common_new(size_t csize)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Free a string buffer.
|
||||
*
|
||||
* @param buf The string buffer to free.
|
||||
|
@ -252,6 +254,7 @@ eina_strbuf_common_free(Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Reset a string buffer.
|
||||
*
|
||||
* @param buf The string buffer to reset.
|
||||
|
@ -268,6 +271,7 @@ eina_strbuf_common_reset(size_t csize, Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Append a string to a buffer, reallocating as necessary.
|
||||
*
|
||||
* @param buf The string buffer to append to.
|
||||
|
@ -300,6 +304,7 @@ eina_strbuf_common_append(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Append a string to a buffer, reallocating as necessary,
|
||||
* limited by the given length.
|
||||
*
|
||||
|
@ -340,6 +345,7 @@ eina_strbuf_common_append_n(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Append a string of exact length to a buffer, reallocating as necessary.
|
||||
*
|
||||
* @param buf The string buffer to append to.
|
||||
|
@ -376,6 +382,7 @@ eina_strbuf_common_append_length(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Insert a string to a buffer, reallocating as necessary.
|
||||
*
|
||||
* @param buf The string buffer to insert.
|
||||
|
@ -403,6 +410,7 @@ eina_strbuf_common_insert(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Insert a string to a buffer, reallocating as necessary. Limited by maxlen.
|
||||
*
|
||||
* @param buf The string buffer to insert to.
|
||||
|
@ -437,6 +445,7 @@ eina_strbuf_common_insert_n(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Insert a string of exact length to a buffer, reallocating as necessary.
|
||||
*
|
||||
* @param buf The string buffer to insert to.
|
||||
|
@ -471,6 +480,7 @@ eina_strbuf_common_insert_length(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Append a character to a string buffer, reallocating as
|
||||
* necessary.
|
||||
*
|
||||
|
@ -493,6 +503,7 @@ eina_strbuf_common_append_char(size_t csize, Eina_Strbuf *buf, const void *c)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Insert a character to a string buffer, reallocating as
|
||||
* necessary.
|
||||
*
|
||||
|
@ -517,6 +528,7 @@ eina_strbuf_common_insert_char(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Remove a slice of the given string buffer.
|
||||
*
|
||||
* @param buf The string buffer to remove a slice.
|
||||
|
@ -557,6 +569,7 @@ eina_strbuf_common_remove(size_t csize,
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Retrieve a pointer to the contents of a string buffer
|
||||
*
|
||||
* @param buf The string buffer.
|
||||
|
@ -576,6 +589,7 @@ eina_strbuf_common_string_get(const Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Steal the contents of a string buffer.
|
||||
*
|
||||
* @param buf The string buffer to steal.
|
||||
|
@ -600,6 +614,7 @@ eina_strbuf_common_string_steal(size_t csize, Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Free the contents of a string buffer but not the buffer.
|
||||
*
|
||||
* @param buf The string buffer to free the string of.
|
||||
|
@ -615,6 +630,7 @@ eina_strbuf_common_string_free(size_t csize, Eina_Strbuf *buf)
|
|||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Retrieve the length of the string buffer content.
|
||||
*
|
||||
* @param buf The string buffer.
|
||||
|
@ -628,18 +644,6 @@ eina_strbuf_common_length_get(const Eina_Strbuf *buf)
|
|||
return buf->len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_String_Buffer_Group String Buffer
|
||||
*
|
||||
* @brief These functions provide string buffers management.
|
||||
*
|
||||
* The String Buffer data type is designed to be a mutable string,
|
||||
* allowing to append, prepend or insert a string to a buffer.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @cond LOCAL
|
||||
*/
|
||||
|
@ -669,18 +673,6 @@ static const char __STRBUF_STR_MAGIC_STR[] = "Eina Strbuf";
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Replace the n-th string with an other string.
|
||||
*
|
||||
* @param buf The string buffer to work with.
|
||||
* @param str The string to replace.
|
||||
* @param with The replaceing string.
|
||||
* @param n The number of the fitting string.
|
||||
* @return #EINA_TRUE on success, #EINA_FALSE on failure.
|
||||
*
|
||||
* This function replaces the n-th occurrence of @p str in @p buf with
|
||||
* @p with. It returns #EINA_FALSE on failure, #EINA_TRUE otherwise.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_strbuf_replace(Eina_Strbuf *buf,
|
||||
const char *str,
|
||||
|
@ -724,18 +716,6 @@ eina_strbuf_replace(Eina_Strbuf *buf,
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Replace all strings with an other string.
|
||||
|
||||
* @param buf the string buffer to work with.
|
||||
* @param str The string to replace.
|
||||
* @param with The replaceing string.
|
||||
* @return How often the string was replaced.
|
||||
*
|
||||
* This function replaces all the occurrences of @p str in @ buf with
|
||||
* the string @p with. This function returns the number of times @p str
|
||||
* has been replaced. On failure, it returns 0.
|
||||
*/
|
||||
EAPI int
|
||||
eina_strbuf_replace_all(Eina_Strbuf *buf, const char *str, const char *with)
|
||||
{
|
||||
|
@ -811,7 +791,3 @@ eina_strbuf_replace_all(Eina_Strbuf *buf, const char *str, const char *with)
|
|||
free(tmp_buf);
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue