forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfg.h
50 lines (37 loc) · 1.47 KB
/
cfg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Aseprite Config Library
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2014-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef CFG_CFG_H_INCLUDED
#define CFG_CFG_H_INCLUDED
#pragma once
#include <string>
#include <vector>
namespace cfg {
class CfgFile {
public:
CfgFile();
~CfgFile();
const std::string& filename() const;
void getAllSections(std::vector<std::string>& sections) const;
void getAllKeys(const char* section, std::vector<std::string>& keys) const;
const char* getValue(const char* section, const char* name, const char* defaultValue) const;
bool getBoolValue(const char* section, const char* name, bool defaultValue);
int getIntValue(const char* section, const char* name, int defaultValue);
double getDoubleValue(const char* section, const char* name, double defaultValue);
void setValue(const char* section, const char* name, const char* value);
void setBoolValue(const char* section, const char* name, bool value);
void setIntValue(const char* section, const char* name, int value);
void setDoubleValue(const char* section, const char* name, double value);
void deleteValue(const char* section, const char* name);
void deleteSection(const char* section);
bool load(const std::string& filename);
void save();
private:
class CfgFileImpl;
CfgFileImpl* m_impl;
};
} // namespace cfg
#endif