~ubuntu-branches/debian/jessie/glib2.0/jessie

« back to all changes in this revision

Viewing changes to gio/goutputstream.h

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-02-15 13:00:43 UTC
  • mto: (1.4.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 70.
  • Revision ID: james.westby@ubuntu.com-20090215130043-6snh45flhit8oalb
Tags: upstream-2.18.4
ImportĀ upstreamĀ versionĀ 2.18.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIO - GLib Input, Output and Streaming Library
2
 
 * 
 
2
 *
3
3
 * Copyright (C) 2006-2007 Red Hat, Inc.
4
4
 *
5
5
 * This library is free software; you can redistribute it and/or
27
27
#ifndef __G_OUTPUT_STREAM_H__
28
28
#define __G_OUTPUT_STREAM_H__
29
29
 
30
 
#include <glib-object.h>
31
 
#include <gio/gioerror.h>
32
 
#include <gio/gasyncresult.h>
33
 
#include <gio/gcancellable.h>
34
 
#include <gio/ginputstream.h>
 
30
#include <gio/giotypes.h>
35
31
 
36
32
G_BEGIN_DECLS
37
33
 
43
39
#define G_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_OUTPUT_STREAM, GOutputStreamClass))
44
40
 
45
41
/**
46
 
 * GOutputStreamSpliceFlags:
47
 
 * @G_OUTPUT_STREAM_SPLICE_NONE: Do not close either stream.
48
 
 * @G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE: Close the source stream after the splice.
49
 
 * @G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET: Close the target stream after the splice.
50
 
 * 
51
 
 * GOutputStreamSpliceFlags determine how streams should be spliced.
52
 
 **/
53
 
typedef enum {
54
 
  G_OUTPUT_STREAM_SPLICE_NONE = 0,
55
 
  G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE = 1 << 0,
56
 
  G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET = 1 << 1
57
 
} GOutputStreamSpliceFlags;
58
 
 
59
 
/**
60
42
 * GOutputStream:
61
 
 * 
62
 
 * Base class for writing output. 
63
 
 * 
64
 
 * All classes derived from GOutputStream should implement synchronous 
 
43
 *
 
44
 * Base class for writing output.
 
45
 *
 
46
 * All classes derived from GOutputStream should implement synchronous
65
47
 * writing, splicing, flushing and closing streams, but may implement
66
48
 * asynchronous versions.
67
49
 **/
68
 
typedef struct _GOutputStream         GOutputStream;
69
50
typedef struct _GOutputStreamClass    GOutputStreamClass;
70
51
typedef struct _GOutputStreamPrivate  GOutputStreamPrivate;
71
52
 
72
53
struct _GOutputStream
73
54
{
74
55
  GObject parent_instance;
75
 
  
 
56
 
76
57
  /*< private >*/
77
58
  GOutputStreamPrivate *priv;
78
59
};
83
64
  GObjectClass parent_class;
84
65
 
85
66
  /* Sync ops: */
86
 
  
87
 
  gssize      (* write_fn)(GOutputStream *stream,
88
 
                           const void *buffer,
89
 
                           gsize count,
90
 
                           GCancellable *cancellable,
91
 
                           GError **error);
92
 
  gssize      (* splice)  (GOutputStream *stream,
93
 
                           GInputStream  *source,
94
 
                           GOutputStreamSpliceFlags   flags,
95
 
                           GCancellable  *cancellable,
96
 
                           GError       **error);
97
 
  gboolean    (* flush)   (GOutputStream *stream,
98
 
                           GCancellable  *cancellable,
99
 
                           GError       **error);
100
 
  gboolean    (* close_fn)(GOutputStream *stream,
101
 
                           GCancellable  *cancellable,
102
 
                           GError       **error);
103
 
  
 
67
 
 
68
  gssize      (* write_fn)      (GOutputStream            *stream,
 
69
                                 const void               *buffer,
 
70
                                 gsize                     count,
 
71
                                 GCancellable             *cancellable,
 
72
                                 GError                  **error);
 
73
  gssize      (* splice)        (GOutputStream            *stream,
 
74
                                 GInputStream             *source,
 
75
                                 GOutputStreamSpliceFlags  flags,
 
76
                                 GCancellable             *cancellable,
 
77
                                 GError                  **error);
 
78
  gboolean    (* flush)         (GOutputStream            *stream,
 
79
                                 GCancellable             *cancellable,
 
80
                                 GError                  **error);
 
81
  gboolean    (* close_fn)      (GOutputStream            *stream,
 
82
                                 GCancellable             *cancellable,
 
83
                                 GError                  **error);
 
84
 
104
85
  /* Async ops: (optional in derived classes) */
105
86
 
106
 
  void     (* write_async)  (GOutputStream       *stream,
107
 
                             const void          *buffer,
108
 
                             gsize                count,
109
 
                             int                  io_priority,
110
 
                             GCancellable        *cancellable,
111
 
                             GAsyncReadyCallback  callback,
112
 
                             gpointer             user_data);
113
 
  gssize   (* write_finish) (GOutputStream       *stream,
114
 
                             GAsyncResult        *result,
115
 
                             GError             **error);
116
 
  void     (* splice_async) (GOutputStream       *stream,
117
 
                             GInputStream        *source,
118
 
                             GOutputStreamSpliceFlags flags,
119
 
                             int                  io_priority,
120
 
                             GCancellable        *cancellable,
121
 
                             GAsyncReadyCallback  callback,
122
 
                             gpointer             data);
123
 
  gssize   (* splice_finish)(GOutputStream       *stream,
124
 
                             GAsyncResult        *result,
125
 
                             GError             **error);
126
 
  void     (* flush_async)  (GOutputStream       *stream,
127
 
                             int                  io_priority,
128
 
                             GCancellable        *cancellable,
129
 
                             GAsyncReadyCallback  callback,
130
 
                             gpointer             user_data);
131
 
  gboolean (* flush_finish) (GOutputStream       *stream,
132
 
                             GAsyncResult        *result,
133
 
                             GError             **error);
134
 
  void     (* close_async)  (GOutputStream       *stream,
135
 
                             int                  io_priority,
136
 
                             GCancellable        *cancellable,
137
 
                             GAsyncReadyCallback  callback,
138
 
                             gpointer             user_data);
139
 
  gboolean (* close_finish) (GOutputStream       *stream,
140
 
                             GAsyncResult        *result,
141
 
                             GError             **error);
 
87
  void        (* write_async)   (GOutputStream            *stream,
 
88
                                 const void               *buffer,
 
89
                                 gsize                     count,
 
90
                                 int                       io_priority,
 
91
                                 GCancellable             *cancellable,
 
92
                                 GAsyncReadyCallback       callback,
 
93
                                 gpointer                  user_data);
 
94
  gssize      (* write_finish)  (GOutputStream            *stream,
 
95
                                 GAsyncResult             *result,
 
96
                                 GError                  **error);
 
97
  void        (* splice_async)  (GOutputStream            *stream,
 
98
                                 GInputStream             *source,
 
99
                                 GOutputStreamSpliceFlags  flags,
 
100
                                 int                       io_priority,
 
101
                                 GCancellable             *cancellable,
 
102
                                 GAsyncReadyCallback       callback,
 
103
                                 gpointer                  data);
 
104
  gssize      (* splice_finish) (GOutputStream            *stream,
 
105
                                 GAsyncResult             *result,
 
106
                                 GError                  **error);
 
107
  void        (* flush_async)   (GOutputStream            *stream,
 
108
                                 int                       io_priority,
 
109
                                 GCancellable             *cancellable,
 
110
                                 GAsyncReadyCallback       callback,
 
111
                                 gpointer                  user_data);
 
112
  gboolean    (* flush_finish)  (GOutputStream            *stream,
 
113
                                 GAsyncResult             *result,
 
114
                                 GError                  **error);
 
115
  void        (* close_async)   (GOutputStream            *stream,
 
116
                                 int                       io_priority,
 
117
                                 GCancellable             *cancellable,
 
118
                                 GAsyncReadyCallback       callback,
 
119
                                 gpointer                  user_data);
 
120
  gboolean    (* close_finish)  (GOutputStream            *stream,
 
121
                                 GAsyncResult             *result,
 
122
                                 GError                  **error);
142
123
 
143
124
  /*< private >*/
144
125
  /* Padding for future expansion */
152
133
  void (*_g_reserved8) (void);
153
134
};
154
135
 
155
 
GType g_output_stream_get_type (void) G_GNUC_CONST;
156
 
  
 
136
GType    g_output_stream_get_type      (void) G_GNUC_CONST;
 
137
 
157
138
gssize   g_output_stream_write         (GOutputStream             *stream,
158
139
                                        const void                *buffer,
159
140
                                        gsize                      count,