2 * Copyright (C) 2000 Ximian Inc.
4 * Authors: Michael Zucchi <notzed@ximian.com>
6 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU Lesser General Public
10 * License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
24 #error "Only <camel/camel.h> can be included directly."
27 #ifndef CAMEL_IMAPX_STREAM_H
28 #define CAMEL_IMAPX_STREAM_H
30 #include <camel/camel-stream.h>
32 /* Standard GObject macros */
33 #define CAMEL_TYPE_IMAPX_STREAM \
34 (camel_imapx_stream_get_type ())
35 #define CAMEL_IMAPX_STREAM(obj) \
36 (G_TYPE_CHECK_INSTANCE_CAST \
37 ((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStream))
38 #define CAMEL_IMAPX_STREAM_CLASS(cls) \
39 (G_TYPE_CHECK_CLASS_CAST \
40 ((cls), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
41 #define CAMEL_IS_IMAPX_STREAM(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE \
43 ((obj), CAMEL_TYPE_IMAPX_STREAM))
44 #define CAMEL_IS_IMAPX_STREAM_CLASS(cls) \
45 (G_TYPE_CHECK_CLASS_TYPE \
46 ((cls), CAMEL_TYPE_IMAPX_STREAM))
47 #define CAMEL_IMAPX_STREAM_GET_CLASS(obj) \
48 (G_TYPE_INSTANCE_GET_CLASS \
49 ((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
51 #define CAMEL_IMAPX_ERROR \
52 (camel_imapx_error_quark ())
56 typedef struct _CamelIMAPXStream CamelIMAPXStream;
57 typedef struct _CamelIMAPXStreamClass CamelIMAPXStreamClass;
60 IMAPX_TOK_PROTOCOL = -2,
62 IMAPX_TOK_TOKEN = 256,
66 } camel_imapx_token_t;
68 struct _CamelIMAPXStream {
72 gchar tagprefix; /* For debugging output */
75 guchar *buf, *ptr, *end;
79 camel_imapx_token_t unget_tok;
87 struct _CamelIMAPXStreamClass {
88 CamelStreamClass parent_class;
91 GType camel_imapx_stream_get_type (void);
92 GQuark camel_imapx_error_quark (void) G_GNUC_CONST;
93 CamelStream * camel_imapx_stream_new (CamelStream *source);
94 gint camel_imapx_stream_buffered (CamelIMAPXStream *is);
96 /* throws IO,PARSE exception */
98 camel_imapx_stream_token (CamelIMAPXStream *is,
101 GCancellable *cancellable,
104 void camel_imapx_stream_ungettoken (CamelIMAPXStream *is,
105 camel_imapx_token_t tok,
108 void camel_imapx_stream_set_literal (CamelIMAPXStream *is,
110 gint camel_imapx_stream_gets (CamelIMAPXStream *is,
113 GCancellable *cancellable,
115 gint camel_imapx_stream_getl (CamelIMAPXStream *is,
118 GCancellable *cancellable,
121 /* all throw IO,PARSE exceptions */
123 /* gets an atom, upper-cases */
124 gint camel_imapx_stream_atom (CamelIMAPXStream *is,
127 GCancellable *cancellable,
129 /* gets an atom or string */
130 gint camel_imapx_stream_astring (CamelIMAPXStream *is,
132 GCancellable *cancellable,
134 /* gets a NIL or a string, start==NULL if NIL */
135 gint camel_imapx_stream_nstring (CamelIMAPXStream *is,
137 GCancellable *cancellable,
139 /* gets a NIL or string into a stream, stream==NULL if NIL */
140 gint camel_imapx_stream_nstring_stream
141 (CamelIMAPXStream *is,
142 CamelStream **stream,
143 GCancellable *cancellable,
146 gint camel_imapx_stream_text (CamelIMAPXStream *is,
148 GCancellable *cancellable,
151 /* gets a 'number' */
152 guint64 camel_imapx_stream_number (CamelIMAPXStream *is,
153 GCancellable *cancellable,
156 /* skips the rest of a line, including literals, etc */
157 gint camel_imapx_stream_skip (CamelIMAPXStream *is,
158 GCancellable *cancellable,
163 #endif /* CAMEL_IMAPX_STREAM_H */