Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-medium.h
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 /*
5  *
6  * Authors:  Bertrand Guiheneuf <bertrand@helixcode.com>
7  *           Michael Zucchi <notzed@ximian.com>
8  *
9  * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of version 2 of the GNU Lesser General Public
13  * License as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
23  * USA
24  */
25
26
27 #ifndef CAMEL_MEDIUM_H
28 #define CAMEL_MEDIUM_H 1
29
30 #include <camel/camel-data-wrapper.h>
31
32 #define CAMEL_MEDIUM_TYPE     (camel_medium_get_type ())
33 #define CAMEL_MEDIUM(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_MEDIUM_TYPE, CamelMedium))
34 #define CAMEL_MEDIUM_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MEDIUM_TYPE, CamelMediumClass))
35 #define CAMEL_IS_MEDIUM(o)    (CAMEL_CHECK_TYPE((o), CAMEL_MEDIUM_TYPE))
36
37 G_BEGIN_DECLS
38
39 typedef struct {
40         const char *name;
41         const char *value;
42 } CamelMediumHeader;
43
44 struct _CamelMedium {
45         CamelDataWrapper parent_object;
46
47         /* The content of the medium, as opposed to our parent
48          * CamelDataWrapper, which wraps both the headers and the
49          * content.
50          */
51         CamelDataWrapper *content;
52 };
53
54 typedef struct {
55         CamelDataWrapperClass parent_class;
56
57         /* Virtual methods */
58         void  (*add_header) (CamelMedium *medium, const char *name, const void *value);
59         void  (*set_header) (CamelMedium *medium, const char *name, const void *value);
60         void  (*remove_header) (CamelMedium *medium, const char *name);
61         const void * (*get_header) (CamelMedium *medium,  const char *name);
62
63         GArray * (*get_headers) (CamelMedium *medium);
64         void (*free_headers) (CamelMedium *medium, GArray *headers);
65
66         CamelDataWrapper * (*get_content_object) (CamelMedium *medium);
67         void (*set_content_object) (CamelMedium *medium, CamelDataWrapper *content);
68 } CamelMediumClass;
69
70 /* Standard Camel function */
71 CamelType camel_medium_get_type (void);
72
73 /* Header get/set interface */
74 void camel_medium_add_header (CamelMedium *medium, const char *name, const void *value);
75 void camel_medium_set_header (CamelMedium *medium, const char *name, const void *value);
76 void camel_medium_remove_header (CamelMedium *medium, const char *name);
77 const void *camel_medium_get_header (CamelMedium *medium, const char *name);
78
79 GArray *camel_medium_get_headers (CamelMedium *medium);
80 void camel_medium_free_headers (CamelMedium *medium, GArray *headers);
81
82 /* accessor methods */
83 CamelDataWrapper *camel_medium_get_content_object (CamelMedium *medium);
84 void camel_medium_set_content_object (CamelMedium *medium,
85                                       CamelDataWrapper *content);
86
87 G_END_DECLS
88
89 #endif /* CAMEL_MEDIUM_H */