105 const char *name = (
const char *) cdef->
initial;
114 cdef->
type, (
void *) cdef);
118 cdef->
var = (intptr_t) he_parent;
270 cst->
reset(cs, &cdef->
var, cdef, err);
290 for (
size_t i = 0; vars[i].
name; i++)
328 cdef_copy->
var = cdef->
var;
348 struct HashElem *he_parent,
const char *name)
350 if (!cs || !he_parent)
425 rc = cst->
reset(cs, &cdef->
var, cdef, err);
462 const char *value,
struct Buffer *err)
472 cdef = he_base->
data;
488 int rc = cst->
string_set(cs, NULL, cdef, value, err);
504 const char *value,
struct Buffer *err)
531 if (!cs || !he || !result)
540 cdef = he_base->
data;
552 return cst->
string_get(cs, NULL, cdef, result);
589 const char *value,
struct Buffer *err)
602 cdef = he_base->
data;
622 int rc = cst->
string_set(cs, var, cdef, value, err);
641 const char *value,
struct Buffer *err)
665 if (!cs || !he || !result)
682 cdef = he_base->
data;
697 return cst->
string_get(cs, var, cdef, result);
709 intptr_t value,
struct Buffer *err)
722 cdef = he_base->
data;
742 int rc = cst->
native_set(cs, var, cdef, value, err);
761 intptr_t value,
struct Buffer *err)
781 cdef = he_base->
data;
792 if (!cst || !var || !cdef)
795 int rc = cst->
native_set(cs, var, cdef, value, err);
832 cdef = he_base->
data;
865 const char *value,
struct Buffer *err)
878 cdef = he_base->
data;
901 buf_printf(err,
_(
"Type '%s' doesn't support operation '%s'"), cst->
name,
"+=");
924 const char *value,
struct Buffer *err)
937 cdef = he_base->
data;
960 buf_printf(err,
_(
"Type '%s' doesn't support operation '%s'"), cst->
name,
"-=");
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
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.
static struct HashElem * create_synonym(const struct ConfigSet *cs, struct ConfigDef *cdef, struct Buffer *err)
Create an alternative name for a config item.
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.
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.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSV_INV_NOT_IMPL
Operation not permitted for the type.
#define CSR_ERR_UNKNOWN
Unrecognised config item.
#define CSR_ERR_CODE
Problem with the code.
#define CSR_SUCCESS
Action completed successfully.
static void cs_hashelem_free(int type, void *obj, intptr_t data)
Free our hash table data - Implements hash_hdata_free_t -.
#define mutt_debug(LEVEL,...)
void mutt_hash_delete(struct HashTable *table, const char *strkey, const void *data)
Remove an element from a Hash Table.
struct HashElem * mutt_hash_typed_insert(struct HashTable *table, const char *strkey, int type, void *data)
Insert a string with type info into a Hash Table.
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
struct HashElem * mutt_hash_find_elem(const struct HashTable *table, const char *strkey)
Find the HashElem in a Hash Table element using a key.
void mutt_hash_set_destructor(struct HashTable *table, hash_hdata_free_t fn, intptr_t fn_data)
Set the destructor for a Hash Table.
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
#define MUTT_HASH_NO_FLAGS
No flags are set.
An inherited config item.
@ LL_DEBUG1
Log at debug level 1.
#define MUTT_MEM_CALLOC(n, type)
#define mutt_array_size(x)
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
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.
union HashKey key
Key representing the data.
int type
Type of data stored in Hash Table, e.g. DT_STRING.
void * data
User-supplied data.
An inherited config item.
struct HashElem * parent
HashElem of parent config item.
const char * name
Name of this config item.
intptr_t var
(Pointer to) value, of config item
Constants for all the config types.
#define D_INTERNAL_INHERITED
Config item is inherited.
#define D_INTERNAL_FREE_CONFIGDEF
Config item must have its ConfigDef freed.
#define D_INTERNAL_INITIAL_SET
Config item must have its initial value freed.
@ DT_SYNONYM
synonym for another variable
@ DT_MYVAR
a user-defined variable (my_foo)
const char * strkey
String key.