NeoMutt  2025-01-09-81-g753ae0
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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#include "mutt/lib.h" // IWYU pragma: keep
28
29struct ConfigSet;
30struct Notify;
31
36{
40};
41
46{
47 const char *name;
50 struct ConfigSet *cs;
51 struct Notify *notify;
52};
53
60{
64};
65
70{
71 const struct ConfigSubset *sub;
72 const char *name;
73 struct HashElem *he;
74};
75
80{
83};
84
85struct ConfigSubset *cs_subset_new (const char *name, struct ConfigSubset *sub_parent, struct Notify *not_parent);
86void cs_subset_free(struct ConfigSubset **ptr);
87
88struct HashElem *cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name);
89struct HashElem *cs_subset_lookup (const struct ConfigSubset *sub, const char *name);
90void cs_subset_notify_observers (const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev);
91
92intptr_t cs_subset_he_native_get (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err);
93int cs_subset_he_native_set (const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err);
94int cs_subset_he_reset (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err);
95int cs_subset_he_string_get (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result);
96int cs_subset_he_string_minus_equals (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err);
97int cs_subset_he_string_plus_equals (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err);
98int cs_subset_he_string_set (const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err);
99int cs_subset_he_delete (const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err);
100
101int cs_subset_str_native_set (const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err);
102int cs_subset_str_string_get (const struct ConfigSubset *sub, const char *name, struct Buffer *result);
103int cs_subset_str_string_set (const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err);
104
105int elem_list_sort(const void *a, const void *b, void *sdata);
106struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags);
107
108#endif /* MUTT_CONFIG_SUBSET_H */
int elem_list_sort(const void *a, const void *b, void *sdata)
Compare two HashElem pointers to config - Implements sort_t -.
Definition: subset.c:63
Convenience wrapper for the library headers.
String manipulation buffer.
Definition: buffer.h:36
Container for lots of config items.
Definition: set.h:250
A set of inherited config items.
Definition: subset.h:46
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:51
const char * name
Scope name of Subset.
Definition: subset.h:47
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:50
struct ConfigSubset * parent
Parent Subset.
Definition: subset.h:49
enum ConfigScope scope
Scope of Subset, e.g. SET_SCOPE_ACCOUNT.
Definition: subset.h:48
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:53
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:426
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:334
NotifyConfig
Config notification types.
Definition: subset.h:60
@ NT_CONFIG_DELETED
Config item has been deleted.
Definition: subset.h:63
@ NT_CONFIG_RESET
Config item has been reset to initial, or parent, value.
Definition: subset.h:62
@ NT_CONFIG_SET
Config item has been set.
Definition: subset.h:61
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:277
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:299
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:260
int cs_subset_he_delete(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Delete config item from a config.
Definition: subset.c:447
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:314
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:350
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:366
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:388
struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags)
Create a sorted list of all config items.
Definition: subset.c:80
GetElemListFlags
Flags for get_elem_list()
Definition: subset.h:80
@ GEL_CHANGED_CONFIG
Only config that has been changed.
Definition: subset.h:82
@ GEL_ALL_CONFIG
All the normal config (no synonyms or deprecated)
Definition: subset.h:81
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
Definition: subset.c:210
struct ConfigSubset * cs_subset_new(const char *name, struct ConfigSubset *sub_parent, struct Notify *not_parent)
Create a new Config Subset.
Definition: subset.c:154
void cs_subset_free(struct ConfigSubset **ptr)
Free a Config Subset.
Definition: subset.c:108
ConfigScope
Who does this Config belong to?
Definition: subset.h:36
@ SET_SCOPE_MAILBOX
This Config is Mailbox-specific.
Definition: subset.h:39
@ SET_SCOPE_NEOMUTT
This Config is NeoMutt-specific (global)
Definition: subset.h:37
@ SET_SCOPE_ACCOUNT
This Config is Account-specific.
Definition: subset.h:38
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:404
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
Definition: subset.c:189
void cs_subset_notify_observers(const struct ConfigSubset *sub, struct HashElem *he, enum NotifyConfig ev)
Notify all observers of an event.
Definition: subset.c:239