docs: Mention alternatives for defining enumeration types

We should mention glib-mkenums in the documentation for
G_DEFINE_ENUM_TYPE and G_DEFINE_FLAGS_TYPE.

We should also mention the macros in the documentation for glib-mkenums.

This way, developers can choose the most appropriate tool for their use
case.
This commit is contained in:
Emmanuele Bassi 2022-06-29 15:44:36 +01:00
parent 6cbf7a7461
commit fa05ebe27c
2 changed files with 14 additions and 0 deletions

View File

@ -44,6 +44,12 @@ input. The options specified control the text that generated, substituting vario
keywords enclosed in <literal>@</literal> characters in the templates.
</para>
<para>Since version 2.74, GLib provides the <literal>G_DEFINE_ENUM_TYPE</literal>
and <literal>G_DEFINE_FLAGS_TYPE</literal> C pre-processor macros. These macros
can be used to define a GType for projects that have few, small enumeration
types without going through the complexities of generating code at build
time.</para>
<refsect2><title>Production text substitutions</title>
<para>
Certain keywords enclosed in <literal>@</literal> characters will be substituted in the

View File

@ -307,6 +307,10 @@ void g_flags_complete_type_info (GType g_flags_type,
* G_DEFINE_ENUM_VALUE (GTK_ORIENTATION_VERTICAL, "vertical"))
* ]|
*
* For projects that have multiple enumeration types, or enumeration
* types with many values, you should consider using glib-mkenums to
* generate the type function.
*
* Since: 2.74
*/
#define G_DEFINE_ENUM_TYPE(TypeName, type_name, values) \
@ -345,6 +349,10 @@ type_name ## _get_type (void) { \
* G_DEFINE_ENUM_VALUE (G_SETTINGS_BIND_INVERT_BOOLEAN, "invert-boolean"))
* ]|
*
* For projects that have multiple enumeration types, or enumeration
* types with many values, you should consider using glib-mkenums to
* generate the type function.
*
* Since: 2.74
*/
#define G_DEFINE_FLAGS_TYPE(TypeName, type_name, values) \