Split glib.h into many header files mostly according to the resp.
[platform/upstream/glib.git] / gstring.h
1 /* GLIB - Library of useful routines for C programming
2  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GLib Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __G_STRING_H__
28 #define __G_STRING_H__
29
30 #include <gtypes.h>
31
32 G_BEGIN_DECLS
33
34 typedef struct _GString         GString;
35 typedef struct _GStringChunk    GStringChunk;
36
37 struct _GString
38 {
39   gchar *str;
40   gint len;
41 };
42
43 /* String Chunks
44  */
45 GStringChunk* g_string_chunk_new           (gint size);
46 void          g_string_chunk_free          (GStringChunk *chunk);
47 gchar*        g_string_chunk_insert        (GStringChunk *chunk,
48                                             const gchar  *string);
49 gchar*        g_string_chunk_insert_const  (GStringChunk *chunk,
50                                             const gchar  *string);
51
52
53 /* Strings
54  */
55 GString*     g_string_new               (const gchar     *init);
56 GString*     g_string_sized_new         (guint            dfl_size);
57 gchar*       g_string_free              (GString         *string,
58                                          gboolean         free_segment);
59 gboolean     g_string_equal             (const GString   *v,
60                                          const GString   *v2);
61 guint        g_string_hash              (const GString   *str);
62 GString*     g_string_assign            (GString         *string,
63                                          const gchar     *rval);
64 GString*     g_string_truncate          (GString         *string,
65                                          guint            len);
66 GString*     g_string_insert_len        (GString         *string,
67                                          gint             pos,
68                                          const gchar     *val,
69                                          gint             len);
70 GString*     g_string_append            (GString         *string,
71                                          const gchar     *val);
72 GString*     g_string_append_len        (GString         *string,
73                                          const gchar     *val,
74                                          gint             len);
75 GString*     g_string_append_c          (GString         *string,
76                                          gchar            c);
77 GString*     g_string_prepend           (GString         *string,
78                                          const gchar     *val);
79 GString*     g_string_prepend_c         (GString         *string,
80                                          gchar            c);
81 GString*     g_string_prepend_len       (GString         *string,
82                                          const gchar     *val,
83                                          gint             len);
84 GString*     g_string_insert            (GString         *string,
85                                          gint             pos,
86                                          const gchar     *val);
87 GString*     g_string_insert_c          (GString         *string,
88                                          gint             pos,
89                                          gchar            c);
90 GString*     g_string_erase             (GString         *string,
91                                          gint             pos,
92                                          gint             len);
93 GString*     g_string_down              (GString         *string);
94 GString*     g_string_up                (GString         *string);
95 void         g_string_sprintf           (GString         *string,
96                                          const gchar     *format,
97                                          ...) G_GNUC_PRINTF (2, 3);
98 void         g_string_sprintfa          (GString         *string,
99                                          const gchar     *format,
100                                          ...) G_GNUC_PRINTF (2, 3);
101
102 G_END_DECLS
103
104 #endif /* __G_STRING_H__ */
105