Imported Upstream version 1.35.9
[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 <givfuncinfo.h>
49
50 G_BEGIN_DECLS
51
52 #define G_TYPE_IREPOSITORY              (g_irepository_get_type ())
53 #define G_IREPOSITORY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_IREPOSITORY, GIRepository))
54 #define G_IREPOSITORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_IREPOSITORY, GIRepositoryClass))
55 #define G_IS_IREPOSITORY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_IREPOSITORY))
56 #define G_IS_IREPOSITORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
57 #define G_IREPOSITORY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
58
59 typedef struct _GIRepository         GIRepository;
60 typedef struct _GIRepositoryClass    GIRepositoryClass;
61 typedef struct _GIRepositoryPrivate  GIRepositoryPrivate;
62
63 struct _GIRepository
64 {
65   GObject parent;
66
67   /*< private >*/
68   GIRepositoryPrivate *priv;
69 };
70
71 struct _GIRepositoryClass
72 {
73   GObjectClass parent;
74 };
75
76 /**
77  * GIRepositoryLoadFlags:
78  * @G_IREPOSITORY_LOAD_FLAG_LAZY: Load the types lazily.
79  *
80  * Flags that controlls how a typelib is loaded by
81  * GIRepositry, used by g_irepository_load_typelib().
82  */
83 typedef enum
84 {
85   G_IREPOSITORY_LOAD_FLAG_LAZY = 1 << 0
86 } GIRepositoryLoadFlags;
87
88 /* Repository */
89
90 GType         g_irepository_get_type      (void) G_GNUC_CONST;
91 GIRepository *g_irepository_get_default   (void);
92 void          g_irepository_prepend_search_path (const char *directory);
93 void          g_irepository_prepend_library_path (const char *directory);
94 GSList *      g_irepository_get_search_path     (void);
95 const char *  g_irepository_load_typelib  (GIRepository *repository,
96                                            GITypelib     *typelib,
97                                            GIRepositoryLoadFlags flags,
98                                            GError      **error);
99 gboolean      g_irepository_is_registered (GIRepository *repository,
100                                            const gchar  *namespace_,
101                                            const gchar  *version);
102 GIBaseInfo *  g_irepository_find_by_name  (GIRepository *repository,
103                                            const gchar  *namespace_,
104                                            const gchar  *name);
105 GList *       g_irepository_enumerate_versions (GIRepository *repository,
106                                                 const gchar  *namespace_);
107 GITypelib *    g_irepository_require       (GIRepository *repository,
108                                            const gchar  *namespace_,
109                                            const gchar  *version,
110                                            GIRepositoryLoadFlags flags,
111                                            GError      **error);
112 GITypelib *    g_irepository_require_private (GIRepository  *repository,
113                                              const gchar   *typelib_dir,
114                                              const gchar   *namespace_,
115                                              const gchar   *version,
116                                              GIRepositoryLoadFlags flags,
117                                              GError       **error);
118 gchar      ** g_irepository_get_dependencies (GIRepository *repository,
119                                               const gchar  *namespace_);
120 gchar      ** g_irepository_get_loaded_namespaces (GIRepository *repository);
121 GIBaseInfo *  g_irepository_find_by_gtype (GIRepository *repository,
122                                            GType         gtype);
123 gint          g_irepository_get_n_infos   (GIRepository *repository,
124                                            const gchar  *namespace_);
125 GIBaseInfo *  g_irepository_get_info      (GIRepository *repository,
126                                            const gchar  *namespace_,
127                                            gint          index);
128 GIEnumInfo *  g_irepository_find_by_error_domain (GIRepository *repository,
129                                                   GQuark        domain);
130 const gchar * g_irepository_get_typelib_path   (GIRepository *repository,
131                                                 const gchar  *namespace_);
132 const gchar * g_irepository_get_shared_library (GIRepository *repository,
133                                                 const gchar  *namespace_);
134 const gchar * g_irepository_get_c_prefix (GIRepository *repository,
135                                           const gchar  *namespace_);
136 const gchar * g_irepository_get_version (GIRepository *repository,
137                                          const gchar  *namespace_);
138
139 GOptionGroup * g_irepository_get_option_group (void);
140
141 gboolean       g_irepository_dump  (const char *arg, GError **error);
142
143 /**
144  * GIRepositoryError:
145  * @G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND: the typelib could not be found.
146  * @G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH: the namespace does not match the
147  * requested namespace.
148  * @G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT: the version of the
149  * typelib does not match the requested version.
150  * @G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND: the library used by the typelib
151  * could not be found.
152  */
153 typedef enum
154 {
155   G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
156   G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH,
157   G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
158   G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND
159 } GIRepositoryError;
160
161 #define G_IREPOSITORY_ERROR (g_irepository_error_quark ())
162
163 GQuark g_irepository_error_quark (void);
164
165
166 /* Global utility functions */
167
168 void gi_cclosure_marshal_generic (GClosure       *closure,
169                                   GValue         *return_gvalue,
170                                   guint           n_param_values,
171                                   const GValue   *param_values,
172                                   gpointer        invocation_hint,
173                                   gpointer        marshal_data);
174
175 G_END_DECLS
176
177
178 #endif  /* __G_IREPOSITORY_H__ */
179