giconstantinfo: Port documentation to gi-docgen and update

Review and update the documentation, making sure it’s complete,
formatted in gi-docgen format, and has all appropriate GIR annotations
and `Since:` lines.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2023-12-13 00:26:56 +00:00
parent 553e7cb02d
commit 614da5b9e2
2 changed files with 27 additions and 19 deletions

View File

@ -34,26 +34,26 @@
#include "giconstantinfo.h" #include "giconstantinfo.h"
/** /**
* SECTION:giconstantinfo * GIConstantInfo:
* @title: GIConstantInfo
* @short_description: Struct representing a constant
* *
* GIConstantInfo represents a constant. * `GIConstantInfo` represents a constant.
* *
* A constant has a type associated which can be obtained by calling * A constant has a type associated which can be obtained by calling
* gi_constant_info_get_type_info() and a value, which can be obtained by * [method@GIRepository.ConstantInfo.get_type_info] and a value which can be
* calling gi_constant_info_get_value(). * obtained by calling [method@GIRepository.ConstantInfo.get_value].
*
* Since: 2.80
*/ */
/** /**
* gi_constant_info_get_type_info: * gi_constant_info_get_type_info:
* @info: a #GIConstantInfo * @info: a #GIConstantInfo
* *
* Obtain the type of the constant as a #GITypeInfo. * Obtain the type of the constant as a [class@GIRepository.TypeInfo].
* *
* Returns: (transfer full): the #GITypeInfo. Free the struct by calling * Returns: (transfer full): The [class@GIRepository.TypeInfo]. Free the struct
* gi_base_info_unref() when done. * by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GITypeInfo * GITypeInfo *
gi_constant_info_get_type_info (GIConstantInfo *info) gi_constant_info_get_type_info (GIConstantInfo *info)
@ -74,7 +74,7 @@ gi_constant_info_get_type_info (GIConstantInfo *info)
* @info: a #GIConstantInfo * @info: a #GIConstantInfo
* @value: the argument * @value: the argument
* *
* Free the value returned from gi_constant_info_get_value(). * Free the value returned from [method@GIRepository.ConstantInfo.get_value].
* *
* Since: 2.80 * Since: 2.80
*/ */
@ -101,14 +101,20 @@ gi_constant_info_free_value (GIConstantInfo *info,
/** /**
* gi_constant_info_get_value: (skip) * gi_constant_info_get_value: (skip)
* @info: a #GIConstantInfo * @info: a #GIConstantInfo
* @value: (out): an argument * @value: (out caller-allocates): an argument
* *
* Obtain the value associated with the #GIConstantInfo and store it in the * Obtain the value associated with the `GIConstantInfo` and store it in the
* @value parameter. @argument needs to be allocated before passing it in. * @value parameter.
* The size of the constant value stored in @argument will be returned. *
* Free the value with gi_constant_info_free_value(). * @argument needs to be allocated before passing it in.
*
* The size of the constant value (in bytes) stored in @argument will be
* returned.
*
* Free the value with [method@GIRepository.ConstantInfo.free_value].
* *
* Returns: size of the constant, in bytes * Returns: size of the constant, in bytes
* Since: 2.80
*/ */
gsize gsize
gi_constant_info_get_value (GIConstantInfo *info, gi_constant_info_get_value (GIConstantInfo *info,

View File

@ -33,10 +33,12 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/** /**
* GI_IS_CONSTANT_INFO * GI_IS_CONSTANT_INFO:
* @info: an info structure * @info: an info structure
* *
* Checks if @info is a #GIConstantInfo. * Checks if @info is a [class@GIRepository.ConstantInfo].
*
* Since: 2.80
*/ */
#define GI_IS_CONSTANT_INFO(info) \ #define GI_IS_CONSTANT_INFO(info) \
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CONSTANT) (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CONSTANT)