mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 14:41:25 +00:00
We don't use anymore GObject parameters so avoid having to register enum values to GType system to use them. We just need to get the nick value of the enum values for debug purposes. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
41 lines
804 B
Cheetah
41 lines
804 B
Cheetah
/*** BEGIN file-header ***/
|
|
#include <config.h>
|
|
|
|
#include "spice-server-enums.h"
|
|
|
|
typedef struct EnumValues {
|
|
int value;
|
|
const char *nick;
|
|
} EnumValues;
|
|
|
|
static const char *
|
|
enum_values_get_nick(int value, const EnumValues *e)
|
|
{
|
|
for (; e->nick; e++) {
|
|
if (e->value == value) {
|
|
return e->nick;
|
|
}
|
|
}
|
|
return "???";
|
|
}
|
|
|
|
/*** END file-header ***/
|
|
|
|
/*** BEGIN value-header ***/
|
|
|
|
const char *@EnumName@_get_nick(@EnumName@ value)
|
|
{
|
|
static const struct EnumValues @EnumName@_values[] = {
|
|
/*** END value-header ***/
|
|
|
|
/*** BEGIN value-production ***/
|
|
{ @VALUENAME@, "@valuenick@" },
|
|
/*** END value-production ***/
|
|
|
|
/*** BEGIN value-tail ***/
|
|
{ 0, NULL, }
|
|
};
|
|
return enum_values_get_nick(value, @EnumName@_values);
|
|
}
|
|
/*** END value-tail ***/
|