You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

163 lines
5.4 KiB

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