Try compiling before committing, why don't you? Simple fixes for my stupid
[platform/upstream/glib.git] / glib / 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 <glib/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   gsize len;    
41   gsize allocated_len;
42 };
43
44 /* String Chunks
45  */
46 GStringChunk* g_string_chunk_new           (gsize size);  
47 void          g_string_chunk_free          (GStringChunk *chunk);
48 gchar*        g_string_chunk_insert        (GStringChunk *chunk,
49                                             const gchar  *string);
50 gchar*        g_string_chunk_insert_const  (GStringChunk *chunk,
51                                             const gchar  *string);
52
53
54 /* Strings
55  */
56 GString*     g_string_new               (const gchar     *init);
57 GString*     g_string_new_len           (const gchar     *init,
58                                          gssize           len);   
59 GString*     g_string_sized_new         (gsize            dfl_size);  
60 gchar*       g_string_free              (GString         *string,
61                                          gboolean         free_segment);
62 gboolean     g_string_equal             (const GString   *v,
63                                          const GString   *v2);
64 guint        g_string_hash              (const GString   *str);
65 GString*     g_string_assign            (GString         *string,
66                                          const gchar     *rval);
67 GString*     g_string_truncate          (GString         *string,
68                                          gsize            len);    
69 GString*     g_string_set_size          (GString         *string,
70                                          gsize            len);
71 GString*     g_string_insert_len        (GString         *string,
72                                          gssize           pos,   
73                                          const gchar     *val,
74                                          gssize           len);  
75 GString*     g_string_append            (GString         *string,
76                                          const gchar     *val);
77 GString*     g_string_append_len        (GString         *string,
78                                          const gchar     *val,
79                                          gssize           len);  
80 GString*     g_string_append_c          (GString         *string,
81                                          gchar            c);
82 GString*     g_string_prepend           (GString         *string,
83                                          const gchar     *val);
84 GString*     g_string_prepend_c         (GString         *string,
85                                          gchar            c);
86 GString*     g_string_prepend_len       (GString         *string,
87                                          const gchar     *val,
88                                          gssize           len);  
89 GString*     g_string_insert            (GString         *string,
90                                          gssize           pos,    
91                                          const gchar     *val);
92 GString*     g_string_insert_c          (GString         *string,
93                                          gssize           pos,    
94                                          gchar            c);
95 GString*     g_string_erase             (GString         *string,
96                                          gsize            pos,    
97                                          gsize            len);   
98 GString*     g_string_ascii_down        (GString         *string);
99 GString*     g_string_ascii_up          (GString         *string);
100 void         g_string_printf            (GString         *string,
101                                          const gchar     *format,
102                                          ...) G_GNUC_PRINTF (2, 3);
103 void         g_string_printfa           (GString         *string,
104                                          const gchar     *format,
105                                          ...) G_GNUC_PRINTF (2, 3);
106
107 #ifndef G_DISABLE_DEPRECATED
108
109 /* The following two functions are deprecated and will be removed in
110  * the next major release. They use the locale-specific tolower and
111  * toupper, which is almost never the right thing.
112  */
113
114 GString*     g_string_down              (GString         *string);
115 GString*     g_string_up                (GString         *string);
116
117 /* These aliases are included for compatibility. */
118 #define g_string_sprintf        g_string_printf
119 #define g_string_sprintfa       g_string_printfa
120
121 #endif /* G_DISABLE_DEPRECATED */
122
123 G_END_DECLS
124
125 #endif /* __G_STRING_H__ */
126