More validator improvements
[appstream:appstream.git] / src / as-component.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
2  *
3  * Copyright (C) 2012-2014 Matthias Klumpp <matthias@tenstral.net>
4  *
5  * Licensed under the GNU Lesser General Public License Version 3
6  *
7  * This library is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #if !defined (__APPSTREAM_H) && !defined (AS_COMPILATION)
22 #error "Only <appstream.h> can be included directly."
23 #endif
24
25 #ifndef __AS_COMPONENT_H
26 #define __AS_COMPONENT_H
27
28 #include <glib-object.h>
29 #include "as-screenshot.h"
30 #include "as-provides.h"
31 #include "as-release.h"
32 #include "as-enums.h"
33
34 #define AS_TYPE_COMPONENT_KIND (as_component_kind_get_type ())
35
36 #define AS_TYPE_COMPONENT (as_component_get_type ())
37 #define AS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AS_TYPE_COMPONENT, AsComponent))
38 #define AS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AS_TYPE_COMPONENT, AsComponentClass))
39 #define AS_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AS_TYPE_COMPONENT))
40 #define AS_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AS_TYPE_COMPONENT))
41 #define AS_COMPONENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AS_TYPE_COMPONENT, AsComponentClass))
42
43 G_BEGIN_DECLS
44
45 typedef struct _AsComponent AsComponent;
46 typedef struct _AsComponentClass AsComponentClass;
47 typedef struct _AsComponentPrivate AsComponentPrivate;
48
49 struct _AsComponent
50 {
51         GObject parent_instance;
52         AsComponentPrivate * priv;
53 };
54
55 struct _AsComponentClass
56 {
57         GObjectClass parent_class;
58         /*< private >*/
59         void (*_as_reserved1)   (void);
60         void (*_as_reserved2)   (void);
61         void (*_as_reserved3)   (void);
62         void (*_as_reserved4)   (void);
63         void (*_as_reserved5)   (void);
64         void (*_as_reserved6)   (void);
65         void (*_as_reserved7)   (void);
66         void (*_as_reserved8)   (void);
67 };
68
69 /**
70  * AsComponentKind:
71  * @AS_COMPONENT_KIND_UNKNOWN:          Type invalid or not known
72  * @AS_COMPONENT_KIND_GENERIC:          A generic (= without specialized type) component
73  * @AS_COMPONENT_KIND_DESKTOP_APP:      An application with a .desktop-file
74  * @AS_COMPONENT_KIND_FONT:                     A font
75  * @AS_COMPONENT_KIND_CODEC:            A multimedia codec
76  * @AS_COMPONENT_KIND_INPUTMETHOD:      An input-method provider
77  *
78  * The URL type.
79  **/
80 typedef enum  {
81         AS_COMPONENT_KIND_UNKNOWN,
82         AS_COMPONENT_KIND_GENERIC,
83         AS_COMPONENT_KIND_DESKTOP_APP,
84         AS_COMPONENT_KIND_FONT,
85         AS_COMPONENT_KIND_CODEC,
86         AS_COMPONENT_KIND_INPUTMETHOD,
87         AS_COMPONENT_KIND_LAST
88 } AsComponentKind;
89
90 GType                           as_component_kind_get_type (void) G_GNUC_CONST;
91 const gchar*            as_component_kind_to_string (AsComponentKind kind);
92 AsComponentKind         as_component_kind_from_string (const gchar *kind_str);
93
94 GType                           as_component_get_type (void) G_GNUC_CONST;
95 AsComponent*            as_component_new (void);
96 AsComponent*            as_component_construct (GType object_type);
97 gboolean                        as_component_is_valid (AsComponent* self);
98 gchar*                          as_component_to_string (AsComponent* self);
99
100 gboolean                        as_component_provides_item (AsComponent *self,
101                                                                                                 AsProvidesKind kind, const gchar *value);
102
103 AsComponentKind         as_component_get_kind (AsComponent* self);
104 void                            as_component_set_kind (AsComponent* self,
105                                                                                    AsComponentKind value);
106
107 const gchar*            as_component_get_id (AsComponent* self);
108 void                            as_component_set_id (AsComponent* self,
109                                                                                          const gchar* value);
110
111 const gchar*            as_component_get_pkgname (AsComponent* self);
112 void                            as_component_set_pkgname (AsComponent* self,
113                                                                                           const gchar* value);
114
115 const gchar*            as_component_get_name (AsComponent* self);
116 void                            as_component_set_name (AsComponent* self,
117                                                                                    const gchar* value);
118 const gchar*            as_component_get_name_original (AsComponent* self);
119 void                            as_component_set_name_original (AsComponent* self,
120                                                                                                         const gchar* value);
121
122 const gchar*            as_component_get_project_license (AsComponent* self);
123 void                            as_component_set_project_license (AsComponent* self,
124                                                                                                           const gchar* value);
125
126 const gchar*            as_component_get_project_group (AsComponent* self);
127 void                            as_component_set_project_group (AsComponent* self,
128                                                                                                         const gchar* value);
129
130 gchar**                         as_component_get_compulsory_for_desktops (AsComponent* self);
131 void                            as_component_set_compulsory_for_desktops (AsComponent* self,
132                                                                                                                           gchar** value);
133 gboolean                        as_component_is_compulsory_for_desktop (AsComponent* self,
134                                                                                                                           const gchar* desktop);
135
136 const gchar*            as_component_get_summary (AsComponent* self);
137 void                            as_component_set_summary (AsComponent* self,
138                                                                                           const gchar* value);
139
140 gchar**                         as_component_get_categories (AsComponent* self);
141 void                            as_component_set_categories (AsComponent* self,
142                                                                                                  gchar** value);
143 void                            as_component_set_categories_from_str (AsComponent* self,
144                                                                                                 const gchar* categories_str);
145 gboolean                        as_component_has_category (AsComponent *self,
146                                                                                                 const gchar *category);
147
148 GPtrArray*                      as_component_get_screenshots (AsComponent* self);
149 void                            as_component_add_screenshot (AsComponent* self,
150                                                                                                  AsScreenshot* sshot);
151
152 const gchar*            as_component_get_description (AsComponent* self);
153 void                            as_component_set_description (AsComponent* self,
154                                                                                                   const gchar* value);
155
156 gchar**                         as_component_get_keywords (AsComponent* self);
157 void                            as_component_set_keywords (AsComponent* self,
158                                                                                            gchar** value);
159
160 const gchar*            as_component_get_icon (AsComponent* self);
161 void                            as_component_set_icon (AsComponent* self,
162                                                                                    const gchar* value);
163 const gchar*            as_component_get_icon_url (AsComponent* self);
164 void                            as_component_set_icon_url (AsComponent* self,
165                                                                                            const gchar* value);
166
167 gchar**                         as_component_get_mimetypes (AsComponent* self);
168 void                            as_component_set_mimetypes (AsComponent* self,
169                                                                                                 gchar** value);
170
171 GPtrArray*                      as_component_get_provided_items (AsComponent* self);
172
173 GHashTable*                     as_component_get_urls (AsComponent *self);
174 const gchar*            as_component_get_url (AsComponent *self,
175                                                                                   AsUrlKind url_kind);
176 void                            as_component_add_url (AsComponent *self,
177                                                                                 AsUrlKind url_kind,
178                                                                                 const gchar *url);
179
180 GPtrArray*                      as_component_get_releases (AsComponent* self);
181 void                            as_component_add_release (AsComponent* self,
182                                                                                                  AsRelease* release);
183
184 /* deprecated */
185 const gchar*            as_component_get_homepage (AsComponent* self);
186 void                            as_component_set_homepage (AsComponent* self,
187                                                                                            const gchar* value);
188
189 const gchar*            as_component_get_idname (AsComponent* self);
190 void                            as_component_set_idname (AsComponent* self,
191                                                                                          const gchar* value);
192
193 G_END_DECLS
194
195 #endif /* __AS_COMPONENT_H */