gconvert.h

Go to the documentation of this file.
00001 /* GLIB - Library of useful routines for C programming
00002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00003  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 /*
00022  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00023  * file for a list of people on the GLib Team.  See the ChangeLog
00024  * files for a list of changes.  These files are distributed with
00025  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
00026  */
00027 
00028 #ifndef __G_CONVERT_H__
00029 #define __G_CONVERT_H__
00030 
00031 #include <_ansi.h>
00032 #include <stddef.h>      /* For size_t */
00033 #include <glib/gerror.h>
00034 
00035 G_BEGIN_DECLS
00036 
00037 typedef enum 
00038 {
00039   G_CONVERT_ERROR_NO_CONVERSION,
00040   G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
00041   G_CONVERT_ERROR_FAILED,
00042   G_CONVERT_ERROR_PARTIAL_INPUT,
00043   G_CONVERT_ERROR_BAD_URI,
00044   G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
00045 } GConvertError;
00046 
00047 #define G_CONVERT_ERROR g_convert_error_quark()
00048 IMPORT_C GQuark g_convert_error_quark (void);
00049 
00050 /* Thin wrappers around iconv
00051  */
00052 typedef struct _GIConv *GIConv;
00053 
00054 IMPORT_C GIConv g_iconv_open   (const gchar  *to_codeset,
00055                        const gchar  *from_codeset);
00056 IMPORT_C size_t g_iconv        (GIConv        converter,
00057                        gchar       **inbuf,
00058                        gsize        *inbytes_left,
00059                        gchar       **outbuf,
00060                        gsize        *outbytes_left);
00061 IMPORT_C gint   g_iconv_close  (GIConv        converter);
00062 
00063 
00064 IMPORT_C gchar* g_convert               (const gchar  *str,
00065                                 gssize        len,            
00066                                 const gchar  *to_codeset,
00067                                 const gchar  *from_codeset,
00068                                 gsize        *bytes_read,     
00069                                 gsize        *bytes_written,  
00070                                 GError      **error) G_GNUC_MALLOC;
00071 IMPORT_C gchar* g_convert_with_iconv    (const gchar  *str,
00072                                 gssize        len,
00073                                 GIConv        converter,
00074                                 gsize        *bytes_read,     
00075                                 gsize        *bytes_written,  
00076                                 GError      **error) G_GNUC_MALLOC;
00077 IMPORT_C  gchar* g_convert_with_fallback (const gchar  *str,
00078                                 gssize        len,            
00079                                 const gchar  *to_codeset,
00080                                 const gchar  *from_codeset,
00081                                 gchar        *fallback,
00082                                 gsize        *bytes_read,     
00083                                 gsize        *bytes_written,  
00084                                 GError      **error) G_GNUC_MALLOC;
00085 
00086 
00087 /* Convert between libc's idea of strings and UTF-8.
00088  */
00089 IMPORT_C gchar* g_locale_to_utf8   (const gchar  *opsysstring,
00090                            gssize        len,            
00091                            gsize        *bytes_read,     
00092                            gsize        *bytes_written,  
00093                            GError      **error) G_GNUC_MALLOC;
00094 IMPORT_C gchar* g_locale_from_utf8 (const gchar  *utf8string,
00095                            gssize        len,            
00096                            gsize        *bytes_read,     
00097                            gsize        *bytes_written,  
00098                            GError      **error) G_GNUC_MALLOC;
00099 
00100 /* Convert between the operating system (or C runtime)
00101  * representation of file names and UTF-8.
00102  */
00103 #ifdef G_OS_WIN32
00104 #define g_filename_to_utf8 g_filename_to_utf8_utf8
00105 #define g_filename_from_utf8 g_filename_from_utf8_utf8
00106 #define g_filename_from_uri g_filename_from_uri_utf8
00107 #define g_filename_to_uri g_filename_to_uri_utf8 
00108 #endif
00109 
00110 IMPORT_C gchar* g_filename_to_utf8   (const gchar  *opsysstring,
00111                              gssize        len,            
00112                              gsize        *bytes_read,     
00113                              gsize        *bytes_written,  
00114                              GError      **error) G_GNUC_MALLOC;
00115 IMPORT_C gchar* g_filename_from_utf8 (const gchar  *utf8string,
00116                              gssize        len,            
00117                              gsize        *bytes_read,     
00118                              gsize        *bytes_written,  
00119                              GError      **error) G_GNUC_MALLOC;
00120 
00121 IMPORT_C gchar *g_filename_from_uri (const gchar *uri,
00122                             gchar      **hostname,
00123                             GError     **error) G_GNUC_MALLOC;
00124   
00125 IMPORT_C gchar *g_filename_to_uri   (const gchar *filename,
00126                             const gchar *hostname,
00127                             GError     **error) G_GNUC_MALLOC;
00128 IMPORT_C gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC;
00129 IMPORT_C gboolean g_get_filename_charsets (G_CONST_RETURN gchar ***charsets);
00130 
00131 IMPORT_C gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC;
00132 
00133 IMPORT_C gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC;
00134 
00135 G_END_DECLS
00136 
00137 #endif /* __G_CONVERT_H__ */

Copyright © Nokia Corporation 2001-2008
Back to top