1 /*
2  * Distributed under the Boost Software License, Version 1.0.
3  *    (See accompanying file LICENSE_1_0.txt or copy at
4  *          http://www.boost.org/LICENSE_1_0.txt)
5  */
6 module glib.gconvert;
7 
8 import glib.gtypes;
9 import glib.gerror;
10 
11 
12 enum GConvertError
13 {
14   G_CONVERT_ERROR_NO_CONVERSION,
15   G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
16   G_CONVERT_ERROR_FAILED,
17   G_CONVERT_ERROR_PARTIAL_INPUT,
18   G_CONVERT_ERROR_BAD_URI,
19   G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
20   G_CONVERT_ERROR_NO_MEMORY
21 }
22 
23 //enum G_CONVERT_ERROR = g_convert_error_quark();
24 
25 struct _GIConv;
26 alias GIConv = _GIConv*;
27 
28 extern (C) {
29 
30     GQuark g_convert_error_quark ();
31 
32 
33 
34     GIConv g_iconv_open   (const(gchar)  *to_codeset,
35                    const(gchar)  *from_codeset);
36 
37     gsize  g_iconv        (GIConv        converter,
38                    gchar       **inbuf,
39                    gsize        *inbytes_left,
40                    gchar       **outbuf,
41                    gsize        *outbytes_left);
42 
43     gint   g_iconv_close  (GIConv        converter);
44 
45 
46 
47     gchar* g_convert       (const(gchar)  *str,
48                     gssize        len,
49                     const(gchar)  *to_codeset,
50                     const(gchar)  *from_codeset,
51                     gsize        *bytes_read,
52                     gsize        *bytes_written,
53                     GError      **error);
54 
55     gchar* g_convert_with_iconv    (const(gchar)  *str,
56                     gssize        len,
57                     GIConv        converter,
58                     gsize        *bytes_read,
59                     gsize        *bytes_written,
60                     GError      **error);
61 
62     gchar* g_convert_with_fallback (const(gchar)  *str,
63                     gssize        len,
64                     const(gchar)  *to_codeset,
65                     const(gchar)  *from_codeset,
66                     const(gchar)  *fallback,
67                     gsize        *bytes_read,
68                     gsize        *bytes_written,
69                     GError      **error);
70 
71 
72 
73     gchar* g_locale_to_utf8   (const(gchar)  *opsysstring,
74                    gssize        len,
75                    gsize        *bytes_read,
76                    gsize        *bytes_written,
77                    GError      **error);
78 
79     gchar* g_locale_from_utf8 (const(gchar)  *utf8string,
80                    gssize        len,
81                    gsize        *bytes_read,
82                    gsize        *bytes_written,
83                    GError      **error);
84 
85     gchar *g_filename_display_name (const(gchar) *filename);
86 
87     gboolean g_get_filename_charsets (const(gchar) ***charsets);
88 
89 
90     gchar *g_filename_display_basename (const(gchar) *filename);
91 
92 
93     gchar **g_uri_list_extract_uris (const(gchar) *uri_list);
94 
95 
96     version(Win32) {
97 
98         gchar* g_filename_to_utf8_utf8   (const(gchar)  *opsysstring,
99                                           gssize        len,
100                                           gsize        *bytes_read,
101                                           gsize        *bytes_written,
102                                           GError      **error);
103 
104         gchar* g_filename_from_utf8_utf8 (const(gchar)  *utf8string,
105                                           gssize        len,
106                                           gsize        *bytes_read,
107                                           gsize        *bytes_written,
108                                           GError      **error);
109 
110         gchar *g_filename_from_uri_utf8  (const(gchar)  *uri,
111                                           gchar       **hostname,
112                                           GError      **error);
113 
114         gchar *g_filename_to_uri_utf8    (const(gchar)  *filename,
115                                           const(gchar)  *hostname,
116                                           GError      **error);
117 
118         alias g_filename_to_utf8 = g_filename_to_utf8_utf8;
119         alias g_filename_from_utf8 = g_filename_from_utf8_utf8;
120         alias g_filename_from_uri = g_filename_from_uri_utf8;
121         alias g_filename_to_uri = g_filename_to_uri_utf8;
122     }
123     else {
124 
125         gchar* g_filename_to_utf8   (const(gchar)  *opsysstring,
126                          gssize        len,
127                          gsize        *bytes_read,
128                          gsize        *bytes_written,
129                          GError      **error);
130 
131         gchar* g_filename_from_utf8 (const(gchar)  *utf8string,
132                          gssize        len,
133                          gsize        *bytes_read,
134                          gsize        *bytes_written,
135                          GError      **error);
136 
137 
138         gchar *g_filename_from_uri (const(gchar) *uri,
139                         gchar      **hostname,
140                         GError     **error);
141 
142 
143         gchar *g_filename_to_uri   (const(gchar) *filename,
144                         const(gchar) *hostname,
145                         GError     **error);
146 
147     }
148 
149 }