giostream.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright © 2008, 2009 Codethink Limited
  4. * Copyright © 2009 Red Hat, Inc.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published
  8. * by the Free Software Foundation; either version 2 of the licence or (at
  9. * your option) any later version.
  10. *
  11. * See the included COPYING file for more information.
  12. *
  13. * Authors: Ryan Lortie <[email protected]>
  14. * Alexander Larsson <[email protected]>
  15. */
  16. #ifndef __G_IO_STREAM_H__
  17. #define __G_IO_STREAM_H__
  18. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  19. #error "Only <gio/gio.h> can be included directly."
  20. #endif
  21. #include <gio/ginputstream.h>
  22. #include <gio/goutputstream.h>
  23. #include <gio/gcancellable.h>
  24. #include <gio/gioerror.h>
  25. G_BEGIN_DECLS
  26. #define G_TYPE_IO_STREAM (g_io_stream_get_type ())
  27. #define G_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_IO_STREAM, GIOStream))
  28. #define G_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_IO_STREAM, GIOStreamClass))
  29. #define G_IS_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_IO_STREAM))
  30. #define G_IS_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_IO_STREAM))
  31. #define G_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_IO_STREAM, GIOStreamClass))
  32. typedef struct _GIOStreamPrivate GIOStreamPrivate;
  33. typedef struct _GIOStreamClass GIOStreamClass;
  34. /**
  35. * GIOStream:
  36. *
  37. * Base class for read-write streams.
  38. **/
  39. struct _GIOStream
  40. {
  41. GObject parent_instance;
  42. /*< private >*/
  43. GIOStreamPrivate *priv;
  44. };
  45. struct _GIOStreamClass
  46. {
  47. GObjectClass parent_class;
  48. GInputStream * (*get_input_stream) (GIOStream *stream);
  49. GOutputStream * (*get_output_stream) (GIOStream *stream);
  50. gboolean (* close_fn) (GIOStream *stream,
  51. GCancellable *cancellable,
  52. GError **error);
  53. void (* close_async) (GIOStream *stream,
  54. int io_priority,
  55. GCancellable *cancellable,
  56. GAsyncReadyCallback callback,
  57. gpointer user_data);
  58. gboolean (* close_finish) (GIOStream *stream,
  59. GAsyncResult *result,
  60. GError **error);
  61. /*< private >*/
  62. /* Padding for future expansion */
  63. void (*_g_reserved1) (void);
  64. void (*_g_reserved2) (void);
  65. void (*_g_reserved3) (void);
  66. void (*_g_reserved4) (void);
  67. void (*_g_reserved5) (void);
  68. void (*_g_reserved6) (void);
  69. void (*_g_reserved7) (void);
  70. void (*_g_reserved8) (void);
  71. void (*_g_reserved9) (void);
  72. void (*_g_reserved10) (void);
  73. };
  74. GLIB_AVAILABLE_IN_ALL
  75. GType g_io_stream_get_type (void) G_GNUC_CONST;
  76. GLIB_AVAILABLE_IN_ALL
  77. GInputStream * g_io_stream_get_input_stream (GIOStream *stream);
  78. GLIB_AVAILABLE_IN_ALL
  79. GOutputStream *g_io_stream_get_output_stream (GIOStream *stream);
  80. GLIB_AVAILABLE_IN_ALL
  81. void g_io_stream_splice_async (GIOStream *stream1,
  82. GIOStream *stream2,
  83. GIOStreamSpliceFlags flags,
  84. int io_priority,
  85. GCancellable *cancellable,
  86. GAsyncReadyCallback callback,
  87. gpointer user_data);
  88. GLIB_AVAILABLE_IN_ALL
  89. gboolean g_io_stream_splice_finish (GAsyncResult *result,
  90. GError **error);
  91. GLIB_AVAILABLE_IN_ALL
  92. gboolean g_io_stream_close (GIOStream *stream,
  93. GCancellable *cancellable,
  94. GError **error);
  95. GLIB_AVAILABLE_IN_ALL
  96. void g_io_stream_close_async (GIOStream *stream,
  97. int io_priority,
  98. GCancellable *cancellable,
  99. GAsyncReadyCallback callback,
  100. gpointer user_data);
  101. GLIB_AVAILABLE_IN_ALL
  102. gboolean g_io_stream_close_finish (GIOStream *stream,
  103. GAsyncResult *result,
  104. GError **error);
  105. GLIB_AVAILABLE_IN_ALL
  106. gboolean g_io_stream_is_closed (GIOStream *stream);
  107. GLIB_AVAILABLE_IN_ALL
  108. gboolean g_io_stream_has_pending (GIOStream *stream);
  109. GLIB_AVAILABLE_IN_ALL
  110. gboolean g_io_stream_set_pending (GIOStream *stream,
  111. GError **error);
  112. GLIB_AVAILABLE_IN_ALL
  113. void g_io_stream_clear_pending (GIOStream *stream);
  114. G_END_DECLS
  115. #endif /* __G_IO_STREAM_H__ */