glib (2.79.0)

(root)/
include/
glib-2.0/
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   * SPDX-License-Identifier: LGPL-2.1-or-later
       8   *
       9   * This library is free software; you can redistribute it and/or
      10   * modify it under the terms of the GNU Lesser General Public
      11   * License as published by the Free Software Foundation; either
      12   * version 2 of the License, or (at your option) any later version.
      13   *
      14   * This library is distributed in the hope that it will be useful,
      15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17   * Lesser General Public License for more details.
      18   *
      19   * You should have received a copy of the GNU Lesser General Public
      20   * License along with this library; if not, write to the
      21   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      22   * Boston, MA 02111-1307, USA.
      23   */
      24  
      25  #pragma once
      26  
      27  #include <glib-object.h>
      28  #include <gmodule.h>
      29  
      30  #include <girepository/gi-visibility.h>
      31  
      32  #define __GIREPOSITORY_H_INSIDE__
      33  
      34  #include <girepository/giarginfo.h>
      35  #include <girepository/gibaseinfo.h>
      36  #include <girepository/gicallableinfo.h>
      37  #include <girepository/gicallbackinfo.h>
      38  #include <girepository/giconstantinfo.h>
      39  #include <girepository/gienuminfo.h>
      40  #include <girepository/gifieldinfo.h>
      41  #include <girepository/gifunctioninfo.h>
      42  #include <girepository/giinterfaceinfo.h>
      43  #include <girepository/giobjectinfo.h>
      44  #include <girepository/gipropertyinfo.h>
      45  #include <girepository/giregisteredtypeinfo.h>
      46  #include <girepository/gisignalinfo.h>
      47  #include <girepository/gistructinfo.h>
      48  #include <girepository/gitypeinfo.h>
      49  #include <girepository/gitypelib.h>
      50  #include <girepository/gitypes.h>
      51  #include <girepository/giunioninfo.h>
      52  #include <girepository/giunresolvedinfo.h>
      53  #include <girepository/givfuncinfo.h>
      54  
      55  G_BEGIN_DECLS
      56  
      57  #define GI_TYPE_REPOSITORY              (gi_repository_get_type ())
      58  #define GI_REPOSITORY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GI_TYPE_REPOSITORY, GIRepository))
      59  #define GI_REPOSITORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GI_TYPE_REPOSITORY, GIRepositoryClass))
      60  #define GI_IS_REPOSITORY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GI_TYPE_REPOSITORY))
      61  #define GI_IS_REPOSITORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GI_TYPE_REPOSITORY))
      62  #define GI_REPOSITORY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GI_TYPE_REPOSITORY, GIRepositoryClass))
      63  
      64  typedef struct _GIRepository         GIRepository;
      65  typedef struct _GIRepositoryClass    GIRepositoryClass;
      66  typedef struct _GIRepositoryPrivate  GIRepositoryPrivate;
      67  
      68  struct _GIRepository
      69  {
      70    /*< private >*/
      71    GObject parent;
      72    GIRepositoryPrivate *priv;
      73  };
      74  
      75  struct _GIRepositoryClass
      76  {
      77    /*< private >*/
      78    GObjectClass parent;
      79  };
      80  
      81  /**
      82   * GIRepositoryLoadFlags:
      83   * @GI_REPOSITORY_LOAD_FLAG_LAZY: Lazily load the typelib.
      84   *
      85   * Flags that control how a typelib is loaded.
      86   *
      87   * Since: 2.80
      88   */
      89  typedef enum
      90  {
      91    GI_REPOSITORY_LOAD_FLAG_LAZY = 1 << 0
      92  } GIRepositoryLoadFlags;
      93  
      94  /* Repository */
      95  
      96  GI_AVAILABLE_IN_ALL
      97  GType         gi_repository_get_type      (void) G_GNUC_CONST;
      98  
      99  GI_AVAILABLE_IN_ALL
     100  GIRepository *gi_repository_get_default   (void);
     101  
     102  GI_AVAILABLE_IN_ALL
     103  GIRepository *gi_repository_new (void);
     104  
     105  GI_AVAILABLE_IN_ALL
     106  void          gi_repository_prepend_search_path (const char *directory);
     107  
     108  GI_AVAILABLE_IN_ALL
     109  void          gi_repository_prepend_library_path (const char *directory);
     110  
     111  GI_AVAILABLE_IN_ALL
     112  const char * const * gi_repository_get_search_path (size_t *n_paths_out);
     113  
     114  GI_AVAILABLE_IN_ALL
     115  const char *  gi_repository_load_typelib  (GIRepository           *repository,
     116                                             GITypelib              *typelib,
     117                                             GIRepositoryLoadFlags   flags,
     118                                             GError                **error);
     119  
     120  GI_AVAILABLE_IN_ALL
     121  gboolean      gi_repository_is_registered (GIRepository *repository,
     122                                             const gchar  *namespace_,
     123                                             const gchar  *version);
     124  
     125  GI_AVAILABLE_IN_ALL
     126  GIBaseInfo *  gi_repository_find_by_name  (GIRepository *repository,
     127                                             const gchar  *namespace_,
     128                                             const gchar  *name);
     129  
     130  GI_AVAILABLE_IN_ALL
     131  char       ** gi_repository_enumerate_versions (GIRepository *repository,
     132                                                  const gchar  *namespace_,
     133                                                  size_t       *n_versions_out);
     134  
     135  GI_AVAILABLE_IN_ALL
     136  GITypelib *    gi_repository_require       (GIRepository           *repository,
     137                                              const gchar            *namespace_,
     138                                              const gchar            *version,
     139                                              GIRepositoryLoadFlags   flags,
     140                                              GError                **error);
     141  
     142  GI_AVAILABLE_IN_ALL
     143  GITypelib *    gi_repository_require_private (GIRepository           *repository,
     144                                                const gchar            *typelib_dir,
     145                                                const gchar            *namespace_,
     146                                                const gchar            *version,
     147                                                GIRepositoryLoadFlags   flags,
     148                                                GError                **error);
     149  
     150  GI_AVAILABLE_IN_ALL
     151  gchar      ** gi_repository_get_immediate_dependencies (GIRepository *repository,
     152                                                          const gchar  *namespace_);
     153  
     154  GI_AVAILABLE_IN_ALL
     155  gchar      ** gi_repository_get_dependencies (GIRepository *repository,
     156                                                const gchar  *namespace_);
     157  
     158  GI_AVAILABLE_IN_ALL
     159  gchar      ** gi_repository_get_loaded_namespaces (GIRepository *repository);
     160  
     161  GI_AVAILABLE_IN_ALL
     162  GIBaseInfo *  gi_repository_find_by_gtype (GIRepository *repository,
     163                                             GType         gtype);
     164  
     165  GI_AVAILABLE_IN_ALL
     166  void          gi_repository_get_object_gtype_interfaces (GIRepository      *repository,
     167                                                           GType              gtype,
     168                                                           gsize             *n_interfaces_out,
     169                                                           GIInterfaceInfo ***interfaces_out);
     170  
     171  GI_AVAILABLE_IN_ALL
     172  guint         gi_repository_get_n_infos   (GIRepository *repository,
     173                                             const gchar  *namespace_);
     174  
     175  GI_AVAILABLE_IN_ALL
     176  GIBaseInfo *  gi_repository_get_info      (GIRepository *repository,
     177                                             const gchar  *namespace_,
     178                                             guint         idx);
     179  
     180  GI_AVAILABLE_IN_ALL
     181  GIEnumInfo *  gi_repository_find_by_error_domain (GIRepository *repository,
     182                                                    GQuark        domain);
     183  
     184  GI_AVAILABLE_IN_ALL
     185  const gchar * gi_repository_get_typelib_path   (GIRepository *repository,
     186                                                  const gchar  *namespace_);
     187  GI_AVAILABLE_IN_ALL
     188  const gchar * gi_repository_get_shared_library (GIRepository *repository,
     189                                                  const gchar  *namespace_);
     190  GI_AVAILABLE_IN_ALL
     191  const gchar * gi_repository_get_c_prefix (GIRepository *repository,
     192                                            const gchar  *namespace_);
     193  GI_AVAILABLE_IN_ALL
     194  const gchar * gi_repository_get_version (GIRepository *repository,
     195                                           const gchar  *namespace_);
     196  
     197  
     198  GI_AVAILABLE_IN_ALL
     199  GOptionGroup * gi_repository_get_option_group (void);
     200  
     201  
     202  GI_AVAILABLE_IN_ALL
     203  gboolean       gi_repository_dump  (const char  *input_filename,
     204                                      const char  *output_filename,
     205                                      GError     **error);
     206  
     207  /**
     208   * GIRepositoryError:
     209   * @GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND: the typelib could not be found.
     210   * @GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH: the namespace does not match the
     211   *   requested namespace.
     212   * @GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT: the version of the
     213   *   typelib does not match the requested version.
     214   * @GI_REPOSITORY_ERROR_LIBRARY_NOT_FOUND: the library used by the typelib
     215   *   could not be found.
     216   *
     217   * An error code used with `GI_REPOSITORY_ERROR` in a [type@GLib.Error]
     218   * returned from a [class@GIRepository.Repository] routine.
     219   *
     220   * Since: 2.80
     221   */
     222  typedef enum
     223  {
     224    GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
     225    GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
     226    GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
     227    GI_REPOSITORY_ERROR_LIBRARY_NOT_FOUND
     228  } GIRepositoryError;
     229  
     230  /**
     231   * GI_REPOSITORY_ERROR:
     232   *
     233   * Error domain for [class@GIRepository.Repository].
     234   *
     235   * Errors in this domain will be from the [enum@GIRepository.Error] enumeration.
     236   * See [type@GLib.Error] for more information on error domains.
     237   *
     238   * Since: 2.80
     239   */
     240  #define GI_REPOSITORY_ERROR (gi_repository_error_quark ())
     241  
     242  GI_AVAILABLE_IN_ALL
     243  GQuark gi_repository_error_quark (void);
     244  
     245  
     246  /* Global utility functions */
     247  
     248  GI_AVAILABLE_IN_ALL
     249  void gi_cclosure_marshal_generic (GClosure       *closure,
     250                                    GValue         *return_gvalue,
     251                                    guint           n_param_values,
     252                                    const GValue   *param_values,
     253                                    gpointer        invocation_hint,
     254                                    gpointer        marshal_data);
     255  
     256  G_END_DECLS