(root)/
gettext-0.22.4/
libtextstyle/
lib/
glib/
gstring.in.h
       1  /* GLIB - Library of useful routines for C programming
       2   * Copyright (C) 2006-2019 Free Software Foundation, Inc.
       3   *
       4   * This file is not part of the GNU gettext program, but is used with
       5   * GNU gettext.
       6   *
       7   * The original copyright notice is as follows:
       8   */
       9  
      10  /* GLIB - Library of useful routines for C programming
      11   * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
      12   *
      13   * This library is free software; you can redistribute it and/or
      14   * modify it under the terms of the GNU Lesser General Public
      15   * License as published by the Free Software Foundation; either
      16   * version 2 of the License, or (at your option) any later version.
      17   *
      18   * This library is distributed in the hope that it will be useful,
      19   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      20   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
      21   * Lesser General Public License for more details.
      22   *
      23   * You should have received a copy of the GNU Lesser General Public
      24   * License along with this library; if not, write to the
      25   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      26   * Boston, MA 02111-1307, USA.
      27   */
      28  
      29  /*
      30   * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
      31   * file for a list of people on the GLib Team.  See the ChangeLog
      32   * files for a list of changes.  These files are distributed with
      33   * GLib at ftp://ftp.gtk.org/pub/gtk/. 
      34   */
      35  
      36  /*
      37   * Modified by Bruno Haible for use as a gnulib module.
      38   */
      39  
      40  #ifndef __G_STRING_H__
      41  #define __G_STRING_H__
      42  
      43  #include <glib/gtypes.h>
      44  #if 0
      45  #include <glib/gunicode.h>
      46  #include <glib/gutils.h>  /* for G_CAN_INLINE */
      47  #endif
      48  
      49  G_BEGIN_DECLS
      50  
      51  typedef struct _GString		GString;
      52  #if 0
      53  typedef struct _GStringChunk	GStringChunk;
      54  #endif
      55  
      56  struct _GString
      57  {
      58    gchar  *str;
      59    gsize len;    
      60    gsize allocated_len;
      61  };
      62  
      63  #if 0
      64  /* String Chunks
      65   */
      66  GStringChunk* g_string_chunk_new	   (gsize size);  
      67  void	      g_string_chunk_free	   (GStringChunk *chunk);
      68  gchar*	      g_string_chunk_insert	   (GStringChunk *chunk,
      69  					    const gchar	 *string);
      70  gchar*	      g_string_chunk_insert_len	   (GStringChunk *chunk,
      71  					    const gchar	 *string,
      72  					    gssize        len);
      73  gchar*	      g_string_chunk_insert_const  (GStringChunk *chunk,
      74  					    const gchar	 *string);
      75  #endif
      76  
      77  
      78  /* Strings
      79   */
      80  GString*     g_string_new	        (const gchar	 *init);
      81  GString*     g_string_new_len           (const gchar     *init,
      82                                           gssize           len);   
      83  #if 0
      84  GString*     g_string_sized_new         (gsize            dfl_size);  
      85  #endif
      86  gchar*	     g_string_free	        (GString	 *string,
      87  					 gboolean	  free_segment);
      88  #if 0
      89  gboolean     g_string_equal             (const GString	 *v,
      90  					 const GString 	 *v2);
      91  guint        g_string_hash              (const GString   *str);
      92  GString*     g_string_assign            (GString	 *string,
      93  					 const gchar	 *rval);
      94  GString*     g_string_truncate          (GString	 *string,
      95  					 gsize		  len);    
      96  GString*     g_string_set_size          (GString         *string,
      97  					 gsize            len);
      98  GString*     g_string_insert_len        (GString         *string,
      99                                           gssize           pos,   
     100                                           const gchar     *val,
     101                                           gssize           len);  
     102  #endif
     103  GString*     g_string_append            (GString	 *string,
     104  			                 const gchar	 *val);
     105  GString*     g_string_append_len        (GString	 *string,
     106  			                 const gchar	 *val,
     107                                           gssize           len);  
     108  GString*     g_string_append_c          (GString	 *string,
     109  					 gchar		  c);
     110  GString*     g_string_append_unichar    (GString	 *string,
     111  					 gunichar	  wc);
     112  #if 0
     113  GString*     g_string_prepend           (GString	 *string,
     114  					 const gchar	 *val);
     115  GString*     g_string_prepend_c         (GString	 *string,
     116  					 gchar		  c);
     117  GString*     g_string_prepend_unichar   (GString	 *string,
     118  					 gunichar	  wc);
     119  GString*     g_string_prepend_len       (GString	 *string,
     120  			                 const gchar	 *val,
     121                                           gssize           len);  
     122  GString*     g_string_insert            (GString	 *string,
     123  					 gssize		  pos,    
     124  					 const gchar	 *val);
     125  #endif
     126  GString*     g_string_insert_c          (GString	 *string,
     127  					 gssize		  pos,    
     128  					 gchar		  c);
     129  GString*     g_string_insert_unichar    (GString	 *string,
     130  					 gssize		  pos,    
     131  					 gunichar	  wc);
     132  #if 0
     133  GString*     g_string_erase	        (GString	 *string,
     134  					 gssize		  pos,
     135  					 gssize		  len);
     136  GString*     g_string_ascii_down        (GString	 *string);
     137  GString*     g_string_ascii_up          (GString	 *string);
     138  void         g_string_printf            (GString	 *string,
     139  					 const gchar	 *format,
     140  					 ...) G_GNUC_PRINTF (2, 3);
     141  #endif
     142  void         g_string_append_printf     (GString	 *string,
     143  					 const gchar	 *format,
     144  					 ...) G_GNUC_PRINTF (2, 3);
     145  
     146  #if 0
     147  
     148  /* -- optimize g_strig_append_c --- */
     149  #ifdef G_CAN_INLINE
     150  static inline GString*
     151  g_string_append_c_inline (GString *gstring,
     152                            gchar    c)
     153  {
     154    if (gstring->len + 1 < gstring->allocated_len)
     155      {
     156        gstring->str[gstring->len++] = c;
     157        gstring->str[gstring->len] = 0;
     158      }
     159    else
     160      g_string_insert_c (gstring, -1, c);
     161    return gstring;
     162  }
     163  #define g_string_append_c(gstr,c)       g_string_append_c_inline (gstr, c)
     164  #endif /* G_CAN_INLINE */
     165  
     166  
     167  #ifndef G_DISABLE_DEPRECATED
     168  
     169  /* The following two functions are deprecated and will be removed in
     170   * the next major release. They use the locale-specific tolower and
     171   * toupper, which is almost never the right thing.
     172   */
     173  
     174  GString*     g_string_down              (GString	 *string);
     175  GString*     g_string_up                (GString	 *string);
     176  
     177  /* These aliases are included for compatibility. */
     178  #define	g_string_sprintf	g_string_printf
     179  #define	g_string_sprintfa	g_string_append_printf
     180  
     181  #endif /* G_DISABLE_DEPRECATED */
     182  
     183  #endif
     184  
     185  G_END_DECLS
     186  
     187  #endif /* __G_STRING_H__ */
     188