Blame glib/gconvert.h

Packit ae235b
/* GLIB - Library of useful routines for C programming
Packit ae235b
 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public
Packit ae235b
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
/*
Packit ae235b
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
Packit ae235b
 * file for a list of people on the GLib Team.  See the ChangeLog
Packit ae235b
 * files for a list of changes.  These files are distributed with
Packit ae235b
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __G_CONVERT_H__
Packit ae235b
#define __G_CONVERT_H__
Packit ae235b
Packit ae235b
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
Packit ae235b
#error "Only <glib.h> can be included directly."
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#include <glib/gerror.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GConvertError:
Packit ae235b
 * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character
Packit ae235b
 *     sets is not supported.
Packit ae235b
 * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input;
Packit ae235b
 *    or the character sequence could not be represented in the target
Packit ae235b
 *    character set.
Packit ae235b
 * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason.
Packit ae235b
 * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input.
Packit ae235b
 * @G_CONVERT_ERROR_BAD_URI: URI is invalid.
Packit ae235b
 * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path.
Packit ae235b
 * @G_CONVERT_ERROR_NO_MEMORY: No memory available. Since: 2.40
Packit ae235b
 * @G_CONVERT_ERROR_EMBEDDED_NUL: An embedded NUL character is present in
Packit ae235b
 *     conversion output where a NUL-terminated string is expected.
Packit ae235b
 *     Since: 2.56
Packit ae235b
 *
Packit ae235b
 * Error codes returned by character set conversion routines.
Packit ae235b
 */
Packit ae235b
typedef enum
Packit ae235b
{
Packit ae235b
  G_CONVERT_ERROR_NO_CONVERSION,
Packit ae235b
  G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
Packit ae235b
  G_CONVERT_ERROR_FAILED,
Packit ae235b
  G_CONVERT_ERROR_PARTIAL_INPUT,
Packit ae235b
  G_CONVERT_ERROR_BAD_URI,
Packit ae235b
  G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
Packit ae235b
  G_CONVERT_ERROR_NO_MEMORY,
Packit ae235b
  G_CONVERT_ERROR_EMBEDDED_NUL
Packit ae235b
} GConvertError;
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_CONVERT_ERROR:
Packit ae235b
 *
Packit ae235b
 * Error domain for character set conversions. Errors in this domain will
Packit ae235b
 * be from the #GConvertError enumeration. See #GError for information on
Packit ae235b
 * error domains.
Packit ae235b
 */
Packit ae235b
#define G_CONVERT_ERROR g_convert_error_quark()
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GQuark g_convert_error_quark (void);
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GIConv: (skip)
Packit ae235b
 *
Packit ae235b
 * The GIConv struct wraps an iconv() conversion descriptor. It contains
Packit ae235b
 * private data and should only be accessed using the following functions.
Packit ae235b
 */
Packit ae235b
typedef struct _GIConv *GIConv;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GIConv g_iconv_open   (const gchar  *to_codeset,
Packit ae235b
		       const gchar  *from_codeset);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gsize  g_iconv        (GIConv        converter,
Packit ae235b
		       gchar       **inbuf,
Packit ae235b
		       gsize        *inbytes_left,
Packit ae235b
		       gchar       **outbuf,
Packit ae235b
		       gsize        *outbytes_left);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gint   g_iconv_close  (GIConv        converter);
Packit ae235b
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_convert               (const gchar  *str,
Packit ae235b
				gssize        len,            
Packit ae235b
				const gchar  *to_codeset,
Packit ae235b
				const gchar  *from_codeset,
Packit ae235b
				gsize        *bytes_read,     
Packit ae235b
				gsize        *bytes_written,  
Packit ae235b
				GError      **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_convert_with_iconv    (const gchar  *str,
Packit ae235b
				gssize        len,
Packit ae235b
				GIConv        converter,
Packit ae235b
				gsize        *bytes_read,     
Packit ae235b
				gsize        *bytes_written,  
Packit ae235b
				GError      **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_convert_with_fallback (const gchar  *str,
Packit ae235b
				gssize        len,            
Packit ae235b
				const gchar  *to_codeset,
Packit ae235b
				const gchar  *from_codeset,
Packit ae235b
				const gchar  *fallback,
Packit ae235b
				gsize        *bytes_read,     
Packit ae235b
				gsize        *bytes_written,  
Packit ae235b
				GError      **error) G_GNUC_MALLOC;
Packit ae235b
Packit ae235b
Packit ae235b
/* Convert between libc's idea of strings and UTF-8.
Packit ae235b
 */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_locale_to_utf8   (const gchar  *opsysstring,
Packit ae235b
			   gssize        len,            
Packit ae235b
			   gsize        *bytes_read,     
Packit ae235b
			   gsize        *bytes_written,  
Packit ae235b
			   GError      **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_locale_from_utf8 (const gchar  *utf8string,
Packit ae235b
			   gssize        len,            
Packit ae235b
			   gsize        *bytes_read,     
Packit ae235b
			   gsize        *bytes_written,  
Packit ae235b
			   GError      **error) G_GNUC_MALLOC;
Packit ae235b
Packit ae235b
/* Convert between the operating system (or C runtime)
Packit ae235b
 * representation of file names and UTF-8.
Packit ae235b
 */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_filename_to_utf8   (const gchar  *opsysstring,
Packit ae235b
			     gssize        len,            
Packit ae235b
			     gsize        *bytes_read,     
Packit ae235b
			     gsize        *bytes_written,  
Packit ae235b
			     GError      **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar* g_filename_from_utf8 (const gchar  *utf8string,
Packit ae235b
			     gssize        len,            
Packit ae235b
			     gsize        *bytes_read,     
Packit ae235b
			     gsize        *bytes_written,  
Packit ae235b
			     GError      **error) G_GNUC_MALLOC;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *g_filename_from_uri (const gchar *uri,
Packit ae235b
			    gchar      **hostname,
Packit ae235b
			    GError     **error) G_GNUC_MALLOC;
Packit ae235b
  
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *g_filename_to_uri   (const gchar *filename,
Packit ae235b
			    const gchar *hostname,
Packit ae235b
			    GError     **error) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean g_get_filename_charsets (const gchar ***charsets);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC;
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_CONVERT_H__ */