1  /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
       2   * GObject introspection: Function
       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  #if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
      28  #error "Only <girepository.h> can be included directly."
      29  #endif
      30  
      31  #include <girepository/gitypes.h>
      32  
      33  G_BEGIN_DECLS
      34  
      35  /**
      36   * GI_IS_FUNCTION_INFO:
      37   * @info: an info structure
      38   *
      39   * Checks if @info is a [class@GIRepository.FunctionInfo].
      40   *
      41   * Since: 2.80
      42   */
      43  #define GI_IS_FUNCTION_INFO(info) \
      44      (gi_base_info_get_info_type ((GIBaseInfo*) info) ==  GI_INFO_TYPE_FUNCTION)
      45  
      46  
      47  GI_AVAILABLE_IN_ALL
      48  const gchar *           gi_function_info_get_symbol     (GIFunctionInfo *info);
      49  
      50  GI_AVAILABLE_IN_ALL
      51  GIFunctionInfoFlags     gi_function_info_get_flags      (GIFunctionInfo *info);
      52  
      53  GI_AVAILABLE_IN_ALL
      54  GIPropertyInfo *        gi_function_info_get_property   (GIFunctionInfo *info);
      55  
      56  GI_AVAILABLE_IN_ALL
      57  GIVFuncInfo *           gi_function_info_get_vfunc      (GIFunctionInfo *info);
      58  
      59  /**
      60   * GI_INVOKE_ERROR:
      61   *
      62   * Type quark function for [enum@GIRepository.InvokeError].
      63   *
      64   * Since: 2.80
      65   */
      66  #define GI_INVOKE_ERROR (gi_invoke_error_quark ())
      67  
      68  GI_AVAILABLE_IN_ALL
      69  GQuark gi_invoke_error_quark (void);
      70  
      71  /**
      72   * GIInvokeError:
      73   * @GI_INVOKE_ERROR_FAILED: invocation failed, unknown error.
      74   * @GI_INVOKE_ERROR_SYMBOL_NOT_FOUND: symbol couldn’t be found in any of the
      75   *   libraries associated with the typelib of the function.
      76   * @GI_INVOKE_ERROR_ARGUMENT_MISMATCH: the arguments provided didn’t match
      77   *   the expected arguments for the function’s type signature.
      78   *
      79   * An error occurring while invoking a function via
      80   * [method@GIRepository.FunctionInfo.invoke].
      81   *
      82   * Since: 2.80
      83   */
      84  typedef enum
      85  {
      86    GI_INVOKE_ERROR_FAILED,
      87    GI_INVOKE_ERROR_SYMBOL_NOT_FOUND,
      88    GI_INVOKE_ERROR_ARGUMENT_MISMATCH
      89  } GIInvokeError;
      90  
      91  
      92  GI_AVAILABLE_IN_ALL
      93  gboolean              gi_function_info_invoke         (GIFunctionInfo    *info,
      94                                                         const GIArgument  *in_args,
      95                                                         gsize              n_in_args,
      96                                                         const GIArgument  *out_args,
      97                                                         gsize              n_out_args,
      98                                                         GIArgument        *return_value,
      99                                                         GError           **error);
     100  
     101  
     102  G_END_DECLS