• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/timemachine/gettext-0.17/gettext-tools/gnulib-lib/glib/
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 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 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/*
28 * Modified by Bruno Haible for use as a gnulib module.
29 */
30
31#ifndef __G_STRING_H__
32#define __G_STRING_H__
33
34#include <glib/gtypes.h>
35#if 0
36#include <glib/gunicode.h>
37#include <glib/gutils.h>  /* for G_CAN_INLINE */
38#endif
39
40G_BEGIN_DECLS
41
42typedef struct _GString		GString;
43#if 0
44typedef struct _GStringChunk	GStringChunk;
45#endif
46
47struct _GString
48{
49  gchar  *str;
50  gsize len;
51  gsize allocated_len;
52};
53
54#if 0
55/* String Chunks
56 */
57GStringChunk* g_string_chunk_new	   (gsize size);
58void	      g_string_chunk_free	   (GStringChunk *chunk);
59gchar*	      g_string_chunk_insert	   (GStringChunk *chunk,
60					    const gchar	 *string);
61gchar*	      g_string_chunk_insert_len	   (GStringChunk *chunk,
62					    const gchar	 *string,
63					    gssize        len);
64gchar*	      g_string_chunk_insert_const  (GStringChunk *chunk,
65					    const gchar	 *string);
66#endif
67
68
69/* Strings
70 */
71GString*     g_string_new	        (const gchar	 *init);
72GString*     g_string_new_len           (const gchar     *init,
73                                         gssize           len);
74#if 0
75GString*     g_string_sized_new         (gsize            dfl_size);
76#endif
77gchar*	     g_string_free	        (GString	 *string,
78					 gboolean	  free_segment);
79#if 0
80gboolean     g_string_equal             (const GString	 *v,
81					 const GString 	 *v2);
82guint        g_string_hash              (const GString   *str);
83GString*     g_string_assign            (GString	 *string,
84					 const gchar	 *rval);
85GString*     g_string_truncate          (GString	 *string,
86					 gsize		  len);
87GString*     g_string_set_size          (GString         *string,
88					 gsize            len);
89GString*     g_string_insert_len        (GString         *string,
90                                         gssize           pos,
91                                         const gchar     *val,
92                                         gssize           len);
93#endif
94GString*     g_string_append            (GString	 *string,
95			                 const gchar	 *val);
96GString*     g_string_append_len        (GString	 *string,
97			                 const gchar	 *val,
98                                         gssize           len);
99GString*     g_string_append_c          (GString	 *string,
100					 gchar		  c);
101GString*     g_string_append_unichar    (GString	 *string,
102					 gunichar	  wc);
103#if 0
104GString*     g_string_prepend           (GString	 *string,
105					 const gchar	 *val);
106GString*     g_string_prepend_c         (GString	 *string,
107					 gchar		  c);
108GString*     g_string_prepend_unichar   (GString	 *string,
109					 gunichar	  wc);
110GString*     g_string_prepend_len       (GString	 *string,
111			                 const gchar	 *val,
112                                         gssize           len);
113GString*     g_string_insert            (GString	 *string,
114					 gssize		  pos,
115					 const gchar	 *val);
116#endif
117GString*     g_string_insert_c          (GString	 *string,
118					 gssize		  pos,
119					 gchar		  c);
120GString*     g_string_insert_unichar    (GString	 *string,
121					 gssize		  pos,
122					 gunichar	  wc);
123#if 0
124GString*     g_string_erase	        (GString	 *string,
125					 gssize		  pos,
126					 gssize		  len);
127GString*     g_string_ascii_down        (GString	 *string);
128GString*     g_string_ascii_up          (GString	 *string);
129void         g_string_printf            (GString	 *string,
130					 const gchar	 *format,
131					 ...) G_GNUC_PRINTF (2, 3);
132#endif
133void         g_string_append_printf     (GString	 *string,
134					 const gchar	 *format,
135					 ...) G_GNUC_PRINTF (2, 3);
136
137#if 0
138
139/* -- optimize g_strig_append_c --- */
140#ifdef G_CAN_INLINE
141static inline GString*
142g_string_append_c_inline (GString *gstring,
143                          gchar    c)
144{
145  if (gstring->len + 1 < gstring->allocated_len)
146    {
147      gstring->str[gstring->len++] = c;
148      gstring->str[gstring->len] = 0;
149    }
150  else
151    g_string_insert_c (gstring, -1, c);
152  return gstring;
153}
154#define g_string_append_c(gstr,c)       g_string_append_c_inline (gstr, c)
155#endif /* G_CAN_INLINE */
156
157
158#ifndef G_DISABLE_DEPRECATED
159
160/* The following two functions are deprecated and will be removed in
161 * the next major release. They use the locale-specific tolower and
162 * toupper, which is almost never the right thing.
163 */
164
165GString*     g_string_down              (GString	 *string);
166GString*     g_string_up                (GString	 *string);
167
168/* These aliases are included for compatibility. */
169#define	g_string_sprintf	g_string_printf
170#define	g_string_sprintfa	g_string_append_printf
171
172#endif /* G_DISABLE_DEPRECATED */
173
174#endif
175
176G_END_DECLS
177
178#endif /* __G_STRING_H__ */
179
180