Imported Upstream version 1.59.4
[platform/upstream/gobject-introspection.git] / girepository / girepository.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2  * GObject introspection: Repository
3  *
4  * Copyright (C) 2005 Matthias Clasen
5  * Copyright (C) 2008,2009 Red Hat, Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (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 GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __G_IREPOSITORY_H__
24 #define __G_IREPOSITORY_H__
25
26 #include <glib-object.h>
27 #include <gmodule.h>
28
29 #define __GIREPOSITORY_H_INSIDE__
30
31 #include <giarginfo.h>
32 #include <gibaseinfo.h>
33 #include <gicallableinfo.h>
34 #include <giconstantinfo.h>
35 #include <gienuminfo.h>
36 #include <gifieldinfo.h>
37 #include <gifunctioninfo.h>
38 #include <giinterfaceinfo.h>
39 #include <giobjectinfo.h>
40 #include <gipropertyinfo.h>
41 #include <giregisteredtypeinfo.h>
42 #include <gisignalinfo.h>
43 #include <gistructinfo.h>
44 #include <gitypeinfo.h>
45 #include <gitypelib.h>
46 #include <gitypes.h>
47 #include <giunioninfo.h>
48 #include <giversionmacros.h>
49 #include <givfuncinfo.h>
50 #include <giversion.h>
51
52 G_BEGIN_DECLS
53
54 #define G_TYPE_IREPOSITORY              (g_irepository_get_type ())
55 #define G_IREPOSITORY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_IREPOSITORY, GIRepository))
56 #define G_IREPOSITORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_IREPOSITORY, GIRepositoryClass))
57 #define G_IS_IREPOSITORY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_IREPOSITORY))
58 #define G_IS_IREPOSITORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
59 #define G_IREPOSITORY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
60
61 /**
62  * GIRepository:
63  *
64  * The GIRepository structure contains private data and should only be
65  * accessed using the provided API.
66  */
67 typedef struct _GIRepository         GIRepository;
68 typedef struct _GIRepositoryClass    GIRepositoryClass;
69 typedef struct _GIRepositoryPrivate  GIRepositoryPrivate;
70
71 struct _GIRepository
72 {
73   /*< private >*/
74   GObject parent;
75   GIRepositoryPrivate *priv;
76 };
77
78 struct _GIRepositoryClass
79 {
80   /*< private >*/
81   GObjectClass parent;
82 };
83
84 /**
85  * GIRepositoryLoadFlags:
86  * @G_IREPOSITORY_LOAD_FLAG_LAZY: Lazily load the typelib.
87  *
88  * Flags that control how a typelib is loaded.
89  */
90 typedef enum
91 {
92   G_IREPOSITORY_LOAD_FLAG_LAZY = 1 << 0
93 } GIRepositoryLoadFlags;
94
95 /* Repository */
96
97 GI_AVAILABLE_IN_ALL
98 GType         g_irepository_get_type      (void) G_GNUC_CONST;
99
100 GI_AVAILABLE_IN_ALL
101 GIRepository *g_irepository_get_default   (void);
102
103 GI_AVAILABLE_IN_ALL
104 void          g_irepository_prepend_search_path (const char *directory);
105
106 GI_AVAILABLE_IN_1_36
107 void          g_irepository_prepend_library_path (const char *directory);
108
109 GI_AVAILABLE_IN_ALL
110 GSList *      g_irepository_get_search_path     (void);
111
112 GI_AVAILABLE_IN_ALL
113 const char *  g_irepository_load_typelib  (GIRepository *repository,
114                                            GITypelib     *typelib,
115                                            GIRepositoryLoadFlags flags,
116                                            GError      **error);
117
118 GI_AVAILABLE_IN_ALL
119 gboolean      g_irepository_is_registered (GIRepository *repository,
120                                            const gchar  *namespace_,
121                                            const gchar  *version);
122
123 GI_AVAILABLE_IN_ALL
124 GIBaseInfo *  g_irepository_find_by_name  (GIRepository *repository,
125                                            const gchar  *namespace_,
126                                            const gchar  *name);
127
128 GI_AVAILABLE_IN_ALL
129 GList *       g_irepository_enumerate_versions (GIRepository *repository,
130                                                 const gchar  *namespace_);
131
132 GI_AVAILABLE_IN_ALL
133 GITypelib *    g_irepository_require       (GIRepository *repository,
134                                            const gchar  *namespace_,
135                                            const gchar  *version,
136                                            GIRepositoryLoadFlags flags,
137                                            GError      **error);
138
139 GI_AVAILABLE_IN_ALL
140 GITypelib *    g_irepository_require_private (GIRepository  *repository,
141                                              const gchar   *typelib_dir,
142                                              const gchar   *namespace_,
143                                              const gchar   *version,
144                                              GIRepositoryLoadFlags flags,
145                                              GError       **error);
146
147 GI_AVAILABLE_IN_1_44
148 gchar      ** g_irepository_get_immediate_dependencies (GIRepository *repository,
149                                                         const gchar  *namespace_);
150
151 GI_AVAILABLE_IN_ALL
152 gchar      ** g_irepository_get_dependencies (GIRepository *repository,
153                                               const gchar  *namespace_);
154
155 GI_AVAILABLE_IN_ALL
156 gchar      ** g_irepository_get_loaded_namespaces (GIRepository *repository);
157
158 GI_AVAILABLE_IN_ALL
159 GIBaseInfo *  g_irepository_find_by_gtype (GIRepository *repository,
160                                            GType         gtype);
161
162 GI_AVAILABLE_IN_1_60
163 void          g_irepository_get_object_gtype_interfaces (GIRepository      *repository,
164                                                          GType              gtype,
165                                                          guint             *n_interfaces_out,
166                                                          GIInterfaceInfo  **interfaces_out);
167
168 GI_AVAILABLE_IN_ALL
169 gint          g_irepository_get_n_infos   (GIRepository *repository,
170                                            const gchar  *namespace_);
171
172 GI_AVAILABLE_IN_ALL
173 GIBaseInfo *  g_irepository_get_info      (GIRepository *repository,
174                                            const gchar  *namespace_,
175                                            gint          index);
176
177 GI_AVAILABLE_IN_ALL
178 GIEnumInfo *  g_irepository_find_by_error_domain (GIRepository *repository,
179                                                   GQuark        domain);
180
181 GI_AVAILABLE_IN_ALL
182 const gchar * g_irepository_get_typelib_path   (GIRepository *repository,
183                                                 const gchar  *namespace_);
184 GI_AVAILABLE_IN_ALL
185 const gchar * g_irepository_get_shared_library (GIRepository *repository,
186                                                 const gchar  *namespace_);
187 GI_AVAILABLE_IN_ALL
188 const gchar * g_irepository_get_c_prefix (GIRepository *repository,
189                                           const gchar  *namespace_);
190 GI_AVAILABLE_IN_ALL
191 const gchar * g_irepository_get_version (GIRepository *repository,
192                                          const gchar  *namespace_);
193
194
195 GI_AVAILABLE_IN_ALL
196 GOptionGroup * g_irepository_get_option_group (void);
197
198
199 GI_AVAILABLE_IN_ALL
200 gboolean       g_irepository_dump  (const char *arg, GError **error);
201
202 /**
203  * GIRepositoryError:
204  * @G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND: the typelib could not be found.
205  * @G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH: the namespace does not match the
206  *   requested namespace.
207  * @G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT: the version of the
208  *   typelib does not match the requested version.
209  * @G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND: the library used by the typelib
210  *   could not be found.
211  *
212  * An error code used with #G_IREPOSITORY_ERROR in a #GError returned
213  * from a #GIRepository routine.
214  */
215 typedef enum
216 {
217   G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
218   G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH,
219   G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
220   G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND
221 } GIRepositoryError;
222
223 /**
224  * G_IREPOSITORY_ERROR:
225  *
226  * Error domain for #GIRepository. Errors in this domain will be from the
227  * #GIRepositoryError enumeration. See #GError for more information on
228  * error domains.
229  */
230 #define G_IREPOSITORY_ERROR (g_irepository_error_quark ())
231
232 GI_AVAILABLE_IN_ALL
233 GQuark g_irepository_error_quark (void);
234
235
236 /* Global utility functions */
237
238 GI_AVAILABLE_IN_ALL
239 void gi_cclosure_marshal_generic (GClosure       *closure,
240                                   GValue         *return_gvalue,
241                                   guint           n_param_values,
242                                   const GValue   *param_values,
243                                   gpointer        invocation_hint,
244                                   gpointer        marshal_data);
245
246 G_END_DECLS
247
248
249 #endif  /* __G_IREPOSITORY_H__ */
250