mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
Implement conditions on tag
A condition is formed by: <tag> <op> <value> <tag> is the normal yambar tag. <op> is one of '==', '!=', '<', '<=', '>', or '>='. <value> is what you wish to compare it to. 'boolean' tags must be used directly. They falsehood is matched with '~': <tag> ~<tag> Finally, to match an empty string, one must use ' "" ': <tag> <op> ""
This commit is contained in:
parent
4496d82cfb
commit
2b103b7acd
11 changed files with 416 additions and 75 deletions
8
tag.h
8
tag.h
|
@ -3,6 +3,13 @@
|
|||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum tag_type {
|
||||
TAG_TYPE_BOOL,
|
||||
TAG_TYPE_INT,
|
||||
TAG_TYPE_FLOAT,
|
||||
TAG_TYPE_STRING,
|
||||
};
|
||||
|
||||
enum tag_realtime_unit {
|
||||
TAG_REALTIME_NONE,
|
||||
TAG_REALTIME_SECS,
|
||||
|
@ -17,6 +24,7 @@ struct tag {
|
|||
|
||||
void (*destroy)(struct tag *tag);
|
||||
const char *(*name)(const struct tag *tag);
|
||||
enum tag_type (*type)(const struct tag *tag);
|
||||
const char *(*as_string)(const struct tag *tag);
|
||||
long (*as_int)(const struct tag *tag);
|
||||
bool (*as_bool)(const struct tag *tag);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue