Parent: [327004] (diff)

Download this file

config.h    36 lines (27 with data), 635 Bytes

 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
#ifndef _CONFIG_H
#define _CONFIG_H
enum ScrobblingService {
LastFm,
LibreFm
};
class CConfig
{
public:
CConfig(char* cfg);
ScrobblingService getService();
std::string Get(std::string name);
bool GetBool(std::string name);
int GetInt(std::string name);
void Set(std::string name, std::string value) { _configuration[name] = value; };
bool gotNecessaryData() {
if(!Get("username").size() || !Get("password").size())
return false;
return true;
}
void LoadConfig(std::string path);
private:
void ParseLine(std::string line);
std::map<std::string, std::string> _configuration;
};
extern CConfig* Config;
#endif