gifieldinfo: Port from gtk-doc to gi-docgen

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2023-11-28 17:27:34 +00:00
parent 52ac467426
commit f5d13c9cf8
2 changed files with 47 additions and 34 deletions

View File

@ -34,29 +34,33 @@
#include "gifieldinfo.h" #include "gifieldinfo.h"
/** /**
* SECTION:gifieldinfo * GIFieldInfo:
* @title: GIFieldInfo
* @short_description: Struct representing a struct or union field
* *
* A GIFieldInfo struct represents a field of a struct, union, or object. * A `GIFieldInfo` struct represents a field of a struct, union, or object.
* *
* The GIFieldInfo is fetched by calling gi_struct_info_get_field(), * The `GIFieldInfo` is fetched by calling
* gi_union_info_get_field() or gi_object_info_get_field(). * [method@GIRepository.StructInfo.get_field],
* [method@GIRepository.UnionInfo.get_field] or
* [method@GIRepository.ObjectInfo.get_field].
* *
* A field has a size, type and a struct offset asssociated and a set of flags, * A field has a size, type and a struct offset associated and a set of flags,
* which are currently #GI_FIELD_IS_READABLE or #GI_FIELD_IS_WRITABLE. * which are currently `GI_FIELD_IS_READABLE` or `GI_FIELD_IS_WRITABLE`.
* *
* See also: #GIStructInfo, #GIUnionInfo, #GIObjectInfo * See also: [type@GIRepository.StructInfo], [type@GIRepository.UnionInfo],
* [type@GIRepository.ObjectInfo]
*
* Since: 2.80
*/ */
/** /**
* gi_field_info_get_flags: * gi_field_info_get_flags:
* @info: a #GIFieldInfo * @info: a #GIFieldInfo
* *
* Obtain the flags for this #GIFieldInfo. See #GIFieldInfoFlags for possible * Obtain the flags for this `GIFieldInfo`. See
* flag values. * [flags@GIRepository.FieldInfoFlags] for possible flag values.
* *
* Returns: the flags * Returns: the flags
* Since: 2.80
*/ */
GIFieldInfoFlags GIFieldInfoFlags
gi_field_info_get_flags (GIFieldInfo *info) gi_field_info_get_flags (GIFieldInfo *info)
@ -85,10 +89,11 @@ gi_field_info_get_flags (GIFieldInfo *info)
* gi_field_info_get_size: * gi_field_info_get_size:
* @info: a #GIFieldInfo * @info: a #GIFieldInfo
* *
* Obtain the size in bits of the field member, this is how * Obtain the size of the field member, in bits. This is how
* much space you need to allocate to store the field. * much space you need to allocate to store the field.
* *
* Returns: the field size * Returns: the field size, in bits
* Since: 2.80
*/ */
gint gint
gi_field_info_get_size (GIFieldInfo *info) gi_field_info_get_size (GIFieldInfo *info)
@ -108,10 +113,11 @@ gi_field_info_get_size (GIFieldInfo *info)
* gi_field_info_get_offset: * gi_field_info_get_offset:
* @info: a #GIFieldInfo * @info: a #GIFieldInfo
* *
* Obtain the offset in bytes of the field member, this is relative * Obtain the offset of the field member, in bytes. This is relative
* to the beginning of the struct or union. * to the beginning of the struct or union.
* *
* Returns: the field offset * Returns: the field offset, in bytes
* Since: 2.80
*/ */
gint gint
gi_field_info_get_offset (GIFieldInfo *info) gi_field_info_get_offset (GIFieldInfo *info)
@ -131,10 +137,10 @@ gi_field_info_get_offset (GIFieldInfo *info)
* gi_field_info_get_type_info: * gi_field_info_get_type_info:
* @info: a #GIFieldInfo * @info: a #GIFieldInfo
* *
* Obtain the type of a field as a #GITypeInfo. * Obtain the type of a field as a [type@GIRepository.TypeInfo].
* *
* Returns: (transfer full): the #GITypeInfo. Free the struct by calling * Returns: (transfer full): the [type@GIRepository.TypeInfo]. Free the struct
* gi_base_info_unref() when done. * by calling [method@GIRepository.BaseInfo.unref] when done.
*/ */
GITypeInfo * GITypeInfo *
gi_field_info_get_type_info (GIFieldInfo *info) gi_field_info_get_type_info (GIFieldInfo *info)
@ -166,14 +172,17 @@ gi_field_info_get_type_info (GIFieldInfo *info)
* gi_field_info_get_field: (skip) * gi_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 [type@GIRepository.Argument] into which to store the value retrieved
* *
* Reads a field identified by a #GIFieldInfo from a C structure or * Reads a field identified by a `GIFieldInfo` from a C structure or
* union. This only handles fields of simple C types. It will fail * union.
* for a field of a composite type like a nested structure or union
* even if that is actually readable.
* *
* Returns: %TRUE if reading the field succeeded, otherwise %FALSE * This only handles fields of simple C types. It will fail for a field of a
* composite type like a nested structure or union even if that is actually
* readable.
*
* Returns: true if reading the field succeeded, false otherwise
* Since: 2.80
*/ */
gboolean gboolean
gi_field_info_get_field (GIFieldInfo *field_info, gi_field_info_get_field (GIFieldInfo *field_info,
@ -358,16 +367,19 @@ gi_field_info_get_field (GIFieldInfo *field_info,
* gi_field_info_set_field: (skip) * gi_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 [type@GIRepository.Argument] holding the value to store
* *
* Writes a field identified by a #GIFieldInfo to a C structure or * Writes a field identified by a `GIFieldInfo` to a C structure or
* union. This only handles fields of simple C types. It will fail * union.
* for a field of a composite type like a nested structure or union
* even if that is actually writable. Note also that that it will refuse
* to write fields where memory management would by required. A field
* with a type such as 'char *' must be set with a setter function.
* *
* Returns: %TRUE if writing the field succeeded, otherwise %FALSE * This only handles fields of simple C types. It will fail for a field of a
* composite type like a nested structure or union even if that is actually
* writable. Note also that that it will refuse to write fields where memory
* management would by required. A field with a type such as `char *` must be
* set with a setter function.
*
* Returns: true if writing the field succeeded, false otherwise
* Since: 2.80
*/ */
gboolean gboolean
gi_field_info_set_field (GIFieldInfo *field_info, gi_field_info_set_field (GIFieldInfo *field_info,

View File

@ -33,11 +33,12 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/** /**
* GI_IS_FIELD_INFO * GI_IS_FIELD_INFO:
* @info: an info structure * @info: an info structure
* *
* Checks if @info is a #GIFieldInfo. * Checks if @info is a [class@GIRepository.FieldInfo].
* *
* Since: 2.80
*/ */
#define GI_IS_FIELD_INFO(info) \ #define GI_IS_FIELD_INFO(info) \
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FIELD) (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FIELD)