source: trunk/third/glib2/glib/gstring.h @ 18159

Revision 18159, 4.8 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18158, which included commits to RCS files with non-trunk default branches.
Line 
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#include <glib/gunicode.h>
32
33G_BEGIN_DECLS
34
35typedef struct _GString         GString;
36typedef struct _GStringChunk    GStringChunk;
37
38struct _GString
39{
40  gchar  *str;
41  gsize len;   
42  gsize allocated_len;
43};
44
45/* String Chunks
46 */
47GStringChunk* g_string_chunk_new           (gsize size); 
48void          g_string_chunk_free          (GStringChunk *chunk);
49gchar*        g_string_chunk_insert        (GStringChunk *chunk,
50                                            const gchar  *string);
51gchar*        g_string_chunk_insert_const  (GStringChunk *chunk,
52                                            const gchar  *string);
53
54
55/* Strings
56 */
57GString*     g_string_new               (const gchar     *init);
58GString*     g_string_new_len           (const gchar     *init,
59                                         gssize           len);   
60GString*     g_string_sized_new         (gsize            dfl_size); 
61gchar*       g_string_free              (GString         *string,
62                                         gboolean         free_segment);
63gboolean     g_string_equal             (const GString   *v,
64                                         const GString   *v2);
65guint        g_string_hash              (const GString   *str);
66GString*     g_string_assign            (GString         *string,
67                                         const gchar     *rval);
68GString*     g_string_truncate          (GString         *string,
69                                         gsize            len);   
70GString*     g_string_set_size          (GString         *string,
71                                         gsize            len);
72GString*     g_string_insert_len        (GString         *string,
73                                         gssize           pos,   
74                                         const gchar     *val,
75                                         gssize           len); 
76GString*     g_string_append            (GString         *string,
77                                         const gchar     *val);
78GString*     g_string_append_len        (GString         *string,
79                                         const gchar     *val,
80                                         gssize           len); 
81GString*     g_string_append_c          (GString         *string,
82                                         gchar            c);
83GString*     g_string_append_unichar    (GString         *string,
84                                         gunichar         wc);
85GString*     g_string_prepend           (GString         *string,
86                                         const gchar     *val);
87GString*     g_string_prepend_c         (GString         *string,
88                                         gchar            c);
89GString*     g_string_prepend_unichar   (GString         *string,
90                                         gunichar         wc);
91GString*     g_string_prepend_len       (GString         *string,
92                                         const gchar     *val,
93                                         gssize           len); 
94GString*     g_string_insert            (GString         *string,
95                                         gssize           pos,   
96                                         const gchar     *val);
97GString*     g_string_insert_c          (GString         *string,
98                                         gssize           pos,   
99                                         gchar            c);
100GString*     g_string_insert_unichar    (GString         *string,
101                                         gssize           pos,   
102                                         gunichar         wc);
103GString*     g_string_erase             (GString         *string,
104                                         gssize           pos,
105                                         gssize           len);
106GString*     g_string_ascii_down        (GString         *string);
107GString*     g_string_ascii_up          (GString         *string);
108void         g_string_printf            (GString         *string,
109                                         const gchar     *format,
110                                         ...) G_GNUC_PRINTF (2, 3);
111void         g_string_append_printf     (GString         *string,
112                                         const gchar     *format,
113                                         ...) G_GNUC_PRINTF (2, 3);
114
115#ifndef G_DISABLE_DEPRECATED
116
117/* The following two functions are deprecated and will be removed in
118 * the next major release. They use the locale-specific tolower and
119 * toupper, which is almost never the right thing.
120 */
121
122GString*     g_string_down              (GString         *string);
123GString*     g_string_up                (GString         *string);
124
125/* These aliases are included for compatibility. */
126#define g_string_sprintf        g_string_printf
127#define g_string_sprintfa       g_string_append_printf
128
129#endif /* G_DISABLE_DEPRECATED */
130
131G_END_DECLS
132
133#endif /* __G_STRING_H__ */
134
Note: See TracBrowser for help on using the repository browser.