GICallableInfo

GICallableInfo — Struct representing a callable

Functions

Types and Values

typedef GICallableInfo

Description

GICallableInfo represents an entity which is callable.

Examples of callable are:

A callable has a list of arguments (GIArgInfo), a return type, direction and a flag which decides if it returns null.

Functions

GI_IS_CALLABLE_INFO()

#define             GI_IS_CALLABLE_INFO(info)

Checks if info is a GICallableInfo or derived from it.

Parameters

info

an info structure

 

g_callable_info_can_throw_gerror ()

gboolean
g_callable_info_can_throw_gerror (GICallableInfo *info);

TODO

Parameters

info

a GICallableInfo

 

Returns

TRUE if this GICallableInfo can throw a GError

Since: 1.34


g_callable_info_get_n_args ()

gint
g_callable_info_get_n_args (GICallableInfo *info);

Obtain the number of arguments (both IN and OUT) for this callable.

Parameters

info

a GICallableInfo

 

Returns

The number of arguments this callable expects.


g_callable_info_get_arg ()

GIArgInfo *
g_callable_info_get_arg (GICallableInfo *info,
                         gint n);

Obtain information about a particular argument of this callable.

Parameters

info

a GICallableInfo

 

n

the argument index to fetch

 

Returns

the GIArgInfo. Free it with g_base_info_unref() when done.

[transfer full]


g_callable_info_get_caller_owns ()

GITransfer
g_callable_info_get_caller_owns (GICallableInfo *info);

See whether the caller owns the return value of this callable. GITransfer contains a list of possible transfer values.

Parameters

info

a GICallableInfo

 

Returns

the transfer mode for the return value of the callable


g_callable_info_get_instance_ownership_transfer ()

GITransfer
g_callable_info_get_instance_ownership_transfer
                               (GICallableInfo *info);

Obtains the ownership transfer for the instance argument. GITransfer contains a list of possible transfer values.

Parameters

info

a GICallableInfo

 

Returns

the transfer mode of the instance argument

Since: 1.42


g_callable_info_get_return_attribute ()

const gchar *
g_callable_info_get_return_attribute (GICallableInfo *info,
                                      const gchar *name);

Retrieve an arbitrary attribute associated with the return value.

Parameters

info

a GICallableInfo

 

name

a freeform string naming an attribute

 

Returns

The value of the attribute, or NULL if no such attribute exists


g_callable_info_get_return_type ()

GITypeInfo *
g_callable_info_get_return_type (GICallableInfo *info);

Obtain the return type of a callable item as a GITypeInfo.

Parameters

info

a GICallableInfo

 

Returns

the GITypeInfo. Free the struct by calling g_base_info_unref() when done.

[transfer full]


g_callable_info_invoke ()

gboolean
g_callable_info_invoke (GICallableInfo *info,
                        gpointer function,
                        const GIArgument *in_args,
                        int n_in_args,
                        const GIArgument *out_args,
                        int n_out_args,
                        GIArgument *return_value,
                        gboolean is_method,
                        gboolean throws,
                        GError **error);

TODO

Parameters

info

TODO

 

function

TODO

 

in_args

TODO.

[array length=n_in_args]

n_in_args

TODO

 

out_args

TODO.

[array length=n_out_args]

n_out_args

TODO

 

return_value

TODO

 

is_method

TODO

 

throws

TODO

 

error

TODO

 

g_callable_info_is_method ()

gboolean
g_callable_info_is_method (GICallableInfo *info);

Determines if the callable info is a method. For GIVFuncInfos, GICallbackInfos, and GISignalInfos, this is always true. Otherwise, this looks at the GI_FUNCTION_IS_METHOD flag on the GIFunctionInfo.

Concretely, this function returns whether g_callable_info_get_n_args() matches the number of arguments in the raw C method. For methods, there is one more C argument than is exposed by introspection: the "self" or "this" object.

Parameters

info

a GICallableInfo

 

Returns

TRUE if info is a method, FALSE otherwise

Since: 1.34


g_callable_info_iterate_return_attributes ()

gboolean
g_callable_info_iterate_return_attributes
                               (GICallableInfo *info,
                                GIAttributeIter *iterator,
                                char **name,
                                char **value);

Iterate over all attributes associated with the return value. The iterator structure is typically stack allocated, and must have its first member initialized to NULL.

Both the name and value should be treated as constants and must not be freed.

See g_base_info_iterate_attributes() for an example of how to use a similar API.

Parameters

info

a GICallableInfo

 

iterator

a GIAttributeIter structure, must be initialized; see below.

[inout]

name

Returned name, must not be freed.

[out][transfer none]

value

Returned name, must not be freed.

[out][transfer none]

Returns

TRUE if there are more attributes


g_callable_info_load_arg ()

void
g_callable_info_load_arg (GICallableInfo *info,
                          gint n,
                          GIArgInfo *arg);

Obtain information about a particular argument of this callable; this function is a variant of g_callable_info_get_arg() designed for stack allocation.

The initialized arg must not be referenced after info is deallocated.

Parameters

info

a GICallableInfo

 

n

the argument index to fetch

 

arg

Initialize with argument number n .

[out caller-allocates]

g_callable_info_load_return_type ()

void
g_callable_info_load_return_type (GICallableInfo *info,
                                  GITypeInfo *type);

Obtain information about a return value of callable; this function is a variant of g_callable_info_get_return_type() designed for stack allocation.

The initialized type must not be referenced after info is deallocated.

Parameters

info

a GICallableInfo

 

type

Initialized with return type of info .

[out caller-allocates]

g_callable_info_may_return_null ()

gboolean
g_callable_info_may_return_null (GICallableInfo *info);

See if a callable could return NULL.

Parameters

info

a GICallableInfo

 

Returns

TRUE if callable could return NULL


g_callable_info_skip_return ()

gboolean
g_callable_info_skip_return (GICallableInfo *info);

See if a callable's return value is only useful in C.

Parameters

info

a GICallableInfo

 

Returns

TRUE if return value is only useful in C.


g_callable_info_create_closure ()

ffi_closure *
g_callable_info_create_closure (GICallableInfo *callable_info,
                                ffi_cif *cif,
                                GIFFIClosureCallback callback,
                                gpointer user_data);

Prepares a callback for ffi invocation.

Parameters

callable_info

a callable info from a typelib

 

cif

a ffi_cif structure

 

callback

the ffi callback

 

user_data

data to be passed into the callback

 

Returns

the ffi_closure or NULL on error. The return value should be freed by calling g_callable_info_destroy_closure().


g_callable_info_destroy_closure ()

void
g_callable_info_destroy_closure (GICallableInfo *callable_info,
                                 ffi_closure *closure);

Frees a ffi_closure returned from g_callable_info_create_closure()

Parameters

callable_info

a callable info from a typelib

 

closure

ffi closure

 

g_callable_info_get_closure_native_address ()

gpointer *
g_callable_info_get_closure_native_address
                               (GICallableInfo *callable_info,
                                ffi_closure *closure);

Gets callable code from ffi_closure prepared by g_callable_info_create_closure()

Parameters

callable_info

a callable info from a typelib

 

closure

ffi closure

 

Types and Values

GICallableInfo

typedef GIBaseInfo GICallableInfo;

Represents a callable, either GIFunctionInfo, GICallbackInfo or GIVFuncInfo.