mirror of https://github.com/mgba-emu/mgba.git
Util: Add easy way to remove keys
This commit is contained in:
parent
0ba9d1e247
commit
61467cacd9
|
@ -83,6 +83,17 @@ void ConfigurationSetFloatValue(struct Configuration* configuration, const char*
|
|||
ConfigurationSetValue(configuration, section, key, charValue);
|
||||
}
|
||||
|
||||
void ConfigurationClearValue(struct Configuration* configuration, const char* section, const char* key) {
|
||||
struct Table* currentSection = &configuration->root;
|
||||
if (section) {
|
||||
currentSection = HashTableLookup(&configuration->sections, section);
|
||||
if (!currentSection) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
HashTableRemove(currentSection, key);
|
||||
}
|
||||
|
||||
const char* ConfigurationGetValue(const struct Configuration* configuration, const char* section, const char* key) {
|
||||
const struct Table* currentSection = &configuration->root;
|
||||
if (section) {
|
||||
|
|
|
@ -25,6 +25,8 @@ void ConfigurationSetFloatValue(struct Configuration*, const char* section, cons
|
|||
|
||||
const char* ConfigurationGetValue(const struct Configuration*, const char* section, const char* key);
|
||||
|
||||
void ConfigurationClearValue(struct Configuration*, const char* section, const char* key);
|
||||
|
||||
bool ConfigurationRead(struct Configuration*, const char* path);
|
||||
bool ConfigurationWrite(const struct Configuration*, const char* path);
|
||||
bool ConfigurationWriteSection(const struct Configuration*, const char* path, const char* section);
|
||||
|
|
Loading…
Reference in New Issue