mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 21:33:09 +02:00
[girepository] Document GIStructInfo & GIUnionInfo
https://bugzilla.gnome.org/show_bug.cgi?id=628753
This commit is contained in:
parent
9a46475584
commit
bc6a8d2f23
@ -65,7 +65,7 @@ g_constant_info_get_type (GIConstantInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_constant_info_get_value:
|
* g_constant_info_get_value: (skip)
|
||||||
* @info: a #GIConstantInfo
|
* @info: a #GIConstantInfo
|
||||||
* @value: (out): an argument
|
* @value: (out): an argument
|
||||||
*
|
*
|
||||||
|
@ -161,7 +161,7 @@ g_field_info_get_type (GIFieldInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_field_info_get_field:
|
* g_field_info_get_field: (skip)
|
||||||
* @field_info: a #GIFieldInfo
|
* @field_info: a #GIFieldInfo
|
||||||
* @mem: pointer to a block of memory representing a C structure or union
|
* @mem: pointer to a block of memory representing a C structure or union
|
||||||
* @value: a #GIArgument into which to store the value retrieved
|
* @value: a #GIArgument into which to store the value retrieved
|
||||||
@ -343,7 +343,7 @@ g_field_info_get_field (GIFieldInfo *field_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_field_info_set_field:
|
* g_field_info_set_field: (skip)
|
||||||
* @field_info: a #GIFieldInfo
|
* @field_info: a #GIFieldInfo
|
||||||
* @mem: pointer to a block of memory representing a C structure or union
|
* @mem: pointer to a block of memory representing a C structure or union
|
||||||
* @value: a #GIArgument holding the value to store
|
* @value: a #GIArgument holding the value to store
|
||||||
|
@ -215,7 +215,7 @@ g_invoke_error_quark (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_function_info_invoke:
|
* g_function_info_invoke: (skip)
|
||||||
* @info: a #GIFunctionInfo describing the function to invoke
|
* @info: a #GIFunctionInfo describing the function to invoke
|
||||||
* @in_args: an array of #GIArgument<!-- -->s, one for each in
|
* @in_args: an array of #GIArgument<!-- -->s, one for each in
|
||||||
* parameter of @info. If there are no in parameter, @in_args
|
* parameter of @info. If there are no in parameter, @in_args
|
||||||
|
@ -31,17 +31,17 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GIObjectInfoRefFunction:
|
* GIObjectInfoRefFunction: (skip)
|
||||||
* @object: object instance pointer
|
* @object: object instance pointer
|
||||||
*
|
*
|
||||||
* Increases the reference count of an object instance.
|
* Increases the reference count of an object instance.
|
||||||
*
|
*
|
||||||
* Returns: the object instance
|
* Returns: (transfer full): the object instance
|
||||||
*/
|
*/
|
||||||
typedef void * (*GIObjectInfoRefFunction) (void *object);
|
typedef void * (*GIObjectInfoRefFunction) (void *object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GIObjectInfoUnrefFunction:
|
* GIObjectInfoUnrefFunction: (skip)
|
||||||
* @object: object instance pointer
|
* @object: object instance pointer
|
||||||
*
|
*
|
||||||
* Decreases the reference count of an object instance.
|
* Decreases the reference count of an object instance.
|
||||||
@ -50,7 +50,7 @@ typedef void * (*GIObjectInfoRefFunction) (void *object);
|
|||||||
typedef void (*GIObjectInfoUnrefFunction) (void *object);
|
typedef void (*GIObjectInfoUnrefFunction) (void *object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GIObjectInfoSetValueFunction:
|
* GIObjectInfoSetValueFunction: (skip)
|
||||||
* @value: a #GValue
|
* @value: a #GValue
|
||||||
* @object: object instance pointer
|
* @object: object instance pointer
|
||||||
*
|
*
|
||||||
@ -60,12 +60,12 @@ typedef void (*GIObjectInfoUnrefFunction) (void *object);
|
|||||||
typedef void (*GIObjectInfoSetValueFunction) (GValue *value, void *object);
|
typedef void (*GIObjectInfoSetValueFunction) (GValue *value, void *object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GIObjectInfoGetValueFunction:
|
* GIObjectInfoGetValueFunction: (skip)
|
||||||
* @value: a #GValue
|
* @value: a #GValue
|
||||||
*
|
*
|
||||||
* Extract an object instance out of @value
|
* Extract an object instance out of @value
|
||||||
*
|
*
|
||||||
* Returns: the object instance
|
* Returns: (transfer full): the object instance
|
||||||
*/
|
*/
|
||||||
typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
|
typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
|
||||||
|
|
||||||
|
@ -1413,7 +1413,7 @@ static const GOptionEntry introspection_args[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_irepository_get_option_group:
|
* g_irepository_get_option_group: (skip)
|
||||||
*
|
*
|
||||||
* Obtain the option group for girepository, it's used
|
* Obtain the option group for girepository, it's used
|
||||||
* by the dumper and for programs that wants to provide
|
* by the dumper and for programs that wants to provide
|
||||||
|
@ -25,6 +25,33 @@
|
|||||||
#include "girepository-private.h"
|
#include "girepository-private.h"
|
||||||
#include "gitypelib-internal.h"
|
#include "gitypelib-internal.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:gistructinfo
|
||||||
|
* @Short_description: Struct representing a C structure
|
||||||
|
* @Title: GIStructInfo
|
||||||
|
*
|
||||||
|
* GIStructInfo represents a generic C structure type.
|
||||||
|
*
|
||||||
|
* A structure has methods and fields.
|
||||||
|
*
|
||||||
|
* <refsect1 id="gi-giobjectinfo.struct-hierarchy" role="struct_hierarchy">
|
||||||
|
* <title role="struct_hierarchy.title">Struct hierarchy</title>
|
||||||
|
* <synopsis>
|
||||||
|
* <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
|
||||||
|
* +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link>
|
||||||
|
* +----GIStructInfo
|
||||||
|
* </synopsis>
|
||||||
|
* </refsect1>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_n_fields:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
*
|
||||||
|
* Obtain the number of fields this structure has.
|
||||||
|
*
|
||||||
|
* Returns: number of fields
|
||||||
|
*/
|
||||||
gint
|
gint
|
||||||
g_struct_info_get_n_fields (GIStructInfo *info)
|
g_struct_info_get_n_fields (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
@ -34,6 +61,15 @@ g_struct_info_get_n_fields (GIStructInfo *info)
|
|||||||
return blob->n_fields;
|
return blob->n_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_field_offset:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
* @n: index of queried field
|
||||||
|
*
|
||||||
|
* Obtain the offset of the specified field.
|
||||||
|
*
|
||||||
|
* Returns: field offset in bytes
|
||||||
|
*/
|
||||||
static gint32
|
static gint32
|
||||||
g_struct_get_field_offset (GIStructInfo *info,
|
g_struct_get_field_offset (GIStructInfo *info,
|
||||||
gint n)
|
gint n)
|
||||||
@ -55,6 +91,16 @@ g_struct_get_field_offset (GIStructInfo *info,
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_field:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
* @n: a field index
|
||||||
|
*
|
||||||
|
* Obtain the type information for field with specified index.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIFieldInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIFieldInfo *
|
GIFieldInfo *
|
||||||
g_struct_info_get_field (GIStructInfo *info,
|
g_struct_info_get_field (GIStructInfo *info,
|
||||||
gint n)
|
gint n)
|
||||||
@ -65,6 +111,14 @@ g_struct_info_get_field (GIStructInfo *info,
|
|||||||
g_struct_get_field_offset (info, n));
|
g_struct_get_field_offset (info, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_n_methods:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
*
|
||||||
|
* Obtain the number of methods this structure has.
|
||||||
|
*
|
||||||
|
* Returns: number of methods
|
||||||
|
*/
|
||||||
gint
|
gint
|
||||||
g_struct_info_get_n_methods (GIStructInfo *info)
|
g_struct_info_get_n_methods (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
@ -74,6 +128,16 @@ g_struct_info_get_n_methods (GIStructInfo *info)
|
|||||||
return blob->n_methods;
|
return blob->n_methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_method:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
* @n: a method index
|
||||||
|
*
|
||||||
|
* Obtain the type information for method with specified index.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIFunctionInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
g_struct_info_get_method (GIStructInfo *info,
|
g_struct_info_get_method (GIStructInfo *info,
|
||||||
gint n)
|
gint n)
|
||||||
@ -88,6 +152,16 @@ g_struct_info_get_method (GIStructInfo *info,
|
|||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_find_method:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
* @name: a method name
|
||||||
|
*
|
||||||
|
* Obtain the type information for method named @name.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIFunctionInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
g_struct_info_find_method (GIStructInfo *info,
|
g_struct_info_find_method (GIStructInfo *info,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
@ -103,6 +177,14 @@ g_struct_info_find_method (GIStructInfo *info,
|
|||||||
return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
|
return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_size:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
*
|
||||||
|
* Obtain the total size of the structure.
|
||||||
|
*
|
||||||
|
* Returns: size of the structure in bytes
|
||||||
|
*/
|
||||||
gsize
|
gsize
|
||||||
g_struct_info_get_size (GIStructInfo *info)
|
g_struct_info_get_size (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
@ -112,6 +194,14 @@ g_struct_info_get_size (GIStructInfo *info)
|
|||||||
return blob->size;
|
return blob->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_struct_info_get_alignment:
|
||||||
|
* @info: a #GIStructInfo
|
||||||
|
*
|
||||||
|
* Obtain the required alignment of the structure.
|
||||||
|
*
|
||||||
|
* Returns: required alignment in bytes
|
||||||
|
*/
|
||||||
gsize
|
gsize
|
||||||
g_struct_info_get_alignment (GIStructInfo *info)
|
g_struct_info_get_alignment (GIStructInfo *info)
|
||||||
{
|
{
|
||||||
|
120
giunioninfo.c
120
giunioninfo.c
@ -25,6 +25,35 @@
|
|||||||
#include "girepository-private.h"
|
#include "girepository-private.h"
|
||||||
#include "gitypelib-internal.h"
|
#include "gitypelib-internal.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:giunioninfo
|
||||||
|
* @Short_description: Struct representing a union.
|
||||||
|
* @Title: GIUnionInfo
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* <refsect1 id="gi-giobjectinfo.struct-hierarchy" role="struct_hierarchy">
|
||||||
|
* <title role="struct_hierarchy.title">Struct hierarchy</title>
|
||||||
|
* <synopsis>
|
||||||
|
* <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
|
||||||
|
* +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link>
|
||||||
|
* +----GIUnionInfo
|
||||||
|
* </synopsis>
|
||||||
|
* </refsect1>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_n_fields:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Obtain the number of fields this union has.
|
||||||
|
*
|
||||||
|
* Returns: number of fields
|
||||||
|
*/
|
||||||
gint
|
gint
|
||||||
g_union_info_get_n_fields (GIUnionInfo *info)
|
g_union_info_get_n_fields (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
@ -34,6 +63,16 @@ g_union_info_get_n_fields (GIUnionInfo *info)
|
|||||||
return blob->n_fields;
|
return blob->n_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_field:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
* @n: a field index
|
||||||
|
*
|
||||||
|
* Obtain the type information for field with specified index.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIFieldInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIFieldInfo *
|
GIFieldInfo *
|
||||||
g_union_info_get_field (GIUnionInfo *info,
|
g_union_info_get_field (GIUnionInfo *info,
|
||||||
gint n)
|
gint n)
|
||||||
@ -46,6 +85,14 @@ g_union_info_get_field (GIUnionInfo *info,
|
|||||||
n * header->field_blob_size);
|
n * header->field_blob_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_n_methods:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Obtain the number of methods this union has.
|
||||||
|
*
|
||||||
|
* Returns: number of methods
|
||||||
|
*/
|
||||||
gint
|
gint
|
||||||
g_union_info_get_n_methods (GIUnionInfo *info)
|
g_union_info_get_n_methods (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
@ -55,6 +102,16 @@ g_union_info_get_n_methods (GIUnionInfo *info)
|
|||||||
return blob->n_functions;
|
return blob->n_functions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_method:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
* @n: a method index
|
||||||
|
*
|
||||||
|
* Obtain the type information for method with specified index.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIFunctionInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
g_union_info_get_method (GIUnionInfo *info,
|
g_union_info_get_method (GIUnionInfo *info,
|
||||||
gint n)
|
gint n)
|
||||||
@ -71,6 +128,14 @@ g_union_info_get_method (GIUnionInfo *info,
|
|||||||
rinfo->typelib, offset);
|
rinfo->typelib, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_is_discriminated:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Return true if this union contains discriminator field.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if this is a discriminated union, %FALSE otherwise
|
||||||
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
g_union_info_is_discriminated (GIUnionInfo *info)
|
g_union_info_is_discriminated (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
@ -80,6 +145,14 @@ g_union_info_is_discriminated (GIUnionInfo *info)
|
|||||||
return blob->discriminated;
|
return blob->discriminated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_discrimintor_offset:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Returns offset of the discriminator field in the structure.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): offset in bytes of the discriminator
|
||||||
|
*/
|
||||||
gint
|
gint
|
||||||
g_union_info_get_discriminator_offset (GIUnionInfo *info)
|
g_union_info_get_discriminator_offset (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
@ -89,6 +162,15 @@ g_union_info_get_discriminator_offset (GIUnionInfo *info)
|
|||||||
return blob->discriminator_offset;
|
return blob->discriminator_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_discriminator_type:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Obtain the type information of the union discriminator.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GITypeInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GITypeInfo *
|
GITypeInfo *
|
||||||
g_union_info_get_discriminator_type (GIUnionInfo *info)
|
g_union_info_get_discriminator_type (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
@ -97,6 +179,18 @@ g_union_info_get_discriminator_type (GIUnionInfo *info)
|
|||||||
return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
|
return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_discriminator:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
* @n: a union field index
|
||||||
|
*
|
||||||
|
* Obtain discriminator value assigned for n-th union field, i.e. n-th
|
||||||
|
* union field is the active one if discriminator contains this
|
||||||
|
* constant.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIConstantInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIConstantInfo *
|
GIConstantInfo *
|
||||||
g_union_info_get_discriminator (GIUnionInfo *info,
|
g_union_info_get_discriminator (GIUnionInfo *info,
|
||||||
gint n)
|
gint n)
|
||||||
@ -121,6 +215,16 @@ g_union_info_get_discriminator (GIUnionInfo *info,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_find_method:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
* @name: a method name
|
||||||
|
*
|
||||||
|
* Obtain the type information for method named @name.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): the #GIFunctionInfo, free it with g_base_info_unref()
|
||||||
|
* when done.
|
||||||
|
*/
|
||||||
GIFunctionInfo *
|
GIFunctionInfo *
|
||||||
g_union_info_find_method (GIUnionInfo *info,
|
g_union_info_find_method (GIUnionInfo *info,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
@ -136,6 +240,14 @@ g_union_info_find_method (GIUnionInfo *info,
|
|||||||
return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_functions, name);
|
return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_functions, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_size:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Obtain the total size of the union.
|
||||||
|
*
|
||||||
|
* Returns: size of the union in bytes
|
||||||
|
*/
|
||||||
gsize
|
gsize
|
||||||
g_union_info_get_size (GIUnionInfo *info)
|
g_union_info_get_size (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
@ -145,6 +257,14 @@ g_union_info_get_size (GIUnionInfo *info)
|
|||||||
return blob->size;
|
return blob->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_union_info_get_alignment:
|
||||||
|
* @info: a #GIUnionInfo
|
||||||
|
*
|
||||||
|
* Obtain the required alignment of the union.
|
||||||
|
*
|
||||||
|
* Returns: required alignment in bytes
|
||||||
|
*/
|
||||||
gsize
|
gsize
|
||||||
g_union_info_get_alignment (GIUnionInfo *info)
|
g_union_info_get_alignment (GIUnionInfo *info)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user