giinterfaceinfo: 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:27:40 +00:00
parent 99a9276594
commit 2ebaa439e5
2 changed files with 66 additions and 39 deletions

View File

@ -33,14 +33,14 @@
#include "giinterfaceinfo.h" #include "giinterfaceinfo.h"
/** /**
* SECTION:giinterfaceinfo * GIInterfaceInfo:
* @title: GIInterfaceInfo
* @short_description: Struct representing a GInterface
* *
* GIInterfaceInfo represents a #GInterface type. * `GIInterfaceInfo` represents a `GInterface` type.
* *
* A GInterface has methods, fields, properties, signals, interfaces, constants, * A `GInterface` has methods, fields, properties, signals,
* virtual functions and prerequisites. * interfaces, constants, virtual functions and prerequisites.
*
* Since: 2.80
*/ */
/** /**
@ -48,10 +48,12 @@
* @info: a #GIInterfaceInfo * @info: a #GIInterfaceInfo
* *
* Obtain the number of prerequisites for this interface type. * Obtain the number of prerequisites for this interface type.
* A prerequisites is another interface that needs to be implemented for *
* interface, similar to an base class for GObjects. * A prerequisite is another interface that needs to be implemented for
* interface, similar to a base class for [class@GObject.Object]s.
* *
* Returns: number of prerequisites * Returns: number of prerequisites
* Since: 2.80
*/ */
guint guint
gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info) gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
@ -70,12 +72,13 @@ gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
/** /**
* gi_interface_info_get_prerequisite: * gi_interface_info_get_prerequisite:
* @info: a #GIInterfaceInfo * @info: a #GIInterfaceInfo
* @n: index of prerequisites to get * @n: index of prerequisite to get
* *
* Obtain an interface type prerequisites index @n. * Obtain an interface types prerequisite at index @n.
* *
* Returns: (transfer full): the prerequisites as a #GIBaseInfo. Free the struct by calling * Returns: (transfer full): The prerequisite as a [class@GIRepository.BaseInfo].
* gi_base_info_unref() when done. * Free the struct by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GIBaseInfo * GIBaseInfo *
gi_interface_info_get_prerequisite (GIInterfaceInfo *info, gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
@ -101,6 +104,7 @@ gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
* Obtain the number of properties that this interface type has. * Obtain the number of properties that this interface type has.
* *
* Returns: number of properties * Returns: number of properties
* Since: 2.80
*/ */
guint guint
gi_interface_info_get_n_properties (GIInterfaceInfo *info) gi_interface_info_get_n_properties (GIInterfaceInfo *info)
@ -123,8 +127,9 @@ gi_interface_info_get_n_properties (GIInterfaceInfo *info)
* *
* Obtain an interface type property at index @n. * Obtain an interface type property at index @n.
* *
* Returns: (transfer full): the #GIPropertyInfo. Free the struct by calling * Returns: (transfer full): The [class@GIRepository.PropertyInfo]. Free the
* gi_base_info_unref() when done. * struct by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GIPropertyInfo * GIPropertyInfo *
gi_interface_info_get_property (GIInterfaceInfo *info, gi_interface_info_get_property (GIInterfaceInfo *info,
@ -156,6 +161,7 @@ gi_interface_info_get_property (GIInterfaceInfo *info,
* Obtain the number of methods that this interface type has. * Obtain the number of methods that this interface type has.
* *
* Returns: number of methods * Returns: number of methods
* Since: 2.80
*/ */
guint guint
gi_interface_info_get_n_methods (GIInterfaceInfo *info) gi_interface_info_get_n_methods (GIInterfaceInfo *info)
@ -178,8 +184,9 @@ gi_interface_info_get_n_methods (GIInterfaceInfo *info)
* *
* Obtain an interface type method at index @n. * Obtain an interface type method at index @n.
* *
* Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling * Returns: (transfer full): The [class@GIRepository.FunctionInfo]. Free the
* gi_base_info_unref() when done. * struct by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GIFunctionInfo * GIFunctionInfo *
gi_interface_info_get_method (GIInterfaceInfo *info, gi_interface_info_get_method (GIInterfaceInfo *info,
@ -210,11 +217,14 @@ gi_interface_info_get_method (GIInterfaceInfo *info,
* @info: a #GIInterfaceInfo * @info: a #GIInterfaceInfo
* @name: name of method to obtain * @name: name of method to obtain
* *
* Obtain a method of the interface type given a @name. %NULL will be * Obtain a method of the interface type given a @name.
* returned if there's no method available with that name.
* *
* Returns: (transfer full): the #GIFunctionInfo or %NULL if none found. * `NULL` will be returned if theres no method available with that name.
* Free the struct by calling gi_base_info_unref() when done. *
* Returns: (transfer full) (nullable): The [class@GIRepository.FunctionInfo] or
* `NULL` if none found. Free the struct by calling
* [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GIFunctionInfo * GIFunctionInfo *
gi_interface_info_find_method (GIInterfaceInfo *info, gi_interface_info_find_method (GIInterfaceInfo *info,
@ -239,6 +249,7 @@ gi_interface_info_find_method (GIInterfaceInfo *info,
* Obtain the number of signals that this interface type has. * Obtain the number of signals that this interface type has.
* *
* Returns: number of signals * Returns: number of signals
* Since: 2.80
*/ */
guint guint
gi_interface_info_get_n_signals (GIInterfaceInfo *info) gi_interface_info_get_n_signals (GIInterfaceInfo *info)
@ -261,8 +272,9 @@ gi_interface_info_get_n_signals (GIInterfaceInfo *info)
* *
* Obtain an interface type signal at index @n. * Obtain an interface type signal at index @n.
* *
* Returns: (transfer full): the #GISignalInfo. Free the struct by calling * Returns: (transfer full): The [class@GIRepository.SignalInfo]. Free the
* gi_base_info_unref() when done. * struct by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GISignalInfo * GISignalInfo *
gi_interface_info_get_signal (GIInterfaceInfo *info, gi_interface_info_get_signal (GIInterfaceInfo *info,
@ -292,12 +304,15 @@ gi_interface_info_get_signal (GIInterfaceInfo *info,
/** /**
* gi_interface_info_find_signal: * gi_interface_info_find_signal:
* @info: a #GIInterfaceInfo * @info: a #GIInterfaceInfo
* @name: Name of signal * @name: name of signal to find
* *
* TODO * Obtain a signal of the interface type given a @name.
* *
* Returns: (transfer full): Info for the signal with name @name in @info, or * `NULL` will be returned if theres no signal available with that name.
* %NULL on failure. *
* Returns: (transfer full) (nullable): The [class@GIRepository.SignalInfo] or
* `NULL` if none found. Free the struct by calling
* [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80 * Since: 2.80
*/ */
GISignalInfo * GISignalInfo *
@ -329,6 +344,7 @@ gi_interface_info_find_signal (GIInterfaceInfo *info,
* Obtain the number of virtual functions that this interface type has. * Obtain the number of virtual functions that this interface type has.
* *
* Returns: number of virtual functions * Returns: number of virtual functions
* Since: 2.80
*/ */
guint guint
gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info) gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
@ -351,8 +367,9 @@ gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
* *
* Obtain an interface type virtual function at index @n. * Obtain an interface type virtual function at index @n.
* *
* Returns: (transfer full): the #GIVFuncInfo. Free the struct by calling * Returns: (transfer full): the [class@GIRepository.VFuncInfo]. Free the struct
* gi_base_info_unref() when done. * by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GIVFuncInfo * GIVFuncInfo *
gi_interface_info_get_vfunc (GIInterfaceInfo *info, gi_interface_info_get_vfunc (GIInterfaceInfo *info,
@ -385,11 +402,15 @@ gi_interface_info_get_vfunc (GIInterfaceInfo *info,
* @info: a #GIInterfaceInfo * @info: a #GIInterfaceInfo
* @name: The name of a virtual function to find. * @name: The name of a virtual function to find.
* *
* Locate a virtual function slot with name @name. See the documentation * Locate a virtual function slot with name @name.
* for gi_object_info_find_vfunc() for more information on virtuals.
* *
* Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with * See the documentation for [method@GIRepository.ObjectInfo.find_vfunc] for
* gi_base_info_unref() when done. * more information on virtuals.
*
* Returns: (transfer full) (nullable): The [class@GIRepository.VFuncInfo], or
* `NULL` if none found. Free it with [method@GIRepository.BaseInfo.unref]
* when done.
* Since: 2.80
*/ */
GIVFuncInfo * GIVFuncInfo *
gi_interface_info_find_vfunc (GIInterfaceInfo *info, gi_interface_info_find_vfunc (GIInterfaceInfo *info,
@ -422,6 +443,7 @@ gi_interface_info_find_vfunc (GIInterfaceInfo *info,
* Obtain the number of constants that this interface type has. * Obtain the number of constants that this interface type has.
* *
* Returns: number of constants * Returns: number of constants
* Since: 2.80
*/ */
guint guint
gi_interface_info_get_n_constants (GIInterfaceInfo *info) gi_interface_info_get_n_constants (GIInterfaceInfo *info)
@ -444,8 +466,9 @@ gi_interface_info_get_n_constants (GIInterfaceInfo *info)
* *
* Obtain an interface type constant at index @n. * Obtain an interface type constant at index @n.
* *
* Returns: (transfer full): the #GIConstantInfo. Free the struct by calling * Returns: (transfer full): The [class@GIRepository.ConstantInfo]. Free the
* gi_base_info_unref() when done. * struct by calling [method@GIRepository.BaseInfo.unref] when done.
* Since: 2.80
*/ */
GIConstantInfo * GIConstantInfo *
gi_interface_info_get_constant (GIInterfaceInfo *info, gi_interface_info_get_constant (GIInterfaceInfo *info,
@ -478,10 +501,12 @@ gi_interface_info_get_constant (GIInterfaceInfo *info,
* gi_interface_info_get_iface_struct: * gi_interface_info_get_iface_struct:
* @info: a #GIInterfaceInfo * @info: a #GIInterfaceInfo
* *
* Returns the layout C structure associated with this #GInterface. * Returns the layout C structure associated with this `GInterface`.
* *
* Returns: (transfer full): the #GIStructInfo or %NULL. Free it with * Returns: (transfer full) (nullable): The [class@GIRepository.StructInfo] or
* gi_base_info_unref() when done. * `NULL` if unknown. Free it with [method@GIRepository.BaseInfo.unref] when
* done.
* Since: 2.80
*/ */
GIStructInfo * GIStructInfo *
gi_interface_info_get_iface_struct (GIInterfaceInfo *info) gi_interface_info_get_iface_struct (GIInterfaceInfo *info)

View File

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