Logo AND Algorithmique Numérique Distribuée

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