gdatainputstream.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2006-2007 Red Hat, Inc.
  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
  16. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * Author: Alexander Larsson <[email protected]>
  19. */
  20. #ifndef __G_DATA_INPUT_STREAM_H__
  21. #define __G_DATA_INPUT_STREAM_H__
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #include <gio/gbufferedinputstream.h>
  26. G_BEGIN_DECLS
  27. #define G_TYPE_DATA_INPUT_STREAM (g_data_input_stream_get_type ())
  28. #define G_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStream))
  29. #define G_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
  30. #define G_IS_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_INPUT_STREAM))
  31. #define G_IS_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_INPUT_STREAM))
  32. #define G_DATA_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass))
  33. /**
  34. * GDataInputStream:
  35. *
  36. * An implementation of #GBufferedInputStream that allows for high-level
  37. * data manipulation of arbitrary data (including binary operations).
  38. **/
  39. typedef struct _GDataInputStreamClass GDataInputStreamClass;
  40. typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate;
  41. struct _GDataInputStream
  42. {
  43. GBufferedInputStream parent_instance;
  44. /*< private >*/
  45. GDataInputStreamPrivate *priv;
  46. };
  47. struct _GDataInputStreamClass
  48. {
  49. GBufferedInputStreamClass parent_class;
  50. /*< private >*/
  51. /* Padding for future expansion */
  52. void (*_g_reserved1) (void);
  53. void (*_g_reserved2) (void);
  54. void (*_g_reserved3) (void);
  55. void (*_g_reserved4) (void);
  56. void (*_g_reserved5) (void);
  57. };
  58. GLIB_AVAILABLE_IN_ALL
  59. GType g_data_input_stream_get_type (void) G_GNUC_CONST;
  60. GLIB_AVAILABLE_IN_ALL
  61. GDataInputStream * g_data_input_stream_new (GInputStream *base_stream);
  62. GLIB_AVAILABLE_IN_ALL
  63. void g_data_input_stream_set_byte_order (GDataInputStream *stream,
  64. GDataStreamByteOrder order);
  65. GLIB_AVAILABLE_IN_ALL
  66. GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream);
  67. GLIB_AVAILABLE_IN_ALL
  68. void g_data_input_stream_set_newline_type (GDataInputStream *stream,
  69. GDataStreamNewlineType type);
  70. GLIB_AVAILABLE_IN_ALL
  71. GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream);
  72. GLIB_AVAILABLE_IN_ALL
  73. guchar g_data_input_stream_read_byte (GDataInputStream *stream,
  74. GCancellable *cancellable,
  75. GError **error);
  76. GLIB_AVAILABLE_IN_ALL
  77. gint16 g_data_input_stream_read_int16 (GDataInputStream *stream,
  78. GCancellable *cancellable,
  79. GError **error);
  80. GLIB_AVAILABLE_IN_ALL
  81. guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream,
  82. GCancellable *cancellable,
  83. GError **error);
  84. GLIB_AVAILABLE_IN_ALL
  85. gint32 g_data_input_stream_read_int32 (GDataInputStream *stream,
  86. GCancellable *cancellable,
  87. GError **error);
  88. GLIB_AVAILABLE_IN_ALL
  89. guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream,
  90. GCancellable *cancellable,
  91. GError **error);
  92. GLIB_AVAILABLE_IN_ALL
  93. gint64 g_data_input_stream_read_int64 (GDataInputStream *stream,
  94. GCancellable *cancellable,
  95. GError **error);
  96. GLIB_AVAILABLE_IN_ALL
  97. guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream,
  98. GCancellable *cancellable,
  99. GError **error);
  100. GLIB_AVAILABLE_IN_ALL
  101. char * g_data_input_stream_read_line (GDataInputStream *stream,
  102. gsize *length,
  103. GCancellable *cancellable,
  104. GError **error);
  105. GLIB_AVAILABLE_IN_2_30
  106. char * g_data_input_stream_read_line_utf8 (GDataInputStream *stream,
  107. gsize *length,
  108. GCancellable *cancellable,
  109. GError **error);
  110. GLIB_AVAILABLE_IN_ALL
  111. void g_data_input_stream_read_line_async (GDataInputStream *stream,
  112. gint io_priority,
  113. GCancellable *cancellable,
  114. GAsyncReadyCallback callback,
  115. gpointer user_data);
  116. GLIB_AVAILABLE_IN_ALL
  117. char * g_data_input_stream_read_line_finish (GDataInputStream *stream,
  118. GAsyncResult *result,
  119. gsize *length,
  120. GError **error);
  121. GLIB_AVAILABLE_IN_2_30
  122. char * g_data_input_stream_read_line_finish_utf8(GDataInputStream *stream,
  123. GAsyncResult *result,
  124. gsize *length,
  125. GError **error);
  126. GLIB_AVAILABLE_IN_ALL
  127. char * g_data_input_stream_read_until (GDataInputStream *stream,
  128. const gchar *stop_chars,
  129. gsize *length,
  130. GCancellable *cancellable,
  131. GError **error);
  132. GLIB_AVAILABLE_IN_ALL
  133. void g_data_input_stream_read_until_async (GDataInputStream *stream,
  134. const gchar *stop_chars,
  135. gint io_priority,
  136. GCancellable *cancellable,
  137. GAsyncReadyCallback callback,
  138. gpointer user_data);
  139. GLIB_AVAILABLE_IN_ALL
  140. char * g_data_input_stream_read_until_finish (GDataInputStream *stream,
  141. GAsyncResult *result,
  142. gsize *length,
  143. GError **error);
  144. GLIB_AVAILABLE_IN_ALL
  145. char * g_data_input_stream_read_upto (GDataInputStream *stream,
  146. const gchar *stop_chars,
  147. gssize stop_chars_len,
  148. gsize *length,
  149. GCancellable *cancellable,
  150. GError **error);
  151. GLIB_AVAILABLE_IN_ALL
  152. void g_data_input_stream_read_upto_async (GDataInputStream *stream,
  153. const gchar *stop_chars,
  154. gssize stop_chars_len,
  155. gint io_priority,
  156. GCancellable *cancellable,
  157. GAsyncReadyCallback callback,
  158. gpointer user_data);
  159. GLIB_AVAILABLE_IN_ALL
  160. char * g_data_input_stream_read_upto_finish (GDataInputStream *stream,
  161. GAsyncResult *result,
  162. gsize *length,
  163. GError **error);
  164. G_END_DECLS
  165. #endif /* __G_DATA_INPUT_STREAM_H__ */