mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
config: verify: expose verification primitives
This commit is contained in:
parent
6cb2f52328
commit
d44db1a6a8
2 changed files with 128 additions and 116 deletions
|
@ -1,5 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "tllist.h"
|
||||
#include "yml.h"
|
||||
|
||||
bool config_verify_bar(const struct yml_node *bar);
|
||||
typedef tll(const char *) keychain_t;
|
||||
|
||||
struct attr_info {
|
||||
const char *name;
|
||||
bool required;
|
||||
bool (*verify)(keychain_t *chain, const struct yml_node *node);
|
||||
};
|
||||
|
||||
static inline keychain_t *
|
||||
chain_push(keychain_t *chain, const char *key)
|
||||
{
|
||||
tll_push_back(*chain, key);
|
||||
return chain;
|
||||
}
|
||||
|
||||
static inline void
|
||||
chain_pop(keychain_t *chain)
|
||||
{
|
||||
tll_pop_back(*chain);
|
||||
}
|
||||
|
||||
bool conf_verify_string(keychain_t *chain, const struct yml_node *node);
|
||||
bool conf_verify_int(keychain_t *chain, const struct yml_node *node);
|
||||
|
||||
bool conf_verify_enum(keychain_t *chain, const struct yml_node *node,
|
||||
const char *values[], size_t count);
|
||||
bool conf_verify_dict(keychain_t *chain, const struct yml_node *node,
|
||||
const struct attr_info info[], size_t count);
|
||||
|
||||
bool conf_verify_color(keychain_t *chain, const struct yml_node *node);
|
||||
bool conf_verify_font(keychain_t *chain, const struct yml_node *node);
|
||||
|
||||
bool conf_verify_particle(keychain_t *chain, const struct yml_node *node);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue