Initialize the gmime for upstream
[platform/upstream/gmime.git] / gmime / gmime-part.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*  GMime
3  *  Copyright (C) 2000-2012 Jeffrey Stedfast
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Lesser General Public License
7  *  as published by the Free Software Foundation; either version 2.1
8  *  of the License, or (at your option) any later version.
9  *
10  *  This library 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  *  Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public
16  *  License along with this library; if not, write to the Free
17  *  Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
18  *  02110-1301, USA.
19  */
20
21
22 #ifndef __GMIME_PART_H__
23 #define __GMIME_PART_H__
24
25 #include <glib.h>
26 #include <stdio.h>
27
28 #include <gmime/gmime-object.h>
29 #include <gmime/gmime-encodings.h>
30 #include <gmime/gmime-filter-best.h>
31 #include <gmime/gmime-data-wrapper.h>
32
33 G_BEGIN_DECLS
34
35 #define GMIME_TYPE_PART            (g_mime_part_get_type ())
36 #define GMIME_PART(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_PART, GMimePart))
37 #define GMIME_PART_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_PART, GMimePartClass))
38 #define GMIME_IS_PART(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_PART))
39 #define GMIME_IS_PART_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_PART))
40 #define GMIME_PART_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_PART, GMimePartClass))
41
42 typedef struct _GMimePart GMimePart;
43 typedef struct _GMimePartClass GMimePartClass;
44
45 /**
46  * GMimePart:
47  * @parent_object: parent #GMimeObject
48  * @encoding: a #GMimeContentEncoding
49  * @content_description: Content-Description string
50  * @content_location: Content-Location string
51  * @content_md5: Content-MD5 string
52  * @content: a #GMimeDataWrapper representing the MIME part's content
53  *
54  * A leaf-node MIME part object.
55  **/
56 struct _GMimePart {
57         GMimeObject parent_object;
58         
59         GMimeContentEncoding encoding;
60         char *content_description;
61         char *content_location;
62         char *content_md5;
63         
64         GMimeDataWrapper *content;
65 };
66
67 struct _GMimePartClass {
68         GMimeObjectClass parent_class;
69         
70         void (* set_content_object) (GMimePart *mime_part, GMimeDataWrapper *content);
71 };
72
73
74 GType g_mime_part_get_type (void);
75
76 /* constructors */
77 GMimePart *g_mime_part_new (void);
78 GMimePart *g_mime_part_new_with_type (const char *type, const char *subtype);
79
80 /* accessor functions */
81 void g_mime_part_set_content_description (GMimePart *mime_part, const char *description);
82 const char *g_mime_part_get_content_description (GMimePart *mime_part);
83
84 void g_mime_part_set_content_id (GMimePart *mime_part, const char *content_id);
85 const char *g_mime_part_get_content_id (GMimePart *mime_part);
86
87 void g_mime_part_set_content_md5 (GMimePart *mime_part, const char *content_md5);
88 gboolean g_mime_part_verify_content_md5 (GMimePart *mime_part);
89 const char *g_mime_part_get_content_md5 (GMimePart *mime_part);
90
91 void g_mime_part_set_content_location (GMimePart *mime_part, const char *content_location);
92 const char *g_mime_part_get_content_location (GMimePart *mime_part);
93
94 void g_mime_part_set_content_encoding (GMimePart *mime_part, GMimeContentEncoding encoding);
95 GMimeContentEncoding g_mime_part_get_content_encoding (GMimePart *mime_part);
96
97 GMimeContentEncoding g_mime_part_get_best_content_encoding (GMimePart *mime_part, GMimeEncodingConstraint constraint);
98
99 void g_mime_part_set_filename (GMimePart *mime_part, const char *filename);
100 const char *g_mime_part_get_filename (GMimePart *mime_part);
101
102 void g_mime_part_set_content_object (GMimePart *mime_part, GMimeDataWrapper *content);
103 GMimeDataWrapper *g_mime_part_get_content_object (GMimePart *mime_part);
104
105 G_END_DECLS
106
107 #endif /* __GMIME_PART_H__ */