SimGrid
3.13
Versatile Simulation of Distributed Systems
|
#include "xbt/sysdep.h"
#include "xbt/function_types.h"
#include "xbt/log.h"
#include "xbt/str.h"
#include "xbt/dict.h"
Classes | |
struct | s_xbt_strbuff_t |
Buffer code. More... | |
Typedefs | |
typedef struct s_xbt_strbuff_t * | xbt_strbuff_t |
Functions | |
void | xbt_strbuff_empty (xbt_strbuff_t b) |
xbt_strbuff_t | xbt_strbuff_new (void) |
xbt_strbuff_t | xbt_strbuff_new_from (const char *s) |
creates a new string buffer containing the provided string More... | |
void | xbt_strbuff_free (xbt_strbuff_t b) |
frees the buffer and its content More... | |
void | xbt_strbuff_free_container (xbt_strbuff_t b) |
frees only the container without touching to the contained string More... | |
void | xbt_strbuff_append (xbt_strbuff_t b, const char *toadd) |
void | xbt_strbuff_chomp (xbt_strbuff_t b) |
void | xbt_strbuff_trim (xbt_strbuff_t b) |
void | xbt_strbuff_varsubst (xbt_strbuff_t b, xbt_dict_t patterns) |
Replaces a set of variables by their values. More... | |
typedef struct s_xbt_strbuff_t * xbt_strbuff_t |
|
inline |
xbt_strbuff_t xbt_strbuff_new | ( | void | ) |
|
inline |
creates a new string buffer containing the provided string
Beware, the ctn is copied, you want to free it afterward, anyhow
|
inline |
frees the buffer and its content
|
inline |
frees only the container without touching to the contained string
void xbt_strbuff_append | ( | xbt_strbuff_t | b, |
const char * | toadd | ||
) |
void xbt_strbuff_chomp | ( | xbt_strbuff_t | b | ) |
void xbt_strbuff_trim | ( | xbt_strbuff_t | b | ) |
void xbt_strbuff_varsubst | ( | xbt_strbuff_t | b, |
xbt_dict_t | patterns | ||
) |
Replaces a set of variables by their values.
b | buffer to modify |
patterns | variables to substitute in the buffer |
Both '$toto' and '${toto}' are valid (and the two writing are equivalent).
If the variable name contains spaces, use the brace version (ie, ${toto tutu})
You can provide a default value to use if the variable is not set in the dict by using '${var:=default}' or '${var:-default}'. These two forms are equivalent, even if they shouldn't to respect the shell standard (:= form should set the value in the dict, but does not) (BUG).