williamr@2: /* GLIB - Library of useful routines for C programming williamr@2: * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald williamr@2: * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. williamr@2: * williamr@2: * This library is free software; you can redistribute it and/or williamr@2: * modify it under the terms of the GNU Lesser General Public williamr@2: * License as published by the Free Software Foundation; either williamr@2: * version 2 of the License, or (at your option) any later version. williamr@2: * williamr@2: * This library is distributed in the hope that it will be useful, williamr@2: * but WITHOUT ANY WARRANTY; without even the implied warranty of williamr@2: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU williamr@2: * Lesser General Public License for more details. williamr@2: * williamr@2: * You should have received a copy of the GNU Lesser General Public williamr@2: * License along with this library; if not, write to the williamr@2: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, williamr@2: * Boston, MA 02111-1307, USA. williamr@2: */ williamr@2: williamr@2: /* williamr@2: * Modified by the GLib Team and others 1997-2000. See the AUTHORS williamr@2: * file for a list of people on the GLib Team. See the ChangeLog williamr@2: * files for a list of changes. These files are distributed with williamr@2: * GLib at ftp://ftp.gtk.org/pub/gtk/. williamr@2: */ williamr@2: williamr@2: #ifndef __G_CONVERT_H__ williamr@2: #define __G_CONVERT_H__ williamr@2: williamr@2: #include <_ansi.h> williamr@2: #include /* For size_t */ williamr@2: #include williamr@2: williamr@2: G_BEGIN_DECLS williamr@2: williamr@2: typedef enum williamr@2: { williamr@2: G_CONVERT_ERROR_NO_CONVERSION, williamr@2: G_CONVERT_ERROR_ILLEGAL_SEQUENCE, williamr@2: G_CONVERT_ERROR_FAILED, williamr@2: G_CONVERT_ERROR_PARTIAL_INPUT, williamr@2: G_CONVERT_ERROR_BAD_URI, williamr@2: G_CONVERT_ERROR_NOT_ABSOLUTE_PATH williamr@2: } GConvertError; williamr@2: williamr@2: #define G_CONVERT_ERROR g_convert_error_quark() williamr@2: IMPORT_C GQuark g_convert_error_quark (void); williamr@2: williamr@2: /* Thin wrappers around iconv williamr@2: */ williamr@2: typedef struct _GIConv *GIConv; williamr@2: williamr@2: IMPORT_C GIConv g_iconv_open (const gchar *to_codeset, williamr@2: const gchar *from_codeset); williamr@2: IMPORT_C size_t g_iconv (GIConv converter, williamr@2: gchar **inbuf, williamr@2: gsize *inbytes_left, williamr@2: gchar **outbuf, williamr@2: gsize *outbytes_left); williamr@2: IMPORT_C gint g_iconv_close (GIConv converter); williamr@2: williamr@2: williamr@2: IMPORT_C gchar* g_convert (const gchar *str, williamr@2: gssize len, williamr@2: const gchar *to_codeset, williamr@2: const gchar *from_codeset, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: IMPORT_C gchar* g_convert_with_iconv (const gchar *str, williamr@2: gssize len, williamr@2: GIConv converter, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: IMPORT_C gchar* g_convert_with_fallback (const gchar *str, williamr@2: gssize len, williamr@2: const gchar *to_codeset, williamr@2: const gchar *from_codeset, williamr@2: gchar *fallback, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: williamr@2: williamr@2: /* Convert between libc's idea of strings and UTF-8. williamr@2: */ williamr@2: IMPORT_C gchar* g_locale_to_utf8 (const gchar *opsysstring, williamr@2: gssize len, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: IMPORT_C gchar* g_locale_from_utf8 (const gchar *utf8string, williamr@2: gssize len, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: williamr@2: /* Convert between the operating system (or C runtime) williamr@2: * representation of file names and UTF-8. williamr@2: */ williamr@2: #ifdef G_OS_WIN32 williamr@2: #define g_filename_to_utf8 g_filename_to_utf8_utf8 williamr@2: #define g_filename_from_utf8 g_filename_from_utf8_utf8 williamr@2: #define g_filename_from_uri g_filename_from_uri_utf8 williamr@2: #define g_filename_to_uri g_filename_to_uri_utf8 williamr@2: #endif williamr@2: williamr@2: IMPORT_C gchar* g_filename_to_utf8 (const gchar *opsysstring, williamr@2: gssize len, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: IMPORT_C gchar* g_filename_from_utf8 (const gchar *utf8string, williamr@2: gssize len, williamr@2: gsize *bytes_read, williamr@2: gsize *bytes_written, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: williamr@2: IMPORT_C gchar *g_filename_from_uri (const gchar *uri, williamr@2: gchar **hostname, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: williamr@2: IMPORT_C gchar *g_filename_to_uri (const gchar *filename, williamr@2: const gchar *hostname, williamr@2: GError **error) G_GNUC_MALLOC; williamr@2: IMPORT_C gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC; williamr@2: IMPORT_C gboolean g_get_filename_charsets (G_CONST_RETURN gchar ***charsets); williamr@2: williamr@2: IMPORT_C gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC; williamr@2: williamr@2: IMPORT_C gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC; williamr@2: williamr@2: G_END_DECLS williamr@2: williamr@2: #endif /* __G_CONVERT_H__ */