Respect -c option
[pidgin-git.git] / libpurple / queuedoutputstream.h
blob80888ed2fc96cec2dfda2d2504119483db0df0fd
1 /*
3 * purple
5 * Purple is the legal property of its developers, whose names are too numerous
6 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * source distribution.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #ifndef _PURPLE_QUEUED_OUTPUT_STREAM_H
25 #define _PURPLE_QUEUED_OUTPUT_STREAM_H
26 /**
27 * SECTION:queued-output-stream
28 * @section_id: libpurple-queued-output-stream
29 * @short_description: GOutputStream for queuing data to output
30 * @title: GOutputStream class
32 * A #GQueuedOutputStream is a #GOutputStream which allows data to be queued
33 * for outputting. It differs from a #GBufferedOutputStream in that it allows
34 * for data to be queued while other operations are in progress.
37 #include <gio/gio.h>
39 G_BEGIN_DECLS
41 #define PURPLE_TYPE_QUEUED_OUTPUT_STREAM (purple_queued_output_stream_get_type())
42 #define PURPLE_QUEUED_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST((o), PURPLE_TYPE_QUEUED_OUTPUT_STREAM, PurpleQueuedOutputStream))
43 #define PURPLE_QUEUED_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PURPLE_TYPE_QUEUED_OUTPUT_STREAM, GQueuedOutputStreamClass))
44 #define PURPLE_IS_QUEUED_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), PURPLE_TYPE_QUEUED_OUTPUT_STREAM)
45 #define PURPLE_IS_QUEUED_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), PURPLE_TYPE_QUEUED_OUTPUT_STREAM))
46 #define PURPLE_IS_QUEUED_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), PURPLE_TYPE_UEUED_OUTPUT_STREAM, GQueuedOutputStreamClass))
48 /**
49 * PurpleQueuedOutputStream:
51 * An implementation of #GFilterOutputStream which allows queuing data for
52 * output. This allows data to be queued while other data is being output.
53 * Therefore, data doesn't have to be manually stored while waiting for
54 * stream operations to finish.
56 * To create a queued output stream, use #purple_queued_output_stream_new().
58 * To queue data, use #purple_queued_output_stream_push_bytes().
60 * Once data has been queued, flush the stream with #g_output_stream_flush()
61 * or #g_output_stream_flush_async().
63 typedef struct _PurpleQueuedOutputStream PurpleQueuedOutputStream;
64 typedef struct _PurpleQueuedOutputStreamClass PurpleQueuedOutputStreamClass;
65 typedef struct _PurpleQueuedOutputStreamPrivate PurpleQueuedOutputStreamPrivate;
67 struct _PurpleQueuedOutputStream
69 GFilterOutputStream parent_instance;
71 /*< protected >*/
72 PurpleQueuedOutputStreamPrivate *priv;
75 struct _PurpleQueuedOutputStreamClass
77 GFilterOutputStreamClass parent_class;
79 /*< private >*/
80 /* Padding for future expansion */
81 void (*_g_reserved1)(void);
82 void (*_g_reserved2)(void);
85 GType purple_queued_output_stream_get_type(void) G_GNUC_CONST;
88 * purple_queued_output_stream_new
89 * @base_stream: Base output stream to wrap with the queued stream
91 * Creates a new queued output stream for a base stream.
93 PurpleQueuedOutputStream *purple_queued_output_stream_new(
94 GOutputStream *base_stream);
97 * purple_queued_output_stream_push_bytes
98 * @stream: Stream to push bytes to
99 * @bytes: Bytes to queue
101 * Queues data to be output through the stream. Flush the stream to
102 * output this data.
104 void purple_queued_output_stream_push_bytes(PurpleQueuedOutputStream *stream,
105 GBytes *bytes);
107 G_END_DECLS
109 #endif /* _PURPLE_QUEUED_OUTPUT_STREAM_H */