enum action_arg_type {
LAB_ACTION_ARG_STR = 0,
LAB_ACTION_ARG_BOOL,
+ LAB_ACTION_ARG_INT,
};
struct action_arg {
bool value;
};
+struct action_arg_int {
+ struct action_arg base;
+ int value;
+};
+
enum action_type {
ACTION_TYPE_INVALID = 0,
ACTION_TYPE_NONE,
wl_list_append(&action->args, &arg->base.link);
}
+static void
+action_arg_add_int(struct action *action, char *key, int value)
+{
+ struct action_arg_int *arg = znew(*arg);
+ arg->base.type = LAB_ACTION_ARG_INT;
+ if (key) {
+ arg->base.key = xstrdup(key);
+ }
+ arg->value = value;
+ wl_list_append(&action->args, &arg->base.link);
+}
+
void
action_arg_from_xml_node(struct action *action, char *nodename, char *content)
{
return default_value;
}
+static int
+get_arg_value_int(struct action *action, const char *key, int default_value)
+{
+ assert(key);
+ struct action_arg *arg;
+ wl_list_for_each(arg, &action->args, link) {
+ if (!arg->key) {
+ continue;
+ }
+ if (!strcasecmp(key, arg->key)) {
+ assert(arg->type == LAB_ACTION_ARG_INT);
+ return ((struct action_arg_int *)arg)->value;
+ }
+ }
+ return default_value;
+}
+
static struct action_arg *
action_get_first_arg(struct action *action)
{