allow negating boolean properties

This commit is contained in:
Felix Kratz 2022-10-11 14:48:09 +02:00
parent 93725bb8ee
commit 737c265334
2 changed files with 13 additions and 1 deletions

View file

@ -108,13 +108,21 @@
#define COMMAND_QUERY_EVENTS "events" #define COMMAND_QUERY_EVENTS "events"
#define ARGUMENT_COMMON_VAL_ON "on" #define ARGUMENT_COMMON_VAL_ON "on"
#define ARGUMENT_COMMON_VAL_NOT_OFF "!off"
#define ARGUMENT_COMMON_VAL_TRUE "true" #define ARGUMENT_COMMON_VAL_TRUE "true"
#define ARGUMENT_COMMON_VAL_NOT_FALSE "!false"
#define ARGUMENT_COMMON_VAL_ONE "1" #define ARGUMENT_COMMON_VAL_ONE "1"
#define ARGUMENT_COMMON_VAL_NOT_ZERO "!0"
#define ARGUMENT_COMMON_VAL_YES "yes" #define ARGUMENT_COMMON_VAL_YES "yes"
#define ARGUMENT_COMMON_VAL_NOT_NO "!no"
#define ARGUMENT_COMMON_VAL_OFF "off" #define ARGUMENT_COMMON_VAL_OFF "off"
#define ARGUMENT_COMMON_VAL_NOT_ON "!on"
#define ARGUMENT_COMMON_VAL_FALSE "false" #define ARGUMENT_COMMON_VAL_FALSE "false"
#define ARGUMENT_COMMON_VAL_NOT_TRUE "!true"
#define ARGUMENT_COMMON_VAL_ZERO "0" #define ARGUMENT_COMMON_VAL_ZERO "0"
#define ARGUMENT_COMMON_VAL_NOT_ONE "!1"
#define ARGUMENT_COMMON_VAL_NO "no" #define ARGUMENT_COMMON_VAL_NO "no"
#define ARGUMENT_COMMON_VAL_NOT_YES "!yes"
#define ARGUMENT_COMMON_VAL_TOGGLE "toggle" #define ARGUMENT_COMMON_VAL_TOGGLE "toggle"
#define ARGUMENT_COMMON_VAL_BEFORE "before" #define ARGUMENT_COMMON_VAL_BEFORE "before"
#define ARGUMENT_COMMON_VAL_AFTER "after" #define ARGUMENT_COMMON_VAL_AFTER "after"

View file

@ -308,7 +308,11 @@ static inline bool evaluate_boolean_state(struct token state, bool previous_stat
if (token_equals(state, ARGUMENT_COMMON_VAL_ON) if (token_equals(state, ARGUMENT_COMMON_VAL_ON)
|| token_equals(state, ARGUMENT_COMMON_VAL_YES) || token_equals(state, ARGUMENT_COMMON_VAL_YES)
|| token_equals(state, ARGUMENT_COMMON_VAL_TRUE) || token_equals(state, ARGUMENT_COMMON_VAL_TRUE)
|| token_equals(state, ARGUMENT_COMMON_VAL_ONE) ) || token_equals(state, ARGUMENT_COMMON_VAL_ONE)
|| token_equals(state, ARGUMENT_COMMON_VAL_NOT_OFF)
|| token_equals(state, ARGUMENT_COMMON_VAL_NOT_NO)
|| token_equals(state, ARGUMENT_COMMON_VAL_NOT_FALSE)
|| token_equals(state, ARGUMENT_COMMON_VAL_NOT_ZERO) )
return true; return true;
else if (token_equals(state, ARGUMENT_COMMON_VAL_TOGGLE)) else if (token_equals(state, ARGUMENT_COMMON_VAL_TOGGLE))
return !previous_state; return !previous_state;