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."
28 #ifndef CAMEL_IMAPX_STREAM_H
29 #define CAMEL_IMAPX_STREAM_H
31 #include <camel/camel-stream.h>
33 /* Standard GObject macros */
34 #define CAMEL_TYPE_IMAPX_STREAM \
35 (camel_imapx_stream_get_type ())
36 #define CAMEL_IMAPX_STREAM(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST \
38 ((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStream))
39 #define CAMEL_IMAPX_STREAM_CLASS(cls) \
40 (G_TYPE_CHECK_CLASS_CAST \
41 ((cls), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
42 #define CAMEL_IS_IMAPX_STREAM(obj) \
43 (G_TYPE_CHECK_INSTANCE_TYPE \
44 ((obj), CAMEL_TYPE_IMAPX_STREAM))
45 #define CAMEL_IS_IMAPX_STREAM_CLASS(cls) \
46 (G_TYPE_CHECK_CLASS_TYPE \
47 ((cls), CAMEL_TYPE_IMAPX_STREAM))
48 #define CAMEL_IMAPX_STREAM_GET_CLASS(obj) \
49 (G_TYPE_INSTANCE_GET_CLASS \
50 ((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
52 #define CAMEL_IMAPX_ERROR \
53 (camel_imapx_error_quark ())
57 typedef struct _CamelIMAPXStream CamelIMAPXStream;
58 typedef struct _CamelIMAPXStreamClass CamelIMAPXStreamClass;
61 IMAPX_TOK_PROTOCOL = -2,
63 IMAPX_TOK_TOKEN = 256,
67 } camel_imapx_token_t;
69 struct _CamelIMAPXStream {
73 gchar tagprefix; /* For debugging output */
76 guchar *buf, *ptr, *end;
80 camel_imapx_token_t unget_tok;
88 struct _CamelIMAPXStreamClass {
89 CamelStreamClass parent_class;
92 GType camel_imapx_stream_get_type (void);
93 GQuark camel_imapx_error_quark (void) G_GNUC_CONST;
94 CamelStream * camel_imapx_stream_new (CamelStream *source);
95 gint camel_imapx_stream_buffered (CamelIMAPXStream *is);
97 /* throws IO,PARSE exception */
99 camel_imapx_stream_token (CamelIMAPXStream *is,
102 GCancellable *cancellable,
105 void camel_imapx_stream_ungettoken (CamelIMAPXStream *is,
106 camel_imapx_token_t tok,
109 void camel_imapx_stream_set_literal (CamelIMAPXStream *is,
111 gint camel_imapx_stream_gets (CamelIMAPXStream *is,
114 GCancellable *cancellable,
116 gint camel_imapx_stream_getl (CamelIMAPXStream *is,
119 GCancellable *cancellable,
122 /* all throw IO,PARSE exceptions */
124 /* gets an atom, upper-cases */
125 gint camel_imapx_stream_atom (CamelIMAPXStream *is,
128 GCancellable *cancellable,
130 /* gets an atom or string */
131 gint camel_imapx_stream_astring (CamelIMAPXStream *is,
133 GCancellable *cancellable,
135 /* gets a NIL or a string, start==NULL if NIL */
136 gint camel_imapx_stream_nstring (CamelIMAPXStream *is,
138 GCancellable *cancellable,
140 /* gets a NIL or string into a stream, stream==NULL if NIL */
141 gint camel_imapx_stream_nstring_stream
142 (CamelIMAPXStream *is,
143 CamelStream **stream,
144 GCancellable *cancellable,
147 gint camel_imapx_stream_text (CamelIMAPXStream *is,
149 GCancellable *cancellable,
152 /* gets a 'number' */
153 guint64 camel_imapx_stream_number (CamelIMAPXStream *is,
154 GCancellable *cancellable,
157 /* skips the rest of a line, including literals, etc */
158 gint camel_imapx_stream_skip (CamelIMAPXStream *is,
159 GCancellable *cancellable,
164 #endif /* CAMEL_IMAPX_STREAM_H */