52 "no",
"yes",
"n",
"y",
"false",
"true",
"0",
"1",
"off",
"on", NULL,
59 const char *value,
struct Buffer *err)
76 buf_printf(err,
_(
"Invalid boolean value: %s"), value);
82 if (num == (*(
bool *) var))
90 int rc = cdef->
validator(cs, cdef, (intptr_t) num, err);
115 index = *(
bool *) var;
132 if ((value < 0) || (value > 1))
134 buf_printf(err,
_(
"Invalid boolean value: %ld"), (
long) value);
138 if (value == (*(
bool *) var))
146 int rc = cdef->
validator(cs, cdef, value, err);
152 *(
bool *) var = value;
162 return *(
bool *) var;
171 if (cdef->
initial == (*(
bool *) var))
198 if (!sub || !he || !he->
data)
206 if (value == INT_MIN)
const struct ConfigSetType CstBool
Config type representing an boolean.
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
int bool_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a bool.
const char * BoolValues[]
Valid strings for creating a Bool.
Type representing a boolean.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
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.
static bool startup_only(const struct ConfigDef *cdef, struct Buffer *err)
Validator function for D_ON_STARTUP.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_INV_TYPE
Value is not valid for the type.
#define CSR_INV_VALIDATOR
Value was rejected by the validator.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_ERR_CODE
Problem with the code.
#define CSR_SUCCESS
Action completed successfully.
static intptr_t bool_native_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Get a bool from a Bool config item - Implements ConfigSetType::native_get() -.
static int bool_native_set(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Set a Bool config item by bool - Implements ConfigSetType::native_set() -.
static int bool_reset(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *err)
Reset a Bool to its initial value - Implements ConfigSetType::reset() -.
static int bool_string_get(const struct ConfigSet *cs, void *var, const struct ConfigDef *cdef, struct Buffer *result)
Get a Bool as a string - Implements ConfigSetType::string_get() -.
static int bool_string_set(const struct ConfigSet *cs, void *var, struct ConfigDef *cdef, const char *value, struct Buffer *err)
Set a Bool by string - Implements ConfigSetType::string_set() -.
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
String manipulation buffer.
int(* validator)(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
intptr_t initial
Initial value.
Container for lots of config items.
A set of inherited config items.
struct ConfigSet * cs
Parent ConfigSet.
The item stored in a Hash Table.
int type
Type of data stored in Hash Table, e.g. DT_STRING.
void * data
User-supplied data.
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
void cs_subset_notify_observers(const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev)
Notify all observers of an event.
@ NT_CONFIG_SET
Config item has been set.
Constants for all the config types.