Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

173 lignes
7.2 KiB

  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, write to the
  17. * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. *
  20. * Author: Alexander Larsson <alexl@redhat.com>
  21. */
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #ifndef __G_INPUT_STREAM_H__
  26. #define __G_INPUT_STREAM_H__
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_INPUT_STREAM (g_input_stream_get_type ())
  30. #define G_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INPUT_STREAM, GInputStream))
  31. #define G_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INPUT_STREAM, GInputStreamClass))
  32. #define G_IS_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INPUT_STREAM))
  33. #define G_IS_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INPUT_STREAM))
  34. #define G_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INPUT_STREAM, GInputStreamClass))
  35. /**
  36. * GInputStream:
  37. *
  38. * Base class for streaming input operations.
  39. **/
  40. typedef struct _GInputStreamClass GInputStreamClass;
  41. typedef struct _GInputStreamPrivate GInputStreamPrivate;
  42. struct _GInputStream
  43. {
  44. GObject parent_instance;
  45. /*< private >*/
  46. GInputStreamPrivate *priv;
  47. };
  48. struct _GInputStreamClass
  49. {
  50. GObjectClass parent_class;
  51. /* Sync ops: */
  52. gssize (* read_fn) (GInputStream *stream,
  53. void *buffer,
  54. gsize count,
  55. GCancellable *cancellable,
  56. GError **error);
  57. gssize (* skip) (GInputStream *stream,
  58. gsize count,
  59. GCancellable *cancellable,
  60. GError **error);
  61. gboolean (* close_fn) (GInputStream *stream,
  62. GCancellable *cancellable,
  63. GError **error);
  64. /* Async ops: (optional in derived classes) */
  65. void (* read_async) (GInputStream *stream,
  66. void *buffer,
  67. gsize count,
  68. int io_priority,
  69. GCancellable *cancellable,
  70. GAsyncReadyCallback callback,
  71. gpointer user_data);
  72. gssize (* read_finish) (GInputStream *stream,
  73. GAsyncResult *result,
  74. GError **error);
  75. void (* skip_async) (GInputStream *stream,
  76. gsize count,
  77. int io_priority,
  78. GCancellable *cancellable,
  79. GAsyncReadyCallback callback,
  80. gpointer user_data);
  81. gssize (* skip_finish) (GInputStream *stream,
  82. GAsyncResult *result,
  83. GError **error);
  84. void (* close_async) (GInputStream *stream,
  85. int io_priority,
  86. GCancellable *cancellable,
  87. GAsyncReadyCallback callback,
  88. gpointer user_data);
  89. gboolean (* close_finish) (GInputStream *stream,
  90. GAsyncResult *result,
  91. GError **error);
  92. /*< private >*/
  93. /* Padding for future expansion */
  94. void (*_g_reserved1) (void);
  95. void (*_g_reserved2) (void);
  96. void (*_g_reserved3) (void);
  97. void (*_g_reserved4) (void);
  98. void (*_g_reserved5) (void);
  99. };
  100. GType g_input_stream_get_type (void) G_GNUC_CONST;
  101. gssize g_input_stream_read (GInputStream *stream,
  102. void *buffer,
  103. gsize count,
  104. GCancellable *cancellable,
  105. GError **error);
  106. gboolean g_input_stream_read_all (GInputStream *stream,
  107. void *buffer,
  108. gsize count,
  109. gsize *bytes_read,
  110. GCancellable *cancellable,
  111. GError **error);
  112. gssize g_input_stream_skip (GInputStream *stream,
  113. gsize count,
  114. GCancellable *cancellable,
  115. GError **error);
  116. gboolean g_input_stream_close (GInputStream *stream,
  117. GCancellable *cancellable,
  118. GError **error);
  119. void g_input_stream_read_async (GInputStream *stream,
  120. void *buffer,
  121. gsize count,
  122. int io_priority,
  123. GCancellable *cancellable,
  124. GAsyncReadyCallback callback,
  125. gpointer user_data);
  126. gssize g_input_stream_read_finish (GInputStream *stream,
  127. GAsyncResult *result,
  128. GError **error);
  129. void g_input_stream_skip_async (GInputStream *stream,
  130. gsize count,
  131. int io_priority,
  132. GCancellable *cancellable,
  133. GAsyncReadyCallback callback,
  134. gpointer user_data);
  135. gssize g_input_stream_skip_finish (GInputStream *stream,
  136. GAsyncResult *result,
  137. GError **error);
  138. void g_input_stream_close_async (GInputStream *stream,
  139. int io_priority,
  140. GCancellable *cancellable,
  141. GAsyncReadyCallback callback,
  142. gpointer user_data);
  143. gboolean g_input_stream_close_finish (GInputStream *stream,
  144. GAsyncResult *result,
  145. GError **error);
  146. /* For implementations: */
  147. gboolean g_input_stream_is_closed (GInputStream *stream);
  148. gboolean g_input_stream_has_pending (GInputStream *stream);
  149. gboolean g_input_stream_set_pending (GInputStream *stream,
  150. GError **error);
  151. void g_input_stream_clear_pending (GInputStream *stream);
  152. G_END_DECLS
  153. #endif /* __G_INPUT_STREAM_H__ */