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.
 
 
 
 
 
 

113 lines
4.0 KiB

  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 <desrt@desrt.ca>
  14. * Alexander Larsson <alexl@redhat.com>
  15. */
  16. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  17. #error "Only <gio/gio.h> can be included directly."
  18. #endif
  19. #ifndef __G_IO_STREAM_H__
  20. #define __G_IO_STREAM_H__
  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. GType g_io_stream_get_type (void) G_GNUC_CONST;
  75. GInputStream * g_io_stream_get_input_stream (GIOStream *stream);
  76. GOutputStream *g_io_stream_get_output_stream (GIOStream *stream);
  77. gboolean g_io_stream_close (GIOStream *stream,
  78. GCancellable *cancellable,
  79. GError **error);
  80. void g_io_stream_close_async (GIOStream *stream,
  81. int io_priority,
  82. GCancellable *cancellable,
  83. GAsyncReadyCallback callback,
  84. gpointer user_data);
  85. gboolean g_io_stream_close_finish (GIOStream *stream,
  86. GAsyncResult *result,
  87. GError **error);
  88. gboolean g_io_stream_is_closed (GIOStream *stream);
  89. gboolean g_io_stream_has_pending (GIOStream *stream);
  90. gboolean g_io_stream_set_pending (GIOStream *stream,
  91. GError **error);
  92. void g_io_stream_clear_pending (GIOStream *stream);
  93. G_END_DECLS
  94. #endif /* __G_IO_STREAM_H__ */