[girepository] Document GIStructInfo & GIUnionInfo

https://bugzilla.gnome.org/show_bug.cgi?id=628753
This commit is contained in:
Pavel Holejsovsky 2010-09-05 10:58:31 -03:00 committed by Johan Dahlin
parent 9a46475584
commit bc6a8d2f23
7 changed files with 221 additions and 11 deletions

View File

@ -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
* @value: (out): an argument
*

View File

@ -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
* @mem: pointer to a block of memory representing a C structure or union
* @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
* @mem: pointer to a block of memory representing a C structure or union
* @value: a #GIArgument holding the value to store

View File

@ -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
* @in_args: an array of #GIArgument<!-- -->s, one for each in
* parameter of @info. If there are no in parameter, @in_args

View File

@ -31,17 +31,17 @@
G_BEGIN_DECLS
/**
* GIObjectInfoRefFunction:
* GIObjectInfoRefFunction: (skip)
* @object: object instance pointer
*
* Increases the reference count of an object instance.
*
* Returns: the object instance
* Returns: (transfer full): the object instance
*/
typedef void * (*GIObjectInfoRefFunction) (void *object);
/**
* GIObjectInfoUnrefFunction:
* GIObjectInfoUnrefFunction: (skip)
* @object: object instance pointer
*
* Decreases the reference count of an object instance.
@ -50,7 +50,7 @@ typedef void * (*GIObjectInfoRefFunction) (void *object);
typedef void (*GIObjectInfoUnrefFunction) (void *object);
/**
* GIObjectInfoSetValueFunction:
* GIObjectInfoSetValueFunction: (skip)
* @value: a #GValue
* @object: object instance pointer
*
@ -60,12 +60,12 @@ typedef void (*GIObjectInfoUnrefFunction) (void *object);
typedef void (*GIObjectInfoSetValueFunction) (GValue *value, void *object);
/**
* GIObjectInfoGetValueFunction:
* GIObjectInfoGetValueFunction: (skip)
* @value: a #GValue
*
* Extract an object instance out of @value
*
* Returns: the object instance
* Returns: (transfer full): the object instance
*/
typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);

View File

@ -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
* by the dumper and for programs that wants to provide

View File

@ -25,6 +25,33 @@
#include "girepository-private.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
g_struct_info_get_n_fields (GIStructInfo *info)
{
@ -34,6 +61,15 @@ g_struct_info_get_n_fields (GIStructInfo *info)
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
g_struct_get_field_offset (GIStructInfo *info,
gint n)
@ -55,6 +91,16 @@ g_struct_get_field_offset (GIStructInfo *info,
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 *
g_struct_info_get_field (GIStructInfo *info,
gint n)
@ -65,6 +111,14 @@ g_struct_info_get_field (GIStructInfo *info,
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
g_struct_info_get_n_methods (GIStructInfo *info)
{
@ -74,6 +128,16 @@ g_struct_info_get_n_methods (GIStructInfo *info)
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 *
g_struct_info_get_method (GIStructInfo *info,
gint n)
@ -88,6 +152,16 @@ g_struct_info_get_method (GIStructInfo *info,
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 *
g_struct_info_find_method (GIStructInfo *info,
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);
}
/**
* g_struct_info_get_size:
* @info: a #GIStructInfo
*
* Obtain the total size of the structure.
*
* Returns: size of the structure in bytes
*/
gsize
g_struct_info_get_size (GIStructInfo *info)
{
@ -112,6 +194,14 @@ g_struct_info_get_size (GIStructInfo *info)
return blob->size;
}
/**
* g_struct_info_get_alignment:
* @info: a #GIStructInfo
*
* Obtain the required alignment of the structure.
*
* Returns: required alignment in bytes
*/
gsize
g_struct_info_get_alignment (GIStructInfo *info)
{

View File

@ -25,6 +25,35 @@
#include "girepository-private.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
g_union_info_get_n_fields (GIUnionInfo *info)
{
@ -34,6 +63,16 @@ g_union_info_get_n_fields (GIUnionInfo *info)
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 *
g_union_info_get_field (GIUnionInfo *info,
gint n)
@ -46,6 +85,14 @@ g_union_info_get_field (GIUnionInfo *info,
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
g_union_info_get_n_methods (GIUnionInfo *info)
{
@ -55,6 +102,16 @@ g_union_info_get_n_methods (GIUnionInfo *info)
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 *
g_union_info_get_method (GIUnionInfo *info,
gint n)
@ -71,6 +128,14 @@ g_union_info_get_method (GIUnionInfo *info,
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
g_union_info_is_discriminated (GIUnionInfo *info)
{
@ -80,6 +145,14 @@ g_union_info_is_discriminated (GIUnionInfo *info)
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
g_union_info_get_discriminator_offset (GIUnionInfo *info)
{
@ -89,6 +162,15 @@ g_union_info_get_discriminator_offset (GIUnionInfo *info)
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 *
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);
}
/**
* 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 *
g_union_info_get_discriminator (GIUnionInfo *info,
gint n)
@ -121,6 +215,16 @@ g_union_info_get_discriminator (GIUnionInfo *info,
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 *
g_union_info_find_method (GIUnionInfo *info,
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);
}
/**
* g_union_info_get_size:
* @info: a #GIUnionInfo
*
* Obtain the total size of the union.
*
* Returns: size of the union in bytes
*/
gsize
g_union_info_get_size (GIUnionInfo *info)
{
@ -145,6 +257,14 @@ g_union_info_get_size (GIUnionInfo *info)
return blob->size;
}
/**
* g_union_info_get_alignment:
* @info: a #GIUnionInfo
*
* Obtain the required alignment of the union.
*
* Returns: required alignment in bytes
*/
gsize
g_union_info_get_alignment (GIUnionInfo *info)
{