1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
5 * Authors: Michael Zucchi <notzed@ximian.com>
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.
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.
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.
22 /* Abstract class for non-copying filters */
24 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
25 #error "Only <camel/camel.h> can be included directly."
28 #ifndef CAMEL_MIME_FILTER_H
29 #define CAMEL_MIME_FILTER_H
31 #include <sys/types.h>
32 #include <camel/camel-object.h>
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))
55 typedef struct _CamelMimeFilter CamelMimeFilter;
56 typedef struct _CamelMimeFilterClass CamelMimeFilterClass;
57 typedef struct _CamelMimeFilterPrivate CamelMimeFilterPrivate;
59 struct _CamelMimeFilter {
61 CamelMimeFilterPrivate *priv;
63 gchar *outreal; /* real malloc'd buffer */
64 gchar *outbuf; /* first 'writable' position allowed (outreal + outpre) */
67 gsize outpre; /* prespace of this buffer */
71 gsize backlen; /* significant data there */
74 struct _CamelMimeFilterClass {
75 CamelObjectClass parent_class;
77 void (*filter) (CamelMimeFilter *filter,
84 void (*complete) (CamelMimeFilter *filter,
91 void (*reset) (CamelMimeFilter *filter);
94 GType camel_mime_filter_get_type (void);
96 camel_mime_filter_new (void);
97 void camel_mime_filter_filter (CamelMimeFilter *filter,
104 void camel_mime_filter_complete (CamelMimeFilter *filter,
111 void camel_mime_filter_reset (CamelMimeFilter *filter);
113 /* sets/returns number of bytes backed up on the input */
114 void camel_mime_filter_backup (CamelMimeFilter *filter,
118 /* ensure this much size available for filter output */
119 void camel_mime_filter_set_size (CamelMimeFilter *filter,
125 #endif /* CAMEL_MIME_FILTER_H */