GIArgInfo

GIArgInfo — Struct representing an argument

Types and Values

typedef GIArgInfo
enum GIDirection
enum GIScopeType
enum GITransfer

Description

GIArgInfo represents an argument. An argument is always part of a GICallableInfo.

Struct hierarchy

  GIBaseInfo
   +----GIArgInfo

Functions

GI_IS_ARG_INFO()

#define             GI_IS_ARG_INFO(info)

Checks if info is a GIArgInfo.

Parameters

info

an info structure

 

g_arg_info_get_closure ()

gint
g_arg_info_get_closure (GIArgInfo *info);

Obtain the index of the user data argument. This is only valid for arguments which are callbacks.

Parameters

info

a GIArgInfo

 

Returns

index of the user data argument or -1 if there is none


g_arg_info_get_destroy ()

gint
g_arg_info_get_destroy (GIArgInfo *info);

Obtains the index of the GDestroyNotify argument. This is only valid for arguments which are callbacks.

Parameters

info

a GIArgInfo

 

Returns

index of the GDestroyNotify argument or -1 if there is none


g_arg_info_get_direction ()

GIDirection
g_arg_info_get_direction (GIArgInfo *info);

Obtain the direction of the argument. Check GIDirection for possible direction values.

Parameters

info

a GIArgInfo

 

Returns

the direction


g_arg_info_get_ownership_transfer ()

GITransfer
g_arg_info_get_ownership_transfer (GIArgInfo *info);

Obtain the ownership transfer for this argument. GITransfer contains a list of possible values.

Parameters

info

a GIArgInfo

 

Returns

the transfer


g_arg_info_get_scope ()

GIScopeType
g_arg_info_get_scope (GIArgInfo *info);

Obtain the scope type for this argument. The scope type explains how a callback is going to be invoked, most importantly when the resources required to invoke it can be freed. GIScopeType contains a list of possible values.

Parameters

info

a GIArgInfo

 

Returns

the scope type


g_arg_info_get_type ()

GITypeInfo *
g_arg_info_get_type (GIArgInfo *info);

Obtain the type information for info .

Parameters

info

a GIArgInfo

 

Returns

the GITypeInfo holding the type information for info , free it with g_base_info_unref() when done.

[transfer full]


g_arg_info_load_type ()

void
g_arg_info_load_type (GIArgInfo *info,
                      GITypeInfo *type);

Obtain information about a the type of given argument info ; this function is a variant of g_arg_info_get_type() designed for stack allocation.

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

Parameters

info

a GIArgInfo

 

type

Initialized with information about type of info .

[out caller-allocates]

g_arg_info_may_be_null ()

gboolean
g_arg_info_may_be_null (GIArgInfo *info);

Obtain if the type of the argument includes the possibility of NULL. For 'in' values this means that NULL is a valid value. For 'out' values, this means that NULL may be returned.

See also g_arg_info_is_optional().

Parameters

info

a GIArgInfo

 

Returns

TRUE if the value may be NULL


g_arg_info_is_caller_allocates ()

gboolean
g_arg_info_is_caller_allocates (GIArgInfo *info);

Obtain if the argument is a pointer to a struct or object that will receive an output of a function. The default assumption for GI_DIRECTION_OUT arguments which have allocation is that the callee allocates; if this is TRUE, then the caller must allocate.

Parameters

info

a GIArgInfo

 

Returns

TRUE if caller is required to have allocated the argument


g_arg_info_is_optional ()

gboolean
g_arg_info_is_optional (GIArgInfo *info);

Obtain if the argument is optional. For 'out' arguments this means that you can pass NULL in order to ignore the result.

Parameters

info

a GIArgInfo

 

Returns

TRUE if it is an optional argument


g_arg_info_is_return_value ()

gboolean
g_arg_info_is_return_value (GIArgInfo *info);

Obtain if the argument is a return value. It can either be a parameter or a return value.

Parameters

info

a GIArgInfo

 

Returns

TRUE if it is a return value


g_arg_info_is_skip ()

gboolean
g_arg_info_is_skip (GIArgInfo *info);

Obtain if an argument is only useful in C.

Parameters

info

a GIArgInfo

 

Returns

TRUE if argument is only useful in C.

Since: 1.30

Types and Values

GIArgInfo

typedef GIBaseInfo GIArgInfo;

Represents an argument.


enum GIDirection

The direction of a GIArgInfo.

Members

GI_DIRECTION_IN

in argument.

 

GI_DIRECTION_OUT

out argument.

 

GI_DIRECTION_INOUT

in and out argument.

 

enum GIScopeType

Scope type of a GIArgInfo representing callback, determines how the callback is invoked and is used to decided when the invoke structs can be freed.

Members

GI_SCOPE_TYPE_INVALID

The argument is not of callback type.

 

GI_SCOPE_TYPE_CALL

The callback and associated user_data is only used during the call to this function.

 

GI_SCOPE_TYPE_ASYNC

The callback and associated user_data is only used until the callback is invoked, and the callback. is invoked always exactly once.

 

GI_SCOPE_TYPE_NOTIFIED

The callback and and associated user_data is used until the caller is notfied via the destroy_notify.

 

enum GITransfer

The transfer is the exchange of data between two parts, from the callee to the caller. The callee is either a function/method/signal or an object/interface where a property is defined. The caller is the side accessing a property or calling a function. GITransfer specifies who's responsible for freeing the resources after the ownership transfer is complete. In case of a containing type such as a list, an array or a hash table the container itself is specified differently from the items within the container itself. Each container is freed differently, check the documentation for the types themselves for information on how to free them.

Members

GI_TRANSFER_NOTHING

transfer nothing from the callee (function or the type instance the property belongs to) to the caller. The callee retains the ownership of the transfer and the caller doesn't need to do anything to free up the resources of this transfer.

 

GI_TRANSFER_CONTAINER

transfer the container (list, array, hash table) from the callee to the caller. The callee retains the ownership of the individual items in the container and the caller has to free up the container resources (g_list_free()/g_hash_table_destroy() etc) of this transfer.

 

GI_TRANSFER_EVERYTHING

transfer everything, eg the container and its contents from the callee to the caller. This is the case when the callee creates a copy of all the data it returns. The caller is responsible for cleaning up the container and item resources of this transfer.