giostream.h 4.7 KB

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