2014-12-03 08:39:06 +00:00
|
|
|
/* Copyright (c) 2013-2014 Jeffrey Pfau
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2014-11-01 10:02:40 +00:00
|
|
|
#ifndef CONFIGURATION_H
|
|
|
|
#define CONFIGURATION_H
|
|
|
|
|
2016-12-31 01:00:22 +00:00
|
|
|
#include <mgba-util/common.h>
|
2016-12-27 05:01:55 +00:00
|
|
|
|
|
|
|
CXX_GUARD_START
|
|
|
|
|
2016-12-31 01:00:22 +00:00
|
|
|
#include <mgba-util/table.h>
|
2014-11-01 10:02:40 +00:00
|
|
|
|
|
|
|
struct VFile;
|
|
|
|
|
|
|
|
struct Configuration {
|
|
|
|
struct Table sections;
|
|
|
|
struct Table root;
|
|
|
|
};
|
|
|
|
|
|
|
|
void ConfigurationInit(struct Configuration*);
|
|
|
|
void ConfigurationDeinit(struct Configuration*);
|
|
|
|
|
|
|
|
void ConfigurationSetValue(struct Configuration*, const char* section, const char* key, const char* value);
|
2014-11-05 07:48:09 +00:00
|
|
|
void ConfigurationSetIntValue(struct Configuration*, const char* section, const char* key, int value);
|
|
|
|
void ConfigurationSetUIntValue(struct Configuration*, const char* section, const char* key, unsigned value);
|
|
|
|
void ConfigurationSetFloatValue(struct Configuration*, const char* section, const char* key, float value);
|
|
|
|
|
2015-07-17 06:45:55 +00:00
|
|
|
bool ConfigurationHasSection(const struct Configuration*, const char* section);
|
2014-11-01 10:02:40 +00:00
|
|
|
const char* ConfigurationGetValue(const struct Configuration*, const char* section, const char* key);
|
|
|
|
|
2015-01-18 09:19:28 +00:00
|
|
|
void ConfigurationClearValue(struct Configuration*, const char* section, const char* key);
|
|
|
|
|
2014-11-01 10:02:40 +00:00
|
|
|
bool ConfigurationRead(struct Configuration*, const char* path);
|
2015-11-02 02:41:24 +00:00
|
|
|
bool ConfigurationReadVFile(struct Configuration*, struct VFile* vf);
|
2014-11-01 10:02:40 +00:00
|
|
|
bool ConfigurationWrite(const struct Configuration*, const char* path);
|
|
|
|
bool ConfigurationWriteSection(const struct Configuration*, const char* path, const char* section);
|
2020-12-09 03:31:01 +00:00
|
|
|
bool ConfigurationWriteVFile(const struct Configuration*, struct VFile* vf);
|
2014-11-01 10:02:40 +00:00
|
|
|
|
2015-11-09 01:09:53 +00:00
|
|
|
void ConfigurationEnumerateSections(const struct Configuration* configuration, void (*handler)(const char* sectionName, void* user), void* user);
|
2017-03-06 01:23:08 +00:00
|
|
|
void ConfigurationEnumerate(const struct Configuration* configuration, const char* section, void (*handler)(const char* key, const char* value, void* user), void* user);
|
2015-11-09 01:09:53 +00:00
|
|
|
|
2016-12-27 05:01:55 +00:00
|
|
|
CXX_GUARD_END
|
|
|
|
|
2014-11-01 10:02:40 +00:00
|
|
|
#endif
|