-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiniParse.hpp
43 lines (32 loc) · 968 Bytes
/
iniParse.hpp
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
#pragma once
#include <string>
#include <string_view>
#include <vector>
// FIXME: this is not compliant with the freedesktop spec
// https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s03.html
class iniFile {
struct iniEntry {
std::string name, value;
iniEntry();
iniEntry(std::string_view name);
void clear();
void trim();
bool operator==(const iniEntry& other) const;
bool operator!=(const iniEntry& other) const;
};
struct iniSection {
std::string section;
std::vector<iniEntry> entries;
iniSection();
iniSection(std::string_view section);
void clear();
bool operator==(const iniSection& other) const;
bool operator!=(const iniSection& other) const;
};
std::vector<iniSection> sections;
std::vector<iniSection> parseFile(std::string_view path);
public:
iniFile(std::string_view path);
std::vector<iniSection>::const_iterator begin() const;
std::vector<iniSection>::const_iterator end() const;
};