Initialize the gmime for upstream
[platform/upstream/gmime.git] / gmime / gmime-content-type.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_CONTENT_TYPE_H__
23 #define __GMIME_CONTENT_TYPE_H__
24
25 #include <glib.h>
26 #include <glib-object.h>
27
28 #include <gmime/gmime-param.h>
29
30 G_BEGIN_DECLS
31
32 #define GMIME_TYPE_CONTENT_TYPE              (g_mime_content_type_get_type ())
33 #define GMIME_CONTENT_TYPE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), g_mime_content_type_get_type (), GMimeContentType))
34 #define GMIME_CONTENT_TYPE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), g_mime_content_type_get_type (), GMimeContentTypeClass))
35 #define GMIME_IS_CONTENT_TYPE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), g_mime_content_type_get_type ()))
36 #define GMIME_IS_CONTENT_TYPE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), g_mime_content_type_get_type ()))
37 #define GMIME_CONTENT_TYPE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), g_mime_content_type_get_type (), GMimeContentTypeClass))
38
39 typedef struct _GMimeContentType GMimeContentType;
40 typedef struct _GMimeContentTypeClass GMimeContentTypeClass;
41
42 /**
43  * GMimeContentType:
44  * @parent_object: parent #GObject
45  * @param_hash: parameter hash keyed by param name
46  * @params: a #GMimeParam list
47  * @type: media type
48  * @subtype: media subtype
49  *
50  * A data structure representing a Content-Type.
51  **/
52 struct _GMimeContentType {
53         GObject parent_object;
54         
55         GHashTable *param_hash;
56         GMimeParam *params;
57         
58         gpointer priv;
59         
60         char *type;
61         char *subtype;
62 };
63
64 struct _GMimeContentTypeClass {
65         GObjectClass parent_class;
66         
67 };
68
69 GType g_mime_content_type_get_type (void);
70
71
72 GMimeContentType *g_mime_content_type_new (const char *type, const char *subtype);
73 GMimeContentType *g_mime_content_type_new_from_string (const char *str);
74
75 char *g_mime_content_type_to_string (GMimeContentType *mime_type);
76
77 gboolean g_mime_content_type_is_type (GMimeContentType *mime_type, const char *type, const char *subtype);
78
79 void g_mime_content_type_set_media_type (GMimeContentType *mime_type, const char *type);
80 const char *g_mime_content_type_get_media_type (GMimeContentType *mime_type);
81
82 void g_mime_content_type_set_media_subtype (GMimeContentType *mime_type, const char *subtype);
83 const char *g_mime_content_type_get_media_subtype (GMimeContentType *mime_type);
84
85 void g_mime_content_type_set_params (GMimeContentType *mime_type, GMimeParam *params);
86 const GMimeParam *g_mime_content_type_get_params (GMimeContentType *mime_type);
87
88 void g_mime_content_type_set_parameter (GMimeContentType *mime_type, const char *attribute, const char *value);
89 const char *g_mime_content_type_get_parameter (GMimeContentType *mime_type, const char *attribute);
90
91 G_END_DECLS
92
93 #endif /* __GMIME_CONTENT_TYPE_H__ */