]> git.stg.codes - stg.git/blob - include/stg/service_conf.h
Better handling of errors from server. Refactoring.
[stg.git] / include / stg / service_conf.h
1 #ifndef SERVICE_CONF_H
2 #define SERVICE_CONF_H
3
4 #include <string>
5
6 #include "os_int.h"
7
8 struct SERVICE_CONF
9 {
10 SERVICE_CONF()
11     : name(), comment(), cost(0), payDay(0)
12 {}
13 SERVICE_CONF(const std::string & n)
14     : name(n), comment(), cost(0), payDay(0)
15 {}
16 SERVICE_CONF(const std::string & n, double c)
17     : name(n), comment(), cost(c), payDay(0)
18 {}
19 SERVICE_CONF(const std::string & n, double c, unsigned p)
20     : name(n), comment(), cost(c), payDay(static_cast<uint8_t>(p))
21 {}
22 SERVICE_CONF(const std::string & n, double c,
23              unsigned p, const std::string & com)
24     : name(n), comment(com), cost(c), payDay(static_cast<uint8_t>(p))
25 {}
26
27 std::string name;
28 std::string comment;
29 double      cost;
30 uint8_t     payDay;
31 };
32
33 inline
34 bool operator==(const SERVICE_CONF & a, const SERVICE_CONF & b)
35 {
36 return a.name == b.name;
37 }
38
39 #endif //SERVICE_CONF_H
40