Skip to content

glib-mkenums: allow optional 'since' tag

Aleksander Morgado requested to merge aleksm/glib:aleksm/mkenums-since into master

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

Merge request reports