mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-25 11:27:53 +02:00
glib-mkenums: allow optional 'since' tag
The glib-mkenums program allows generating code to handle enums/flags with very different purposes. One of its purposes could be generating per-enum/flag methods to be exposed in a library API, and while doing that, it would be nice to have a way to specify in which API version the enum/flag was introduced, so that the same version could be shown in the generated API methods. E.g. From the following code: /** * QmiWmsMessageProtocol: * @QMI_WMS_MESSAGE_PROTOCOL_CDMA: CDMA. * @QMI_WMS_MESSAGE_PROTOCOL_WCDMA: WCDMA. * * Type of message protocol. * * Since: 1.0 */ typedef enum { /*< since=1.0 >*/ QMI_WMS_MESSAGE_PROTOCOL_CDMA = 0x00, QMI_WMS_MESSAGE_PROTOCOL_WCDMA = 0x01 } QmiWmsMessageProtocol; The template would allow us to generate a method documented like this, including the Since tag with the value given in the mkenums 'since' tag. /** * qmi_wms_message_protocol_get_string: * @val: a QmiWmsMessageProtocol. * * Gets the nickname string for the #QmiWmsMessageProtocol specified at @val. * * Returns: (transfer none): a string with the nickname, or %NULL if not found. Do not free the returned value. * Since: 1.0 */ const gchar *qmi_wms_message_protocol_get_string (QmiWmsMessageProtocol val); Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
This commit is contained in:
@@ -195,6 +195,14 @@ Specifies the word separation used in the <function>*_get_type()</function>
|
||||
function. For instance, <literal>/*< underscore_name=gnome_vfs_uri_hide_options >*/</literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>since</literal></term>
|
||||
<listitem><para>
|
||||
Specifies the version tag that will be used to substitute the <literal>@enumsince@</literal>
|
||||
keyword in the template, useful when documenting methods generated from the enums
|
||||
(e.g. <literal>Since: @enumsince@</literal>). (Since: 2.66)
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>The following options can be specified per value definition:</para>
|
||||
@@ -219,7 +227,7 @@ typedef enum /*< skip >*/
|
||||
{
|
||||
PREFIX_FOO
|
||||
} PrefixThisEnumWillBeSkipped;
|
||||
typedef enum /*< flags,prefix=PREFIX >*/
|
||||
typedef enum /*< flags,prefix=PREFIX,since=1.0 >*/
|
||||
{
|
||||
PREFIX_THE_ZEROTH_VALUE, /*< skip >*/
|
||||
PREFIX_THE_FIRST_VALUE,
|
||||
|
Reference in New Issue
Block a user