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 ConfigurationWrite(const struct Configuration*, const char* path);
33bool ConfigurationWriteSection(const struct Configuration*, const char* path, const char* section);
34
35#endif