2
* Copyright (C) 2000 Ximian Inc.
4
* Authors: Michael Zucchi <notzed@ximian.com>
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of version 2 of the GNU General Public
8
* License as published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
21
#ifndef _CAMEL_IMAPX_STREAM_H
22
#define _CAMEL_IMAPX_STREAM_H
24
#include <camel/camel-stream.h>
26
#define CAMEL_IMAPX_STREAM(obj) CAMEL_CHECK_CAST (obj, camel_imapx_stream_get_type (), CamelIMAPXStream)
27
#define CAMEL_IMAPX_STREAM_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_imapx_stream_get_type (), CamelIMAPXStreamClass)
28
#define CAMEL_IS_IMAPX_STREAM(obj) CAMEL_CHECK_TYPE (obj, camel_imapx_stream_get_type ())
30
typedef struct _CamelIMAPXStreamClass CamelIMAPXStreamClass;
31
typedef struct _CamelIMAPXStream CamelIMAPXStream;
34
IMAPX_TOK_PROTOCOL = -2,
36
IMAPX_TOK_TOKEN = 256,
40
} camel_imapx_token_t;
42
struct _CamelIMAPXStream {
48
guchar *buf, *ptr, *end;
52
camel_imapx_token_t unget_tok;
56
guchar *tokenbuf, *tokenptr, *tokenend;
59
struct _CamelIMAPXStreamClass {
60
CamelStreamClass parent_class;
63
CamelType camel_imapx_stream_get_type (void);
65
CamelStream *camel_imapx_stream_new (CamelStream *source);
67
gint camel_imapx_stream_buffered (CamelIMAPXStream *is);
69
camel_imapx_token_t camel_imapx_stream_token (CamelIMAPXStream *is, guchar **start, guint *len, CamelException *ex); /* throws IO,PARSE exception */
70
void camel_imapx_stream_ungettoken (CamelIMAPXStream *is, camel_imapx_token_t tok, guchar *token, guint len);
72
void camel_imapx_stream_set_literal (CamelIMAPXStream *is, guint literal);
73
gint camel_imapx_stream_gets (CamelIMAPXStream *is, guchar **start, guint *len);
74
gint camel_imapx_stream_getl (CamelIMAPXStream *is, guchar **start, guint *len);
76
/* all throw IO,PARSE exceptions */
78
/* gets an atom, upper-cases */
79
gint camel_imapx_stream_atom (CamelIMAPXStream *is, guchar **start, guint *len, CamelException *ex);
80
/* gets an atom or string */
81
gint camel_imapx_stream_astring (CamelIMAPXStream *is, guchar **start, CamelException *ex);
82
/* gets a NIL or a string, start==NULL if NIL */
83
gint camel_imapx_stream_nstring (CamelIMAPXStream *is, guchar **start, CamelException *ex);
84
/* gets a NIL or string into a stream, stream==NULL if NIL */
85
gint camel_imapx_stream_nstring_stream(CamelIMAPXStream *is, CamelStream **stream, CamelException *ex);
87
gint camel_imapx_stream_text (CamelIMAPXStream *is, guchar **text, CamelException *ex);
90
guint32 camel_imapx_stream_number(CamelIMAPXStream *is, CamelException *ex);
92
/* skips the rest of a line, including literals, etc */
93
gint camel_imapx_stream_skip(CamelIMAPXStream *is, CamelException *ex);
95
#endif /* _CAMEL_IMAPX_STREAM_H */