23#ifndef MUTT_CONFIG_SET_H
24#define MUTT_CONFIG_SET_H
37#define CSR_ERR_UNKNOWN 2
38#define CSR_ERR_INVALID 3
41#define CSR_SUC_INHERITED (1 << 4)
42#define CSR_SUC_EMPTY (1 << 5)
43#define CSR_SUC_WARNING (1 << 6)
44#define CSR_SUC_NO_CHANGE (1 << 7)
47#define CSR_INV_TYPE (1 << 4)
48#define CSR_INV_VALIDATOR (1 << 5)
49#define CSV_INV_NOT_IMPL (1 << 6)
51#define CSR_RESULT_MASK 0x0F
52#define CSR_RESULT(x) ((x) & CSR_RESULT_MASK)
300 buf_printf(err,
_(
"Option %s may only be set at startup"), cdef->
name);
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
int cs_str_initial_get(const struct ConfigSet *cs, const char *name, struct Buffer *result)
Get the initial, or parent, value of a config item.
struct HashElem * cs_get_elem(const struct ConfigSet *cs, const char *name)
Get the HashElem representing a config item.
int cs_str_initial_set(const struct ConfigSet *cs, const char *name, const char *value, struct Buffer *err)
Set the initial value of a config item.
int cs_he_string_plus_equals(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Add to a config item by string.
void cs_free(struct ConfigSet **ptr)
Free a Config Set.
int cs_str_reset(const struct ConfigSet *cs, const char *name, struct Buffer *err)
Reset a config item to its initial value.
struct ConfigSet * cs_new(size_t size)
Create a new Config Set.
struct HashElem * cs_create_variable(const struct ConfigSet *cs, struct ConfigDef *cdef, struct Buffer *err)
Create and register one config item.
int cs_he_reset(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
const struct ConfigSetType * cs_get_type_def(const struct ConfigSet *cs, unsigned int type)
Get the definition for a type.
int cs_he_delete(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Delete config item from a config set.
int cs_str_string_set(const struct ConfigSet *cs, const char *name, const char *value, struct Buffer *err)
Set a config item by string.
int cs_he_string_set(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Set a config item by string.
int cs_str_native_set(const struct ConfigSet *cs, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
int cs_he_native_set(const struct ConfigSet *cs, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
intptr_t cs_he_native_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
struct HashElem * cs_inherit_variable(const struct ConfigSet *cs, struct HashElem *he_parent, const char *name)
Create in inherited config item.
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
int cs_he_string_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
bool StartupComplete
When the config has been read.
struct HashElem * cs_register_variable(const struct ConfigSet *cs, struct ConfigDef *cdef, struct Buffer *err)
Register one config item.
int cs_he_initial_set(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Set the initial value of a config item.
int cs_he_initial_get(const struct ConfigSet *cs, struct HashElem *he, struct Buffer *result)
Get the initial, or parent, value of a config item.
bool cs_register_type(struct ConfigSet *cs, const struct ConfigSetType *cst)
Register a type of config item.
int cs_he_string_minus_equals(const struct ConfigSet *cs, struct HashElem *he, const char *value, struct Buffer *err)
Remove from a config item by string.
void cs_uninherit_variable(const struct ConfigSet *cs, const char *name)
Remove an inherited config item.
Convenience wrapper for the library headers.
String manipulation buffer.
const char * name
User-visible name.
intptr_t var
Storage for the variable.
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t data
Extra variable data.
intptr_t initial
Initial value.
uint32_t type
Variable type, e.g. DT_STRING.
const char * docs
One-liner description.
int(* string_get)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
int type
Data type, e.g. DT_STRING.
int(* native_set)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
int(* string_set)(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
int(* string_plus_equals)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
int(* string_minus_equals)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, const char *value, struct Buffer *err)
int(* reset)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
void(* destroy)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef)
intptr_t(* native_get)(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
const char * name
Name of the type, e.g. "String".
Container for lots of config items.
struct ConfigSetType types[18]
All the defined config types.
struct HashTable * hash
Hash Table: "$name" -> ConfigDef.
The item stored in a Hash Table.
Constants for all the config types.
#define D_ON_STARTUP
May only be set at startup.