forked from jackburton79/ocs-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configuration.h
66 lines (48 loc) · 1.51 KB
/
Configuration.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Configuration.h
*
* Created on: 13/lug/2013
* Author: Stefano Ceccherini
*/
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include <map>
#include <string>
#define CONF_AGENT_STRING "agent-string"
#define CONF_NO_SOFTWARE "nosoftware"
#define CONF_OUTPUT_STDOUT "stdout"
#define CONF_WAIT_TIME "waittime"
#define CONF_VALUE_TRUE "true"
#define CONF_VALUE_FALSE "false"
class Configuration {
public:
static Configuration* Get();
bool Load(const char* fileName);
bool Save(const char* fileName);
bool Save();
void Print() const;
std::string ServerURL() const;
void SetServer(const char* serverUrl);
std::string OutputFileName() const;
void SetOutputFileName(const char* fileName);
void SetKeyValueBoolean(const char* key, bool value);
void SetVolatileKeyValueBoolean(const char* key, bool value);
bool KeyValueBoolean(const char* key) const;
void SetKeyValue(const char* key, const char* value);
void SetVolatileKeyValue(const char* key, const char* value);
std::string KeyValue(const char* key) const;
std::string DeviceID() const;
bool LocalInventory() const;
void SetUseCurrentTimeInDeviceID(bool use);
bool UseCurrentTimeInDeviceID() const;
private:
Configuration();
~Configuration();
void _GenerateDeviceID();
static std::string _BooleanToString(bool value);
static bool _StringToBoolean(const std::string& string);
std::map<std::string, std::string> fValues;
std::map<std::string, std::string> fVolatileValues;
std::string fConfigFileName;
};
#endif /* CONFIGURATION_H_ */