all repos — mgba @ daaa2fa5236df5e8976e7e0ba7ac39e0d9233422

mGBA Game Boy Advance Emulator

src/util/configuration.h (view raw)

 1/* Copyright (c) 2013-2014 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef CONFIGURATION_H
 7#define CONFIGURATION_H
 8
 9#include "util/table.h"
10
11struct VFile;
12
13struct Configuration {
14	struct Table sections;
15	struct Table root;
16};
17
18void ConfigurationInit(struct Configuration*);
19void ConfigurationDeinit(struct Configuration*);
20
21void ConfigurationSetValue(struct Configuration*, const char* section, const char* key, const char* value);
22void ConfigurationSetIntValue(struct Configuration*, const char* section, const char* key, int value);
23void ConfigurationSetUIntValue(struct Configuration*, const char* section, const char* key, unsigned value);
24void ConfigurationSetFloatValue(struct Configuration*, const char* section, const char* key, float value);
25
26bool ConfigurationHasSection(const struct Configuration*, const char* section);
27const char* ConfigurationGetValue(const struct Configuration*, const char* section, const char* key);
28
29void ConfigurationClearValue(struct Configuration*, const char* section, const char* key);
30
31bool ConfigurationRead(struct Configuration*, const char* path);
32bool ConfigurationReadVFile(struct Configuration*, struct VFile* vf);
33bool ConfigurationWrite(const struct Configuration*, const char* path);
34bool ConfigurationWriteSection(const struct Configuration*, const char* path, const char* section);
35
36void ConfigurationEnumerateSections(const struct Configuration* configuration, void (*handler)(const char* sectionName, void* user), void* user);
37
38#endif