New ValueName substitution in glib-mkenums
Submitted by Aleksander Morgado
Link to original bug (#662693)
Description
It would be great if glib-mkenums had a "ValueName" susbtitution, so that from the following example:
typedef enum { PREFIX_THE_FIRST_VALUE = 1, PREFIX_ANOTHER_VALUE = 2, } PrefixTheXEnum;
We could get "TheFirstValue" and "AnotherValue".
It would be very handy to setup glib-mkenums to generate error type information with error domain registration in GDBus, something like:
GQuark @enum_name@_quark (void) { static volatile gsize quark_volatile = 0; static const GDBusErrorEntry @enum_name@_entries[] = { { @VALUENAME@, "org.project.Foo.Bar.Error.@ValueName@"}, };
g_dbus_error_register_error_domain ("@enum_name@_quark",
&quark_volatile,
@enum_name@_entries,
G_N_ELEMENTS (@enum_name@_entries));
return (GQuark) quark_volatile;
}
Note: this wouldn't be enough to get it useful for GDBusErrorEntry generations, as usually errors in DBus are given with the error domain, like "org.project.Foo.Bar.Error.Domain.@ValueName@", and the Domain part usually also comes from the enum name... that's another issue to handle.
Version: 2.31.x