Extending test-client-custom-summary to try e_book_client_get_contacts_uids()
[platform/upstream/evolution-data-server.git] / camel / camel-mime-filter.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  *  Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4  *
5  *  Authors: Michael Zucchi <notzed@ximian.com>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 /* Abstract class for non-copying filters */
23
24 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
25 #error "Only <camel/camel.h> can be included directly."
26 #endif
27
28 #ifndef CAMEL_MIME_FILTER_H
29 #define CAMEL_MIME_FILTER_H
30
31 #include <sys/types.h>
32 #include <camel/camel-object.h>
33
34 /* Standard GObject macros */
35 #define CAMEL_TYPE_MIME_FILTER \
36         (camel_mime_filter_get_type ())
37 #define CAMEL_MIME_FILTER(obj) \
38         (G_TYPE_CHECK_INSTANCE_CAST \
39         ((obj),  CAMEL_TYPE_MIME_FILTER, CamelMimeFilter))
40 #define CAMEL_MIME_FILTER_CLASS(cls) \
41         (G_TYPE_CHECK_CLASS_CAST \
42         ((cls), CAMEL_TYPE_MIME_FILTER, CamelMimeFilterClass))
43 #define CAMEL_IS_MIME_FILTER(obj) \
44         (G_TYPE_CHECK_INSTANCE_TYPE \
45         ((obj), CAMEL_TYPE_MIME_FILTER))
46 #define CAMEL_IS_MIME_FILTER_CLASS(cls) \
47         (G_TYPE_CHECK_CLASS_TYPE \
48         ((cls), CAMEL_TYPE_MIME_FILTER))
49 #define CAMEL_MIME_FILTER_GET_CLASS(obj) \
50         (G_TYPE_INSTANCE_GET_CLASS \
51         ((obj), CAMEL_TYPE_MIME_FILTER, CamelMimeFilterClass))
52
53 G_BEGIN_DECLS
54
55 typedef struct _CamelMimeFilter CamelMimeFilter;
56 typedef struct _CamelMimeFilterClass CamelMimeFilterClass;
57 typedef struct _CamelMimeFilterPrivate CamelMimeFilterPrivate;
58
59 struct _CamelMimeFilter {
60         CamelObject parent;
61         CamelMimeFilterPrivate *priv;
62
63         gchar *outreal;         /* real malloc'd buffer */
64         gchar *outbuf;          /* first 'writable' position allowed (outreal + outpre) */
65         gchar *outptr;
66         gsize outsize;
67         gsize outpre;           /* prespace of this buffer */
68
69         gchar *backbuf;
70         gsize backsize;
71         gsize backlen;          /* significant data there */
72 };
73
74 struct _CamelMimeFilterClass {
75         CamelObjectClass parent_class;
76
77         void            (*filter)               (CamelMimeFilter *filter,
78                                                  const gchar *in,
79                                                  gsize len,
80                                                  gsize prespace,
81                                                  gchar **out,
82                                                  gsize *outlen,
83                                                  gsize *outprespace);
84         void            (*complete)             (CamelMimeFilter *filter,
85                                                  const gchar *in,
86                                                  gsize len,
87                                                  gsize prespace,
88                                                  gchar **out,
89                                                  gsize *outlen,
90                                                  gsize *outprespace);
91         void            (*reset)                (CamelMimeFilter *filter);
92 };
93
94 GType           camel_mime_filter_get_type      (void);
95 CamelMimeFilter *
96                 camel_mime_filter_new           (void);
97 void            camel_mime_filter_filter        (CamelMimeFilter *filter,
98                                                  const gchar *in,
99                                                  gsize len,
100                                                  gsize prespace,
101                                                  gchar **out,
102                                                  gsize *outlen,
103                                                  gsize *outprespace);
104 void            camel_mime_filter_complete      (CamelMimeFilter *filter,
105                                                  const gchar *in,
106                                                  gsize len,
107                                                  gsize prespace,
108                                                  gchar **out,
109                                                  gsize *outlen,
110                                                  gsize *outprespace);
111 void            camel_mime_filter_reset         (CamelMimeFilter *filter);
112
113 /* sets/returns number of bytes backed up on the input */
114 void            camel_mime_filter_backup        (CamelMimeFilter *filter,
115                                                  const gchar *data,
116                                                  gsize length);
117
118 /* ensure this much size available for filter output */
119 void            camel_mime_filter_set_size      (CamelMimeFilter *filter,
120                                                  gsize size,
121                                                  gint keep);
122
123 G_END_DECLS
124
125 #endif /* CAMEL_MIME_FILTER_H */