1 /* strbuff -- string buffers */
3 /* Copyright (c) 2007-2011, 2013-2014. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "xbt/sysdep.h"
13 #include "xbt/function_types.h"
20 /** @defgroup xbt_strbuff String buffers
23 * This data container is very similar to the Java StringBuffer:
24 * that's a string to which you can add content with a lesser performance
25 * penalty than if you recreate a new string from scratch. Once done building
26 * your string, you must retrieve the content and free its container.
31 /** @brief Buffer data container **/
32 typedef struct xbt_strbuff {
37 typedef s_xbt_strbuff_t* xbt_strbuff_t;
39 XBT_PUBLIC(void) xbt_strbuff_clear(xbt_strbuff_t b);
40 XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(void);
41 XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new_from(const char *s);
42 XBT_PUBLIC(void) xbt_strbuff_free(xbt_strbuff_t b);
43 XBT_PUBLIC(void) xbt_strbuff_free_container(xbt_strbuff_t b);
44 XBT_PUBLIC(void) xbt_strbuff_append(xbt_strbuff_t b, const char *toadd);
45 XBT_PUBLIC(void) xbt_strbuff_printf(xbt_strbuff_t b, const char *fmt, ...);
46 XBT_PUBLIC(void) xbt_strbuff_chomp(xbt_strbuff_t b);
47 XBT_PUBLIC(void) xbt_strbuff_trim(xbt_strbuff_t b);
48 XBT_PUBLIC(void) xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns);