SG_BEGIN_DECL()
-/** Buffer code **/
+/** @defgroup xbt_strbuff String buffers
+ * @ingroup XBT_adt
+ *
+ * This data container is very similar to the Java StringBuffer:
+ * that's a string to which you can add content with a lesser performance
+ * penalty than if you recreate a new string from scratch. Once done building
+ * your string, you must retrieve the content and free its container.
+ *
+ * @{
+ */
+
+/** @brief Buffer data container **/
struct xbt_strbuff {
char *data;
int used, size;
XBT_PUBLIC(void) xbt_strbuff_trim(xbt_strbuff_t b);
XBT_PUBLIC(void) xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns);
+/** @} */
SG_END_DECL()
#endif
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(strbuff, xbt, "String buffers");
+/** @brief Remove any content from the buffer */
inline void xbt_strbuff_empty(xbt_strbuff_t b)
{
b->used = 0;
b->data[0] = '\0';
}
+/** @brief Constructor */
xbt_strbuff_t xbt_strbuff_new(void)
{
xbt_strbuff_t res = xbt_malloc(sizeof(s_xbt_strbuff_t));
}
}
+/** @brief Adds some content at the end of the buffer */
void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd)
{
int addlen;