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 #ifndef CAMEL_IMAPX_STREAM_H
24 #define CAMEL_IMAPX_STREAM_H
26 #include <camel/camel.h>
28 /* Standard GObject macros */
29 #define CAMEL_TYPE_IMAPX_STREAM \
30 (camel_imapx_stream_get_type ())
31 #define CAMEL_IMAPX_STREAM(obj) \
32 (G_TYPE_CHECK_INSTANCE_CAST \
33 ((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStream))
34 #define CAMEL_IMAPX_STREAM_CLASS(cls) \
35 (G_TYPE_CHECK_CLASS_CAST \
36 ((cls), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
37 #define CAMEL_IS_IMAPX_STREAM(obj) \
38 (G_TYPE_CHECK_INSTANCE_TYPE \
39 ((obj), CAMEL_TYPE_IMAPX_STREAM))
40 #define CAMEL_IS_IMAPX_STREAM_CLASS(cls) \
41 (G_TYPE_CHECK_CLASS_TYPE \
42 ((cls), CAMEL_TYPE_IMAPX_STREAM))
43 #define CAMEL_IMAPX_STREAM_GET_CLASS(obj) \
44 (G_TYPE_INSTANCE_GET_CLASS \
45 ((obj), CAMEL_TYPE_IMAPX_STREAM, CamelIMAPXStreamClass))
47 #define CAMEL_IMAPX_ERROR \
48 (camel_imapx_error_quark ())
52 typedef struct _CamelIMAPXStream CamelIMAPXStream;
53 typedef struct _CamelIMAPXStreamClass CamelIMAPXStreamClass;
56 IMAPX_TOK_PROTOCOL = -2,
58 IMAPX_TOK_TOKEN = 256,
62 } camel_imapx_token_t;
64 struct _CamelIMAPXStream {
68 gchar tagprefix; /* For debugging output */
71 guchar *buf, *ptr, *end;
75 camel_imapx_token_t unget_tok;
83 struct _CamelIMAPXStreamClass {
84 CamelStreamClass parent_class;
87 GType camel_imapx_stream_get_type (void);
88 GQuark camel_imapx_error_quark (void) G_GNUC_CONST;
89 CamelStream * camel_imapx_stream_new (CamelStream *source);
90 gint camel_imapx_stream_buffered (CamelIMAPXStream *is);
92 /* throws IO,PARSE exception */
94 camel_imapx_stream_token (CamelIMAPXStream *is,
97 GCancellable *cancellable,
100 void camel_imapx_stream_ungettoken (CamelIMAPXStream *is,
101 camel_imapx_token_t tok,
104 void camel_imapx_stream_set_literal (CamelIMAPXStream *is,
106 gint camel_imapx_stream_gets (CamelIMAPXStream *is,
109 GCancellable *cancellable,
111 gint camel_imapx_stream_getl (CamelIMAPXStream *is,
114 GCancellable *cancellable,
117 /* all throw IO,PARSE exceptions */
119 /* gets an atom, upper-cases */
120 gint camel_imapx_stream_atom (CamelIMAPXStream *is,
123 GCancellable *cancellable,
125 /* gets an atom or string */
126 gint camel_imapx_stream_astring (CamelIMAPXStream *is,
128 GCancellable *cancellable,
130 /* gets a NIL or a string, start==NULL if NIL */
131 gint camel_imapx_stream_nstring (CamelIMAPXStream *is,
133 GCancellable *cancellable,
135 /* gets a NIL or string into a stream, stream==NULL if NIL */
136 gint camel_imapx_stream_nstring_stream
137 (CamelIMAPXStream *is,
138 CamelStream **stream,
139 GCancellable *cancellable,
142 gint camel_imapx_stream_text (CamelIMAPXStream *is,
144 GCancellable *cancellable,
147 /* gets a 'number' */
148 guint64 camel_imapx_stream_number (CamelIMAPXStream *is,
149 GCancellable *cancellable,
152 /* skips the rest of a line, including literals, etc */
153 gint camel_imapx_stream_skip (CamelIMAPXStream *is,
154 GCancellable *cancellable,
159 #endif /* CAMEL_IMAPX_STREAM_H */