GIUnionInfo

GIUnionInfo — Struct representing a union.

Functions

Types and Values

typedef GIUnionInfo

Description

GIUnionInfo represents a union type.

A union has methods and fields. Unions can optionally have a discriminator, which is a field deciding what type of real union fields is valid for specified instance.

Functions

g_union_info_get_n_fields ()

gint
g_union_info_get_n_fields (GIUnionInfo *info);

Obtain the number of fields this union has.

Parameters

info

a GIUnionInfo

 

Returns

number of fields


g_union_info_get_field ()

GIFieldInfo *
g_union_info_get_field (GIUnionInfo *info,
                        gint n);

Obtain the type information for field with specified index.

Parameters

info

a GIUnionInfo

 

n

a field index

 

Returns

the GIFieldInfo, free it with g_base_info_unref() when done.

[transfer full]


g_union_info_get_n_methods ()

gint
g_union_info_get_n_methods (GIUnionInfo *info);

Obtain the number of methods this union has.

Parameters

info

a GIUnionInfo

 

Returns

number of methods


g_union_info_get_method ()

GIFunctionInfo *
g_union_info_get_method (GIUnionInfo *info,
                         gint n);

Obtain the type information for method with specified index.

Parameters

info

a GIUnionInfo

 

n

a method index

 

Returns

the GIFunctionInfo, free it with g_base_info_unref() when done.

[transfer full]


g_union_info_is_discriminated ()

gboolean
g_union_info_is_discriminated (GIUnionInfo *info);

Return true if this union contains discriminator field.

Parameters

info

a GIUnionInfo

 

Returns

TRUE if this is a discriminated union, FALSE otherwise


g_union_info_get_discriminator_offset ()

gint
g_union_info_get_discriminator_offset (GIUnionInfo *info);

Returns offset of the discriminator field in the structure.

Parameters

info

a GIUnionInfo

 

Returns

offset in bytes of the discriminator


g_union_info_get_discriminator_type ()

GITypeInfo *
g_union_info_get_discriminator_type (GIUnionInfo *info);

Obtain the type information of the union discriminator.

Parameters

info

a GIUnionInfo

 

Returns

the GITypeInfo, free it with g_base_info_unref() when done.

[transfer full]


g_union_info_get_discriminator ()

GIConstantInfo *
g_union_info_get_discriminator (GIUnionInfo *info,
                                gint n);

Obtain discriminator value assigned for n-th union field, i.e. n-th union field is the active one if discriminator contains this constant.

Parameters

info

a GIUnionInfo

 

n

a union field index

 

Returns

the GIConstantInfo, free it with g_base_info_unref() when done.

[transfer full]


g_union_info_find_method ()

GIFunctionInfo *
g_union_info_find_method (GIUnionInfo *info,
                          const gchar *name);

Obtain the type information for method named name .

Parameters

info

a GIUnionInfo

 

name

a method name

 

Returns

the GIFunctionInfo, free it with g_base_info_unref() when done.

[transfer full]


g_union_info_get_size ()

gsize
g_union_info_get_size (GIUnionInfo *info);

Obtain the total size of the union.

Parameters

info

a GIUnionInfo

 

Returns

size of the union in bytes


g_union_info_get_alignment ()

gsize
g_union_info_get_alignment (GIUnionInfo *info);

Obtain the required alignment of the union.

Parameters

info

a GIUnionInfo

 

Returns

required alignment in bytes

Types and Values

GIUnionInfo

typedef GIBaseInfo GIUnionInfo;

Represents a union.