-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsumption.h
58 lines (38 loc) · 1.23 KB
/
consumption.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
#pragma once
#ifndef EL_CONSUMPTION_H_INCLUDED
# define EL_CONSUMPTION_H_INCLUDED
#include "record.h"
#include <QDateTime>
#include <QVector>
namespace El {
class App;
/// Container class for consumption records
class Consumption {
public:
/// Ctor
/// @param[in] app Application instance
Consumption(App const &app);
/// Dtor
~Consumption();
/// Loads records from the given CSV file
/// @param[in] filename Name of the CSV file
/// @return True when succeeded, otherwise false
auto load(QString const &filename) -> bool;
/// Returns consumption records
auto records() const noexcept -> auto const & { return _records; }
/// Returns the time of the first record
auto first_record_time() const noexcept -> auto const & { return _first_record_time; }
/// Returns the time of the last record
auto last_record_time() const noexcept -> auto const & { return _last_record_time; }
private:
/// Application instance
App const &_app;
/// Consumption records
QVector<Record> _records;
/// Time of the first consumption record
QDateTime _first_record_time;
/// Time of the last consumption record
QDateTime _last_record_time;
};
} // namespace El
#endif