Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-06 08:41:16

0001 /* GLIB - Library of useful routines for C programming
0002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 /*
0021  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
0022  * file for a list of people on the GLib Team.  See the ChangeLog
0023  * files for a list of changes.  These files are distributed with
0024  * GLib at ftp://ftp.gtk.org/pub/gtk/.
0025  */
0026 
0027 #ifndef __G_CONVERT_H__
0028 #define __G_CONVERT_H__
0029 
0030 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0031 #error "Only <glib.h> can be included directly."
0032 #endif
0033 
0034 #include <glib/gerror.h>
0035 
0036 G_BEGIN_DECLS
0037 
0038 /**
0039  * GConvertError:
0040  * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character
0041  *     sets is not supported.
0042  * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input;
0043  *    or the character sequence could not be represented in the target
0044  *    character set.
0045  * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason.
0046  * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input.
0047  * @G_CONVERT_ERROR_BAD_URI: URI is invalid.
0048  * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path.
0049  * @G_CONVERT_ERROR_NO_MEMORY: No memory available. Since: 2.40
0050  * @G_CONVERT_ERROR_EMBEDDED_NUL: An embedded NUL character is present in
0051  *     conversion output where a NUL-terminated string is expected.
0052  *     Since: 2.56
0053  *
0054  * Error codes returned by character set conversion routines.
0055  */
0056 typedef enum
0057 {
0058   G_CONVERT_ERROR_NO_CONVERSION,
0059   G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
0060   G_CONVERT_ERROR_FAILED,
0061   G_CONVERT_ERROR_PARTIAL_INPUT,
0062   G_CONVERT_ERROR_BAD_URI,
0063   G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
0064   G_CONVERT_ERROR_NO_MEMORY,
0065   G_CONVERT_ERROR_EMBEDDED_NUL
0066 } GConvertError;
0067 
0068 /**
0069  * G_CONVERT_ERROR:
0070  *
0071  * Error domain for character set conversions. Errors in this domain will
0072  * be from the #GConvertError enumeration. See #GError for information on
0073  * error domains.
0074  */
0075 #define G_CONVERT_ERROR g_convert_error_quark()
0076 GLIB_AVAILABLE_IN_ALL
0077 GQuark g_convert_error_quark (void);
0078 
0079 /**
0080  * GIConv: (skip)
0081  *
0082  * The GIConv struct wraps an iconv() conversion descriptor. It contains
0083  * private data and should only be accessed using the following functions.
0084  */
0085 typedef struct _GIConv *GIConv;
0086 
0087 GLIB_AVAILABLE_IN_ALL
0088 GIConv g_iconv_open   (const gchar  *to_codeset,
0089                const gchar  *from_codeset);
0090 GLIB_AVAILABLE_IN_ALL
0091 gsize  g_iconv        (GIConv        converter,
0092                gchar       **inbuf,
0093                gsize        *inbytes_left,
0094                gchar       **outbuf,
0095                gsize        *outbytes_left);
0096 GLIB_AVAILABLE_IN_ALL
0097 gint   g_iconv_close  (GIConv        converter);
0098 
0099 
0100 GLIB_AVAILABLE_IN_ALL
0101 gchar* g_convert               (const gchar  *str,
0102                 gssize        len,            
0103                 const gchar  *to_codeset,
0104                 const gchar  *from_codeset,
0105                 gsize        *bytes_read,     
0106                 gsize        *bytes_written,  
0107                 GError      **error) G_GNUC_MALLOC;
0108 GLIB_AVAILABLE_IN_ALL
0109 gchar* g_convert_with_iconv    (const gchar  *str,
0110                 gssize        len,
0111                 GIConv        converter,
0112                 gsize        *bytes_read,     
0113                 gsize        *bytes_written,  
0114                 GError      **error) G_GNUC_MALLOC;
0115 GLIB_AVAILABLE_IN_ALL
0116 gchar* g_convert_with_fallback (const gchar  *str,
0117                 gssize        len,            
0118                 const gchar  *to_codeset,
0119                 const gchar  *from_codeset,
0120                 const gchar  *fallback,
0121                 gsize        *bytes_read,     
0122                 gsize        *bytes_written,  
0123                 GError      **error) G_GNUC_MALLOC;
0124 
0125 
0126 /* Convert between libc's idea of strings and UTF-8.
0127  */
0128 GLIB_AVAILABLE_IN_ALL
0129 gchar* g_locale_to_utf8   (const gchar  *opsysstring,
0130                gssize        len,            
0131                gsize        *bytes_read,     
0132                gsize        *bytes_written,  
0133                GError      **error) G_GNUC_MALLOC;
0134 GLIB_AVAILABLE_IN_ALL
0135 gchar* g_locale_from_utf8 (const gchar  *utf8string,
0136                gssize        len,            
0137                gsize        *bytes_read,     
0138                gsize        *bytes_written,  
0139                GError      **error) G_GNUC_MALLOC;
0140 
0141 /* Convert between the operating system (or C runtime)
0142  * representation of file names and UTF-8.
0143  */
0144 GLIB_AVAILABLE_IN_ALL
0145 gchar* g_filename_to_utf8   (const gchar  *opsysstring,
0146                  gssize        len,            
0147                  gsize        *bytes_read,     
0148                  gsize        *bytes_written,  
0149                  GError      **error) G_GNUC_MALLOC;
0150 GLIB_AVAILABLE_IN_ALL
0151 gchar* g_filename_from_utf8 (const gchar  *utf8string,
0152                  gssize        len,            
0153                  gsize        *bytes_read,     
0154                  gsize        *bytes_written,  
0155                  GError      **error) G_GNUC_MALLOC;
0156 
0157 GLIB_AVAILABLE_IN_ALL
0158 gchar *g_filename_from_uri (const gchar *uri,
0159                 gchar      **hostname,
0160                 GError     **error) G_GNUC_MALLOC;
0161   
0162 GLIB_AVAILABLE_IN_ALL
0163 gchar *g_filename_to_uri   (const gchar *filename,
0164                 const gchar *hostname,
0165                 GError     **error) G_GNUC_MALLOC;
0166 GLIB_AVAILABLE_IN_ALL
0167 gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC;
0168 GLIB_AVAILABLE_IN_ALL
0169 gboolean g_get_filename_charsets (const gchar ***filename_charsets);
0170 
0171 GLIB_AVAILABLE_IN_ALL
0172 gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC;
0173 
0174 GLIB_AVAILABLE_IN_ALL
0175 gchar **g_uri_list_extract_uris (const gchar *uri_list);
0176 
0177 G_END_DECLS
0178 
0179 #endif /* __G_CONVERT_H__ */