williamr@2
|
1 |
/* GLIB - Library of useful routines for C programming
|
williamr@2
|
2 |
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
williamr@2
|
3 |
* Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* This library is free software; you can redistribute it and/or
|
williamr@2
|
6 |
* modify it under the terms of the GNU Lesser General Public
|
williamr@2
|
7 |
* License as published by the Free Software Foundation; either
|
williamr@2
|
8 |
* version 2 of the License, or (at your option) any later version.
|
williamr@2
|
9 |
*
|
williamr@2
|
10 |
* This library is distributed in the hope that it will be useful,
|
williamr@2
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
williamr@2
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
williamr@2
|
13 |
* Lesser General Public License for more details.
|
williamr@2
|
14 |
*
|
williamr@2
|
15 |
* You should have received a copy of the GNU Lesser General Public
|
williamr@2
|
16 |
* License along with this library; if not, write to the
|
williamr@2
|
17 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
williamr@2
|
18 |
* Boston, MA 02111-1307, USA.
|
williamr@2
|
19 |
*/
|
williamr@2
|
20 |
|
williamr@2
|
21 |
/*
|
williamr@2
|
22 |
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
williamr@2
|
23 |
* file for a list of people on the GLib Team. See the ChangeLog
|
williamr@2
|
24 |
* files for a list of changes. These files are distributed with
|
williamr@2
|
25 |
* GLib at ftp://ftp.gtk.org/pub/gtk/.
|
williamr@2
|
26 |
*/
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef __G_CONVERT_H__
|
williamr@2
|
29 |
#define __G_CONVERT_H__
|
williamr@2
|
30 |
|
williamr@2
|
31 |
#include <_ansi.h>
|
williamr@2
|
32 |
#include <stddef.h> /* For size_t */
|
williamr@2
|
33 |
#include <glib/gerror.h>
|
williamr@2
|
34 |
|
williamr@2
|
35 |
G_BEGIN_DECLS
|
williamr@2
|
36 |
|
williamr@2
|
37 |
typedef enum
|
williamr@2
|
38 |
{
|
williamr@2
|
39 |
G_CONVERT_ERROR_NO_CONVERSION,
|
williamr@2
|
40 |
G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
|
williamr@2
|
41 |
G_CONVERT_ERROR_FAILED,
|
williamr@2
|
42 |
G_CONVERT_ERROR_PARTIAL_INPUT,
|
williamr@2
|
43 |
G_CONVERT_ERROR_BAD_URI,
|
williamr@2
|
44 |
G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
|
williamr@2
|
45 |
} GConvertError;
|
williamr@2
|
46 |
|
williamr@2
|
47 |
#define G_CONVERT_ERROR g_convert_error_quark()
|
williamr@2
|
48 |
IMPORT_C GQuark g_convert_error_quark (void);
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/* Thin wrappers around iconv
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
typedef struct _GIConv *GIConv;
|
williamr@2
|
53 |
|
williamr@2
|
54 |
IMPORT_C GIConv g_iconv_open (const gchar *to_codeset,
|
williamr@2
|
55 |
const gchar *from_codeset);
|
williamr@2
|
56 |
IMPORT_C size_t g_iconv (GIConv converter,
|
williamr@2
|
57 |
gchar **inbuf,
|
williamr@2
|
58 |
gsize *inbytes_left,
|
williamr@2
|
59 |
gchar **outbuf,
|
williamr@2
|
60 |
gsize *outbytes_left);
|
williamr@2
|
61 |
IMPORT_C gint g_iconv_close (GIConv converter);
|
williamr@2
|
62 |
|
williamr@2
|
63 |
|
williamr@2
|
64 |
IMPORT_C gchar* g_convert (const gchar *str,
|
williamr@2
|
65 |
gssize len,
|
williamr@2
|
66 |
const gchar *to_codeset,
|
williamr@2
|
67 |
const gchar *from_codeset,
|
williamr@2
|
68 |
gsize *bytes_read,
|
williamr@2
|
69 |
gsize *bytes_written,
|
williamr@2
|
70 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
71 |
IMPORT_C gchar* g_convert_with_iconv (const gchar *str,
|
williamr@2
|
72 |
gssize len,
|
williamr@2
|
73 |
GIConv converter,
|
williamr@2
|
74 |
gsize *bytes_read,
|
williamr@2
|
75 |
gsize *bytes_written,
|
williamr@2
|
76 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
77 |
IMPORT_C gchar* g_convert_with_fallback (const gchar *str,
|
williamr@2
|
78 |
gssize len,
|
williamr@2
|
79 |
const gchar *to_codeset,
|
williamr@2
|
80 |
const gchar *from_codeset,
|
williamr@2
|
81 |
gchar *fallback,
|
williamr@2
|
82 |
gsize *bytes_read,
|
williamr@2
|
83 |
gsize *bytes_written,
|
williamr@2
|
84 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
85 |
|
williamr@2
|
86 |
|
williamr@2
|
87 |
/* Convert between libc's idea of strings and UTF-8.
|
williamr@2
|
88 |
*/
|
williamr@2
|
89 |
IMPORT_C gchar* g_locale_to_utf8 (const gchar *opsysstring,
|
williamr@2
|
90 |
gssize len,
|
williamr@2
|
91 |
gsize *bytes_read,
|
williamr@2
|
92 |
gsize *bytes_written,
|
williamr@2
|
93 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
94 |
IMPORT_C gchar* g_locale_from_utf8 (const gchar *utf8string,
|
williamr@2
|
95 |
gssize len,
|
williamr@2
|
96 |
gsize *bytes_read,
|
williamr@2
|
97 |
gsize *bytes_written,
|
williamr@2
|
98 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/* Convert between the operating system (or C runtime)
|
williamr@2
|
101 |
* representation of file names and UTF-8.
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
#ifdef G_OS_WIN32
|
williamr@2
|
104 |
#define g_filename_to_utf8 g_filename_to_utf8_utf8
|
williamr@2
|
105 |
#define g_filename_from_utf8 g_filename_from_utf8_utf8
|
williamr@2
|
106 |
#define g_filename_from_uri g_filename_from_uri_utf8
|
williamr@2
|
107 |
#define g_filename_to_uri g_filename_to_uri_utf8
|
williamr@2
|
108 |
#endif
|
williamr@2
|
109 |
|
williamr@2
|
110 |
IMPORT_C gchar* g_filename_to_utf8 (const gchar *opsysstring,
|
williamr@2
|
111 |
gssize len,
|
williamr@2
|
112 |
gsize *bytes_read,
|
williamr@2
|
113 |
gsize *bytes_written,
|
williamr@2
|
114 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
115 |
IMPORT_C gchar* g_filename_from_utf8 (const gchar *utf8string,
|
williamr@2
|
116 |
gssize len,
|
williamr@2
|
117 |
gsize *bytes_read,
|
williamr@2
|
118 |
gsize *bytes_written,
|
williamr@2
|
119 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
120 |
|
williamr@2
|
121 |
IMPORT_C gchar *g_filename_from_uri (const gchar *uri,
|
williamr@2
|
122 |
gchar **hostname,
|
williamr@2
|
123 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
124 |
|
williamr@2
|
125 |
IMPORT_C gchar *g_filename_to_uri (const gchar *filename,
|
williamr@2
|
126 |
const gchar *hostname,
|
williamr@2
|
127 |
GError **error) G_GNUC_MALLOC;
|
williamr@2
|
128 |
IMPORT_C gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC;
|
williamr@2
|
129 |
IMPORT_C gboolean g_get_filename_charsets (G_CONST_RETURN gchar ***charsets);
|
williamr@2
|
130 |
|
williamr@2
|
131 |
IMPORT_C gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC;
|
williamr@2
|
132 |
|
williamr@2
|
133 |
IMPORT_C gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC;
|
williamr@2
|
134 |
|
williamr@2
|
135 |
G_END_DECLS
|
williamr@2
|
136 |
|
williamr@2
|
137 |
#endif /* __G_CONVERT_H__ */
|