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