Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gconvert.h
Go to the documentation of this file.
1/* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20/*
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25 */
26
27#ifndef __G_CONVERT_H__
28#define __G_CONVERT_H__
29
30#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
31#error "Only <glib.h> can be included directly."
32#endif
33
34#include <glib/gerror.h>
35
37
38/**
39 * GConvertError:
40 * @G_CONVERT_ERROR_NO_CONVERSION: Conversion between the requested character
41 * sets is not supported.
42 * @G_CONVERT_ERROR_ILLEGAL_SEQUENCE: Invalid byte sequence in conversion input;
43 * or the character sequence could not be represented in the target
44 * character set.
45 * @G_CONVERT_ERROR_FAILED: Conversion failed for some reason.
46 * @G_CONVERT_ERROR_PARTIAL_INPUT: Partial character sequence at end of input.
47 * @G_CONVERT_ERROR_BAD_URI: URI is invalid.
48 * @G_CONVERT_ERROR_NOT_ABSOLUTE_PATH: Pathname is not an absolute path.
49 * @G_CONVERT_ERROR_NO_MEMORY: No memory available. Since: 2.40
50 * @G_CONVERT_ERROR_EMBEDDED_NUL: An embedded NUL character is present in
51 * conversion output where a NUL-terminated string is expected.
52 * Since: 2.56
53 *
54 * Error codes returned by character set conversion routines.
55 */
67
68/**
69 * G_CONVERT_ERROR:
70 *
71 * Error domain for character set conversions. Errors in this domain will
72 * be from the #GConvertError enumeration. See #GError for information on
73 * error domains.
74 */
75#define G_CONVERT_ERROR g_convert_error_quark()
78
79/**
80 * GIConv: (skip)
81 *
82 * The GIConv struct wraps an iconv() conversion descriptor. It contains
83 * private data and should only be accessed using the following functions.
84 */
85typedef struct _GIConv *GIConv;
86
88GIConv g_iconv_open (const gchar *to_codeset,
89 const gchar *from_codeset);
91gsize g_iconv (GIConv converter,
92 gchar **inbuf,
93 gsize *inbytes_left,
94 gchar **outbuf,
95 gsize *outbytes_left);
98
99
101gchar* g_convert (const gchar *str,
102 gssize len,
103 const gchar *to_codeset,
104 const gchar *from_codeset,
105 gsize *bytes_read,
106 gsize *bytes_written,
107 GError **error) G_GNUC_MALLOC;
110 gssize len,
111 GIConv converter,
112 gsize *bytes_read,
113 gsize *bytes_written,
114 GError **error) G_GNUC_MALLOC;
117 gssize len,
118 const gchar *to_codeset,
119 const gchar *from_codeset,
120 const gchar *fallback,
121 gsize *bytes_read,
122 gsize *bytes_written,
123 GError **error) G_GNUC_MALLOC;
124
125
126/* Convert between libc's idea of strings and UTF-8.
127 */
129gchar* g_locale_to_utf8 (const gchar *opsysstring,
130 gssize len,
131 gsize *bytes_read,
132 gsize *bytes_written,
133 GError **error) G_GNUC_MALLOC;
135gchar* g_locale_from_utf8 (const gchar *utf8string,
136 gssize len,
137 gsize *bytes_read,
138 gsize *bytes_written,
139 GError **error) G_GNUC_MALLOC;
140
141/* Convert between the operating system (or C runtime)
142 * representation of file names and UTF-8.
143 */
145gchar* g_filename_to_utf8 (const gchar *opsysstring,
146 gssize len,
147 gsize *bytes_read,
148 gsize *bytes_written,
149 GError **error) G_GNUC_MALLOC;
151gchar* g_filename_from_utf8 (const gchar *utf8string,
152 gssize len,
153 gsize *bytes_read,
154 gsize *bytes_written,
155 GError **error) G_GNUC_MALLOC;
156
159 gchar **hostname,
160 GError **error) G_GNUC_MALLOC;
161
163gchar *g_filename_to_uri (const gchar *filename,
164 const gchar *hostname,
165 GError **error) G_GNUC_MALLOC;
169gboolean g_get_filename_charsets (const gchar ***filename_charsets);
170
173
176
178
179#endif /* __G_CONVERT_H__ */
GLIB_AVAILABLE_IN_ALL GIConv g_iconv_open(const gchar *to_codeset, const gchar *from_codeset)
GLIB_AVAILABLE_IN_ALL gchar * g_filename_from_utf8(const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_convert_with_iconv(const gchar *str, gssize len, GIConv converter, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_filename_display_basename(const gchar *filename) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gboolean g_get_filename_charsets(const gchar ***filename_charsets)
GLIB_AVAILABLE_IN_ALL GQuark g_convert_error_quark(void)
struct _GIConv * GIConv
Definition gconvert.h:85
GLIB_AVAILABLE_IN_ALL gchar ** g_uri_list_extract_uris(const gchar *uri_list)
GLIB_AVAILABLE_IN_ALL gchar * g_filename_to_uri(const gchar *filename, const gchar *hostname, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_filename_from_uri(const gchar *uri, gchar **hostname, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_convert_with_fallback(const gchar *str, gssize len, const gchar *to_codeset, const gchar *from_codeset, const gchar *fallback, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_filename_display_name(const gchar *filename) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_locale_from_utf8(const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_convert(const gchar *str, gssize len, const gchar *to_codeset, const gchar *from_codeset, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gchar * g_filename_to_utf8(const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GLIB_AVAILABLE_IN_ALL gint g_iconv_close(GIConv converter)
GLIB_AVAILABLE_IN_ALL gchar * g_locale_to_utf8(const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) G_GNUC_MALLOC
GConvertError
Definition gconvert.h:57
@ G_CONVERT_ERROR_FAILED
Definition gconvert.h:60
@ G_CONVERT_ERROR_ILLEGAL_SEQUENCE
Definition gconvert.h:59
@ G_CONVERT_ERROR_NOT_ABSOLUTE_PATH
Definition gconvert.h:63
@ G_CONVERT_ERROR_BAD_URI
Definition gconvert.h:62
@ G_CONVERT_ERROR_NO_MEMORY
Definition gconvert.h:64
@ G_CONVERT_ERROR_NO_CONVERSION
Definition gconvert.h:58
@ G_CONVERT_ERROR_EMBEDDED_NUL
Definition gconvert.h:65
@ G_CONVERT_ERROR_PARTIAL_INPUT
Definition gconvert.h:61
GLIB_AVAILABLE_IN_ALL gsize g_iconv(GIConv converter, gchar **inbuf, gsize *inbytes_left, gchar **outbuf, gsize *outbytes_left)
#define GLIB_AVAILABLE_IN_ALL
signed long gssize
Definition glibconfig.h:82
unsigned long gsize
Definition glibconfig.h:83
#define G_GNUC_MALLOC
Definition gmacros.h:293
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
G_BEGIN_DECLS typedef guint32 GQuark
Definition gquark.h:38
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
int gint
Definition gtypes.h:55
static void error(LoadState *S, const char *why)