1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-medium.h : class for a medium object
3  *
4  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
5  *
6  * This library is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
19  *          Michael Zucchi <notzed@ximian.com>
20  */
21 
22 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
23 #error "Only <camel/camel.h> can be included directly."
24 #endif
25 
26 #ifndef CAMEL_MEDIUM_H
27 #define CAMEL_MEDIUM_H
28 
29 #include <camel/camel-data-wrapper.h>
30 #include <camel/camel-name-value-array.h>
31 
32 /* Standard GObject macros */
33 #define CAMEL_TYPE_MEDIUM \
34 	(camel_medium_get_type ())
35 #define CAMEL_MEDIUM(obj) \
36 	(G_TYPE_CHECK_INSTANCE_CAST \
37 	((obj), CAMEL_TYPE_MEDIUM, CamelMedium))
38 #define CAMEL_MEDIUM_CLASS(cls) \
39 	(G_TYPE_CHECK_CLASS_CAST \
40 	((cls), CAMEL_TYPE_MEDIUM, CamelMediumClass))
41 #define CAMEL_IS_MEDIUM(obj) \
42 	(G_TYPE_CHECK_INSTANCE_TYPE \
43 	((obj), CAMEL_TYPE_MEDIUM))
44 #define CAMEL_IS_MEDIUM_CLASS(cls) \
45 	(G_TYPE_CHECK_CLASS_TYPE \
46 	((cls), CAMEL_TYPE_MEDIUM))
47 #define CAMEL_MEDIUM_GET_CLASS(obj) \
48 	(G_TYPE_INSTANCE_GET_CLASS \
49 	((obj), CAMEL_TYPE_MEDIUM, CamelMediumClass))
50 
51 G_BEGIN_DECLS
52 
53 typedef struct _CamelMedium CamelMedium;
54 typedef struct _CamelMediumClass CamelMediumClass;
55 typedef struct _CamelMediumPrivate CamelMediumPrivate;
56 
57 struct _CamelMedium {
58 	CamelDataWrapper parent;
59 	CamelMediumPrivate *priv;
60 };
61 
62 struct _CamelMediumClass {
63 	CamelDataWrapperClass parent_class;
64 
65 	void		(*add_header)		(CamelMedium *medium,
66 						 const gchar *name,
67 						 const gchar *value);
68 	void		(*set_header)		(CamelMedium *medium,
69 						 const gchar *name,
70 						 const gchar *value);
71 	void		(*remove_header)	(CamelMedium *medium,
72 						 const gchar *name);
73 	const gchar *	(*get_header)		(CamelMedium *medium,
74 						 const gchar *name);
75 	CamelNameValueArray *
76 			(*dup_headers)		(CamelMedium *medium);
77 	const CamelNameValueArray *
78 			(*get_headers)		(CamelMedium *medium);
79 	CamelDataWrapper *
80 			(*get_content)		(CamelMedium *medium);
81 	void		(*set_content)		(CamelMedium *medium,
82 						 CamelDataWrapper *content);
83 
84 	/* Padding for future expansion */
85 	gpointer reserved[20];
86 };
87 
88 GType		camel_medium_get_type		(void);
89 void		camel_medium_add_header		(CamelMedium *medium,
90 						 const gchar *name,
91 						 const gchar *value);
92 void		camel_medium_set_header		(CamelMedium *medium,
93 						 const gchar *name,
94 						 const gchar *value);
95 void		camel_medium_remove_header	(CamelMedium *medium,
96 						 const gchar *name);
97 const gchar *	camel_medium_get_header		(CamelMedium *medium,
98 						 const gchar *name);
99 CamelNameValueArray *
100 		camel_medium_dup_headers	(CamelMedium *medium);
101 const CamelNameValueArray *
102 		camel_medium_get_headers	(CamelMedium *medium);
103 CamelDataWrapper *
104 		camel_medium_get_content	(CamelMedium *medium);
105 void		camel_medium_set_content	(CamelMedium *medium,
106 						 CamelDataWrapper *content);
107 
108 G_END_DECLS
109 
110 #endif /* CAMEL_MEDIUM_H */
111