Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Lookup of configuration keys in a low-level configuration system.
Configuration keys are dynamically stored in a splay tree. This happens for defaults, loaded config files and entries which are set explicitly. The system maintains no central registry of all possible keys. We store here the full keys of config entries as well as the keys of section prefixes. Section prefixes are stored with a trailing dot to disambiguate them from entry keys.
Definition in file config-lookup.h.
#include "lib/psplay.h"
#include "lib/llist.h"
#include "lib/error.h"
#include "common/configitem.h"
#include <nobug.h>
Classes | |
struct | lumiera_config_lookup |
Just contains a hashtable to give sufficient abstraction. More... | |
struct | lumiera_config_lookupentry |
Typedefs | |
typedef lumiera_config_lookup * | LumieraConfigLookup |
typedef lumiera_config_lookupentry * | LumieraConfigLookupentry |
Functions | |
LumieraConfigLookup | lumiera_config_lookup_destroy (LumieraConfigLookup self) |
Destroy a lookup structure. More... | |
LumieraConfigLookupentry | lumiera_config_lookup_find (LumieraConfigLookup self, const char *key) |
Find a hashtable entry in the lookup structure. More... | |
LumieraConfigLookup | lumiera_config_lookup_init (LumieraConfigLookup self) |
Initialise a lookup structure. More... | |
LumieraConfigLookupentry | lumiera_config_lookup_insert (LumieraConfigLookup self, LumieraConfigitem item) |
Add a config item to a lookup structure. More... | |
LumieraConfigLookupentry | lumiera_config_lookup_insert_default (LumieraConfigLookup self, LumieraConfigitem item) |
LumieraConfigitem | lumiera_config_lookup_item_find (LumieraConfigLookup self, const char *key) |
Find a the topmost config item stored to a given key. More... | |
LumieraConfigitem | lumiera_config_lookup_item_tail_find (LumieraConfigLookup self, const char *key) |
Find a the bottom most config item stored to a given key. More... | |
LumieraConfigitem | lumiera_config_lookup_remove (LumieraConfigLookup self, LumieraConfigitem item) |
Remove a config item from a lookup structure. More... | |
void | lumiera_config_lookupentry_delete (LumieraConfigLookupentry self) |
LumieraConfigLookupentry | lumiera_config_lookupentry_destroy (LumieraConfigLookupentry self) |
LumieraConfigLookupentry | lumiera_config_lookupentry_init (LumieraConfigLookupentry self, const char *key) |
LumieraConfigLookupentry | lumiera_config_lookupentry_new (const char *key) |
LUMIERA_ERROR_DECLARE (CONFIG_LOOKUP) | |
struct lumiera_config_lookup_struct |
struct lumiera_config_lookupentry_struct |
LumieraConfigLookup lumiera_config_lookup_init | ( | LumieraConfigLookup | self | ) |
Initialise a lookup structure.
self | lookup structure to be initialised |
Definition at line 50 of file config-lookup.c.
References psplay_init().
LumieraConfigLookup lumiera_config_lookup_destroy | ( | LumieraConfigLookup | self | ) |
Destroy a lookup structure.
self | lookup structure to be destroyed |
Definition at line 59 of file config-lookup.c.
References psplay_destroy().
LumieraConfigLookupentry lumiera_config_lookup_insert | ( | LumieraConfigLookup | self, |
LumieraConfigitem | item | ||
) |
Add a config item to a lookup structure.
Config items are stored under their key and stacked in insertion order.
self | lookup structure where the item shall be added |
item | config item to add to the lookup structure |
Definition at line 69 of file config-lookup.c.
References lumiera_tmpbuf_strcat3().
LumieraConfigLookupentry lumiera_config_lookup_insert_default | ( | LumieraConfigLookup | self, |
LumieraConfigitem | item | ||
) |
Add a default config item to a lookup structure. The item must contain a full key and not part of any 'section' and is inserted as tail of the lookup list.
self | lookup structure where the item shall be added |
item | config item to add to the lookup structure |
Definition at line 91 of file config-lookup.c.
References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), and lumiera_tmpbuf_snprintf().
LumieraConfigitem lumiera_config_lookup_remove | ( | LumieraConfigLookup | self, |
LumieraConfigitem | item | ||
) |
Remove a config item from a lookup structure.
Config must be removed from the lookup when they are not used anymore. Removing a config item unlinks it from the stack of all config items with the same key. When this was the last config item under that key, the lookup entry is cleaned up.
self | lookup structure where the item shall be removed |
item | config item to be removed from the lookup |
Definition at line 113 of file config-lookup.c.
References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), LLIST_TO_STRUCTP, and psplay_delete_node().
LumieraConfigLookupentry lumiera_config_lookup_find | ( | LumieraConfigLookup | self, |
const char * | key | ||
) |
Find a hashtable entry in the lookup structure.
Internal function, can be used to check if at least one item is available for a given key.
self | lookup structure where the key shall be searched |
key | string to be looked up |
Definition at line 136 of file config-lookup.c.
References psplay_find().
Referenced by lumiera_config_lookup_item_find(), and lumiera_config_lookup_item_tail_find().
LumieraConfigitem lumiera_config_lookup_item_find | ( | LumieraConfigLookup | self, |
const char * | key | ||
) |
Find a the topmost config item stored to a given key.
self | lookup structure where the key shall be searched |
key | string to be looked up |
Definition at line 144 of file config-lookup.c.
References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), LLIST_TO_STRUCTP, and lumiera_config_lookup_find().
Referenced by lumiera_config_set().
LumieraConfigitem lumiera_config_lookup_item_tail_find | ( | LumieraConfigLookup | self, |
const char * | key | ||
) |
Find a the bottom most config item stored to a given key.
defaults sits at the bottom if exists
self | lookup structure where the key shall be searched |
key | string to be looked up |
Definition at line 159 of file config-lookup.c.
References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), LLIST_TO_STRUCTP, and lumiera_config_lookup_find().