419895831c3ec6e2c8d4b09dc231d8dd616699be
[platform/upstream/evolution-data-server.git] / camel / gstring-util.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* gstring-util : utilities for gstring object  */
3
4 /* 
5  *
6  * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
7  *
8  * This program is free software; you can redistribute it and/or 
9  * modify it under the terms of the GNU General Public License as 
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  * USA
22  */
23
24
25
26 #ifndef GSTRING_UTIL_H
27 #define GSTRING_UTIL_H 1
28
29
30 #ifdef __cplusplus
31 extern "C" {
32 #pragma }
33 #endif /* __cplusplus }*/
34
35 #include <glib.h>
36
37 typedef enum {
38     DICHOTOMY_NONE            =     0,
39     DICHOTOMY_RIGHT_DIR       =     1,
40     DICHOTOMY_STRIP_TRAILING  =     2,
41     DICHOTOMY_STRIP_LEADING   =     4,
42     
43 } DichotomyOption;
44
45 typedef enum {
46     TRIM_NONE            =     0,
47     TRIM_STRIP_TRAILING  =     1,
48     TRIM_STRIP_LEADING   =     2,
49     
50 } TrimOption;
51
52
53 gboolean g_string_equals(GString *string1, GString *string2);
54 GString *g_string_clone(GString *string);
55 gchar g_string_dichotomy( GString *string, gchar sep, GString **prefix, GString **suffix, DichotomyOption options);
56 void g_string_append_g_string(GString *dest_string, GString *other_string);
57
58 gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
59 gboolean g_string_equal_for_glist (gconstpointer v, gconstpointer v2);
60 guint g_string_hash (gconstpointer v);
61 void g_string_list_free (GList *string_list);
62
63 GList *g_string_split (GString *string, char sep, gchar *trim_chars, TrimOption trim_options);
64 void g_string_trim (GString *string, gchar *chars, TrimOption options);
65
66 #ifdef __cplusplus
67 }
68 #endif /* __cplusplus */
69
70 #endif /* GSTRING_UTIL_H */