Changeset View
Changeset View
Standalone View
Standalone View
src/confoption.h
Show All 16 Lines | |||||
17 | 17 | | |||
18 | #ifndef CONFOPTION_H | 18 | #ifndef CONFOPTION_H | ||
19 | #define CONFOPTION_H | 19 | #define CONFOPTION_H | ||
20 | 20 | | |||
21 | #include <QStringList> | 21 | #include <QStringList> | ||
22 | #include <QVariant> | 22 | #include <QVariant> | ||
23 | #include "kcm-systemd-features.h" | 23 | #include "kcm-systemd-features.h" | ||
24 | 24 | | |||
25 | #if defined(HAVE_CXX11_CHRONO) | | |||
26 | #include <ratio> | 25 | #include <ratio> | ||
27 | #include <chrono> | 26 | #include <chrono> | ||
28 | 27 | | |||
29 | namespace ratio = std; | 28 | namespace ratio = std; | ||
30 | namespace chrono = std::chrono; | 29 | namespace chrono = std::chrono; | ||
svuorela: These two namespace things mostly looks like a way to make the other half of the ifdef work. | |||||
31 | #else | | |||
32 | #include <boost/ratio.hpp> | | |||
33 | #include <boost/chrono.hpp> | | |||
34 | | ||||
35 | namespace ratio = boost; | | |||
36 | namespace chrono = boost::chrono; | | |||
37 | #endif | | |||
38 | 30 | | |||
39 | enum settingType | 31 | enum settingType | ||
40 | { | 32 | { | ||
41 | BOOL, TIME, INTEGER, STRING, LIST, MULTILIST, RESLIMIT, SIZE | 33 | BOOL, TIME, INTEGER, STRING, LIST, MULTILIST, RESLIMIT, SIZE | ||
42 | }; | 34 | }; | ||
43 | 35 | | |||
44 | enum confFile | 36 | enum confFile | ||
45 | { | 37 | { | ||
46 | SYSTEMD, JOURNALD, LOGIND, COREDUMP | 38 | SYSTEMD, JOURNALD, LOGIND, COREDUMP | ||
47 | }; | 39 | }; | ||
48 | 40 | | |||
49 | class confOption { | 41 | class confOption { | ||
50 | 42 | | |||
51 | public: | 43 | public: | ||
52 | typedef chrono::duration<double, ratio::nano > nanoseconds; | 44 | typedef chrono::duration<double, ratio::nano > nanoseconds; | ||
53 | typedef chrono::duration<double, ratio::micro > microseconds; | 45 | typedef chrono::duration<double, ratio::micro > microseconds; | ||
54 | typedef chrono::duration<double, ratio::milli > milliseconds; | 46 | typedef chrono::duration<double, ratio::milli > milliseconds; | ||
55 | typedef chrono::duration<double> seconds; | 47 | typedef chrono::duration<double> seconds; | ||
56 | typedef chrono::duration<double, ratio::ratio<60, 1> > minutes; | 48 | typedef chrono::duration<double, ratio::ratio<60, 1> > minutes; | ||
57 | typedef chrono::duration<double, ratio::ratio<3600, 1> > hours; | 49 | typedef chrono::duration<double, ratio::ratio<3600, 1> > hours; | ||
svuorela: All these exists in c++11 standard, no need to do them again. | |||||
58 | typedef chrono::duration<double, ratio::ratio<86400, 1> > days; | 50 | typedef chrono::duration<double, ratio::ratio<86400, 1> > days; | ||
59 | typedef chrono::duration<double, ratio::ratio<604800, 1> > weeks; | 51 | typedef chrono::duration<double, ratio::ratio<604800, 1> > weeks; | ||
60 | typedef chrono::duration<double, ratio::ratio<2629800, 1> > months; // define a month as 30.4375days | 52 | typedef chrono::duration<double, ratio::ratio<2629800, 1> > months; // define a month as 30.4375days | ||
61 | typedef chrono::duration<double, ratio::ratio<29030400, 1> > years; | 53 | typedef chrono::duration<double, ratio::ratio<29030400, 1> > years; | ||
62 | typedef enum timeUnit { ns, us, ms, s, min, h, d, w, month, year } timeUnit; | 54 | typedef enum timeUnit { ns, us, ms, s, min, h, d, w, month, year } timeUnit; | ||
63 | 55 | | |||
64 | confFile file; | 56 | confFile file; | ||
65 | settingType type; | 57 | settingType type; | ||
Show All 29 Lines |
These two namespace things mostly looks like a way to make the other half of the ifdef work.