forked from AuroraMiddleware/gtk
Add an auxiliary ident parsing function
This lets us conveniently create ident values from multiple candidates.
This commit is contained in:
parent
edaaefcb74
commit
6420dd934f
@ -203,6 +203,34 @@ _gtk_css_ident_value_try_parse (GtkCssParser *parser)
|
||||
return _gtk_css_ident_value_new_take (ident);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_ident_value_try (GtkCssParser *parser,
|
||||
const char *ident,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
const char *name;
|
||||
GtkCssValue *value = NULL;
|
||||
|
||||
name = ident;
|
||||
|
||||
va_start (args, ident);
|
||||
|
||||
while (name)
|
||||
{
|
||||
if (_gtk_css_parser_try (parser, name, TRUE))
|
||||
{
|
||||
value = _gtk_css_ident_value_new (name);
|
||||
break;
|
||||
}
|
||||
ident = va_arg (args, const char *);
|
||||
}
|
||||
|
||||
va_end (args);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
const char *
|
||||
_gtk_css_ident_value_get (const GtkCssValue *value)
|
||||
{
|
||||
|
@ -29,6 +29,9 @@ G_BEGIN_DECLS
|
||||
GtkCssValue * _gtk_css_ident_value_new (const char *ident);
|
||||
GtkCssValue * _gtk_css_ident_value_new_take (char *ident);
|
||||
GtkCssValue * _gtk_css_ident_value_try_parse (GtkCssParser *parser);
|
||||
GtkCssValue * _gtk_css_ident_value_try (GtkCssParser *parser,
|
||||
const char *ident,
|
||||
...);
|
||||
|
||||
const char * _gtk_css_ident_value_get (const GtkCssValue *ident);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user