Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
dd5c5449ec97bd48da08148c6e77a3eee1d9e30b
[simgrid.git] / include / xbt / str.h
1 /* $Id$ */
2
3 /* str.h - XBT string related functions.                                    */
4
5 /* Copyright (c) 2004-7, Martin Quinson, Arnaud Legrand and  Cherier Malek. */
6 /* All rights reserved.                                                     */
7
8 /* This program is free software; you can redistribute it and/or modify it
9  * under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #ifndef XBT_STR_H
12 #define XBT_STR_H
13
14 #include <stdarg.h>             /* va_* */
15 #include "xbt/misc.h"
16 #include "xbt/dynar.h"
17 #include "xbt/dict.h"
18 #include "simgrid_config.h"     /* FILE for getline */
19
20 SG_BEGIN_DECL()
21
22 /** @addtogroup XBT_str
23  *  @brief String manipulation functions
24  *
25  * This module defines several string related functions. We redefine some quite classical
26  * functions on the platforms were they are not nativaly defined (such as getline() or
27  * asprintf()), while some other are a bit more exotic.
28  * @{
29  */
30
31
32 /* Trim related functions */
33 XBT_PUBLIC(void) xbt_str_rtrim(char *s, const char *char_list);
34 XBT_PUBLIC(void) xbt_str_ltrim(char *s, const char *char_list);
35 XBT_PUBLIC(void) xbt_str_trim(char *s, const char *char_list);
36
37 XBT_PUBLIC(xbt_dynar_t) xbt_str_split(const char *s, const char *sep);
38 XBT_PUBLIC(xbt_dynar_t) xbt_str_split_quoted(const char *s);
39 XBT_PUBLIC(xbt_dynar_t) xbt_str_split_str(const char *s, const char *sep);
40
41 XBT_PUBLIC(char *) xbt_str_join(xbt_dynar_t dynar, const char *sep);
42
43 /* */
44 XBT_PUBLIC(void) xbt_str_subst(char *str, char from, char to, int amount);
45 XBT_PUBLIC(char *) xbt_str_varsubst(char *str, xbt_dict_t patterns);
46
47 /* */
48 XBT_PUBLIC(void) xbt_str_strip_spaces(char *);
49 XBT_PUBLIC(char *) xbt_str_diff(char *a, char *b);
50
51 XBT_PUBLIC(char*)xbt_str_from_file(FILE *file);
52
53 /** @brief Classical alias to (char*)
54  *
55  * This of almost no use, beside cosmetics and the GRAS parsing macro (see \ref GRAS_dd_auto).
56  */
57      typedef char *xbt_string_t;
58
59 /**@}*/
60
61 SG_END_DECL()
62 #endif /* XBT_STR_H */