1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#ifndef __G_OUTPUT_STREAM_H__
#define __G_OUTPUT_STREAM_H__
#include <glib-object.h>
#include <gvfstypes.h>
#include <gvfserror.h>
G_BEGIN_DECLS
#define G_TYPE_OUTPUT_STREAM (g_output_stream_get_type ())
#define G_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_OUTPUT_STREAM, GOutputStream))
#define G_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_OUTPUT_STREAM, GOutputStreamClass))
#define G_IS_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_OUTPUT_STREAM))
#define G_IS_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_OUTPUT_STREAM))
#define G_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_OUTPUT_STREAM, GOutputStreamClass))
typedef struct _GOutputStream GOutputStream;
typedef struct _GOutputStreamClass GOutputStreamClass;
typedef struct _GOutputStreamPrivate GOutputStreamPrivate;
typedef void (*GAsyncWriteCallback) (GOutputStream *stream,
void *buffer,
gsize bytes_requested,
gssize bytes_written,
gpointer data,
GError *error);
typedef void (*GAsyncFlushCallback) (GOutputStream *stream,
gboolean result,
gpointer data,
GError *error);
/**
* GAsyncCloseOutputCallback:
* @stream: a #GOutputStream
* @result: %TRUE on success, %FALSE otherwis
* @error: the error, if result is %FALSE, otherwise %NULL
*
* This callback is called when an asychronous close operation
* is finished.
*
* The callback is always called, even if the operation was cancelled.
* If the operation was cancelled @result will be %FALSE, and @error
* will be %G_VFS_ERROR_CANCELLED.
**/
typedef void (*GAsyncCloseOutputCallback) (GOutputStream *stream,
gboolean result,
gpointer data,
GError *error);
struct _GOutputStream
{
GObject parent;
/*< private >*/
GOutputStreamPrivate *priv;
};
struct _GOutputStreamClass
{
GObjectClass parent_class;
/* Sync ops: */
gssize (* write) (GOutputStream *stream,
void *buffer,
gsize count,
GError **error);
gboolean (* flush) (GOutputStream *stream,
GError **error);
gboolean (* close) (GOutputStream *stream,
GError **error);
/* Async ops: (optional in derived classes) */
void (* write_async) (GOutputStream *stream,
void *buffer,
gsize count,
int io_priority,
GAsyncWriteCallback callback,
gpointer data,
GDestroyNotify notify);
void (* flush_async) (GOutputStream *stream,
int io_priority,
GAsyncFlushCallback callback,
gpointer data,
GDestroyNotify notify);
void (* close_async) (GOutputStream *stream,
int io_priority,
GAsyncCloseOutputCallback callback,
gpointer data,
GDestroyNotify notify);
void (* cancel) (GOutputStream *stream);
/* Optional cancel wakeup if using default async ops */
void (* cancel_sync) (GOutputStream *stream);
/* Padding for future expansion */
void (*_g_reserved1) (void);
void (*_g_reserved2) (void);
void (*_g_reserved3) (void);
void (*_g_reserved4) (void);
void (*_g_reserved5) (void);
};
GType g_output_stream_get_type (void) G_GNUC_CONST;
gssize g_output_stream_write (GOutputStream *stream,
void *buffer,
gsize count,
GError **error);
gboolean g_output_stream_flush (GOutputStream *stream,
GError **error);
gboolean g_output_stream_close (GOutputStream *stream,
GError **error);
void g_output_stream_set_async_context (GOutputStream *stream,
GMainContext *context);
GMainContext *g_output_stream_get_async_context (GOutputStream *stream);
void g_output_stream_write_async (GOutputStream *stream,
void *buffer,
gsize count,
int io_priority,
GAsyncWriteCallback callback,
gpointer data,
GDestroyNotify notify);
void g_output_stream_flush_async (GOutputStream *stream,
int io_priority,
GAsyncFlushCallback callback,
gpointer data,
GDestroyNotify notify);
void g_output_stream_close_async (GOutputStream *stream,
int io_priority,
GAsyncCloseOutputCallback callback,
gpointer data,
GDestroyNotify notify);
void g_output_stream_cancel (GOutputStream *stream);
gboolean g_output_stream_is_cancelled (GOutputStream *stream);
gboolean g_output_stream_is_closed (GOutputStream *stream);
gboolean g_output_stream_has_pending (GOutputStream *stream);
void g_output_stream_set_pending (GOutputStream *stream,
gboolean pending);
G_END_DECLS
#endif /* __G_OUTPUT_STREAM_H__ */
|