NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
subset.h
Go to the documentation of this file.
1
23#ifndef MUTT_CONFIG_SUBSET_H
24#define MUTT_CONFIG_SUBSET_H
25
26#include <stdint.h>
27
28struct Buffer;
29struct ConfigSet;
30struct HashElem;
31struct Notify;
32
37{
41};
42
47{
48 const char *name;
51 struct ConfigSet *cs;
52 struct Notify *notify;
53};
54
61{
64};
65
70{
71 const struct ConfigSubset *sub;
72 const char *name;
73 struct HashElem *he;
74};
75
76struct ConfigSubset *cs_subset_new (const char *name, struct ConfigSubset *sub_parent, struct Notify *not_parent);
77void cs_subset_free(struct ConfigSubset **ptr);
78
79struct HashElem *cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name);
80struct HashElem *cs_subset_lookup (const struct ConfigSubset *sub, const char *name);
81void cs_subset_notify_observers (const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev);
82
83intptr_t cs_subset_he_native_get (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err);
84int cs_subset_he_native_set (const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err);
85int cs_subset_he_reset (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err);
86int cs_subset_he_string_get (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result);
87int cs_subset_he_string_minus_equals (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err);
88int cs_subset_he_string_plus_equals (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err);
89int cs_subset_he_string_set (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err);
90
91intptr_t cs_subset_str_native_get (const struct ConfigSubset *sub, const char *name, struct Buffer *err);
92int cs_subset_str_native_set (const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err);
93int cs_subset_str_reset (const struct ConfigSubset *sub, const char *name, struct Buffer *err);
94int cs_subset_str_string_get (const struct ConfigSubset *sub, const char *name, struct Buffer *result);
95int cs_subset_str_string_minus_equals(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err);
96int cs_subset_str_string_plus_equals (const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err);
97int cs_subset_str_string_set (const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err);
98
99int elem_list_sort(const void *a, const void *b);
100struct HashElem **get_elem_list(struct ConfigSet *cs);
101
102#endif /* MUTT_CONFIG_SUBSET_H */
String manipulation buffer.
Definition: buffer.h:34
Container for lots of config items.
Definition: set.h:260
A set of inherited config items.
Definition: subset.h:47
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
const char * name
Scope name of Subset.
Definition: subset.h:48
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
struct ConfigSubset * parent
Parent Subset.
Definition: subset.h:50
enum ConfigScope scope
Scope of Subset, e.g. SET_SCOPE_ACCOUNT.
Definition: subset.h:49
A config-change event.
Definition: subset.h:70
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:72
struct HashElem * he
Config item that changed.
Definition: subset.h:73
The item stored in a Hash Table.
Definition: hash.h:44
Notification API.
Definition: notify.c:51
int cs_subset_he_string_minus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Remove from a config item by string.
Definition: subset.c:462
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
Definition: subset.c:354
int elem_list_sort(const void *a, const void *b)
Sort two HashElem pointers to config.
Definition: subset.c:59
int cs_subset_str_string_plus_equals(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Add to a config item by string.
Definition: subset.c:446
NotifyConfig
Config notification types.
Definition: subset.h:61
@ NT_CONFIG_RESET
Config item has been reset to initial, or parent, value.
Definition: subset.h:63
@ NT_CONFIG_SET
Config item has been set.
Definition: subset.h:62
int cs_subset_str_reset(const struct ConfigSubset *sub, const char *name, struct Buffer *err)
Reset a config item to its initial value.
Definition: subset.c:340
int cs_subset_str_string_minus_equals(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Remove from a config item by string.
Definition: subset.c:484
int cs_subset_he_native_set(const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
Definition: subset.c:283
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:305
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
Definition: subset.c:250
struct HashElem ** get_elem_list(struct ConfigSet *cs)
Create a sorted list of all config items.
Definition: subset.c:75
int cs_subset_he_reset(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
Definition: subset.c:320
int cs_subset_str_string_get(const struct ConfigSubset *sub, const char *name, struct Buffer *result)
Get a config item as a string.
Definition: subset.c:370
int cs_subset_he_string_set(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Set a config item by string.
Definition: subset.c:386
int cs_subset_str_string_set(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Set a config item by string.
Definition: subset.c:408
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
Definition: subset.c:200
struct ConfigSubset * cs_subset_new(const char *name, struct ConfigSubset *sub_parent, struct Notify *not_parent)
Create a new Config Subset.
Definition: subset.c:144
void cs_subset_free(struct ConfigSubset **ptr)
Free a Config Subset.
Definition: subset.c:104
ConfigScope
Who does this Config belong to?
Definition: subset.h:37
@ SET_SCOPE_MAILBOX
This Config is Mailbox-specific.
Definition: subset.h:40
@ SET_SCOPE_NEOMUTT
This Config is NeoMutt-specific (global)
Definition: subset.h:38
@ SET_SCOPE_ACCOUNT
This Config is Account-specific.
Definition: subset.h:39
int cs_subset_he_string_plus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Add to a config item by string.
Definition: subset.c:424
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
Definition: subset.c:179
intptr_t cs_subset_str_native_get(const struct ConfigSubset *sub, const char *name, struct Buffer *err)
Natively get the value of a string config item.
Definition: subset.c:267
void cs_subset_notify_observers(const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev)
Notify all observers of an event.
Definition: subset.c:229