1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
2
/* camel-stream.h : class for an abstract stream */
6
* Bertrand Guiheneuf <bertrand@helixcode.com>
8
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
10
* This program is free software; you can redistribute it and/or
11
* modify it under the terms of version 2 of the GNU Lesser General Public
12
* License as published by the Free Software Foundation.
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 Lesser General Public License for more details.
19
* You should have received a copy of the GNU Lesser 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 02110-1301
25
#if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
26
#error "Only <camel/camel.h> can be included directly."
29
#ifndef CAMEL_STREAM_H
30
#define CAMEL_STREAM_H
34
#include <camel/camel-object.h>
36
/* Standard GObject macros */
37
#define CAMEL_TYPE_STREAM \
38
(camel_stream_get_type ())
39
#define CAMEL_STREAM(obj) \
40
(G_TYPE_CHECK_INSTANCE_CAST \
41
((obj), CAMEL_TYPE_STREAM, CamelStream))
42
#define CAMEL_STREAM_CLASS(cls) \
43
(G_TYPE_CHECK_CLASS_CAST \
44
((cls), CAMEL_TYPE_STREAM, CamelStreamClass))
45
#define CAMEL_IS_STREAM(obj) \
46
(G_TYPE_CHECK_INSTANCE_TYPE \
47
((obj), CAMEL_TYPE_STREAM))
48
#define CAMEL_IS_STREAM_CLASS(cls) \
49
(G_TYPE_CHECK_CLASS_TYPE \
50
((cls), CAMEL_TYPE_STREAM))
51
#define CAMEL_STREAM_GET_CLASS(obj) \
52
(G_TYPE_INSTANCE_GET_CLASS \
53
((obj), CAMEL_TYPE_STREAM, CamelStreamClass))
57
typedef struct _CamelStream CamelStream;
58
typedef struct _CamelStreamClass CamelStreamClass;
66
struct _CamelStreamClass {
67
CamelObjectClass parent_class;
69
gssize (*read) (CamelStream *stream,
72
GCancellable *cancellable,
74
gssize (*write) (CamelStream *stream,
77
GCancellable *cancellable,
79
gint (*close) (CamelStream *stream,
80
GCancellable *cancellable,
82
gint (*flush) (CamelStream *stream,
83
GCancellable *cancellable,
85
gboolean (*eos) (CamelStream *stream);
88
GType camel_stream_get_type (void);
89
gssize camel_stream_read (CamelStream *stream,
92
GCancellable *cancellable,
94
gssize camel_stream_write (CamelStream *stream,
97
GCancellable *cancellable,
99
gint camel_stream_flush (CamelStream *stream,
100
GCancellable *cancellable,
102
gint camel_stream_close (CamelStream *stream,
103
GCancellable *cancellable,
105
gboolean camel_stream_eos (CamelStream *stream);
107
/* utility macros and funcs */
108
gssize camel_stream_write_string (CamelStream *stream,
110
GCancellable *cancellable,
112
gssize camel_stream_printf (CamelStream *stream,
114
...) G_GNUC_PRINTF (2, 3);
116
/* Write a whole stream to another stream, until eof or error on
118
gssize camel_stream_write_to_stream (CamelStream *stream,
119
CamelStream *output_stream,
120
GCancellable *cancellable,
125
#endif /* CAMEL_STREAM_H */