blob: 8151d6490bdf73b9ff8312d9fdf306f31c6fc2fb (
plain)
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
|
#ifndef EVENT_UTILS_HH
#define EVENT_UTILS_HH
#include <functional>
#include <memory>
#include <string>
namespace stuff {
class Config;
class Event;
class SenderClient;
class EventUtils {
public:
virtual ~EventUtils();
virtual std::unique_ptr<Event> create(
const std::string& name, time_t start) = 0;
virtual void created(Event* event) = 0;
virtual std::vector<std::unique_ptr<Event>> all() = 0;
virtual std::unique_ptr<Event> next() = 0;
virtual bool good() const = 0;
virtual void cancel(Event* event, size_t index) = 0;
virtual void updated(Event* event, int64_t was_first) = 0;
virtual void going(Event* event, bool going, const std::string& user,
const std::string& owner) = 0;
virtual const std::string& channel() const = 0;
static std::unique_ptr<EventUtils> create(
const std::string& channel,
std::function<void(const std::string&)> error_cb,
Config* config,
SenderClient* sender);
static const double ONE_DAY_IN_SEC;
static const double ONE_WEEK_IN_SEC;
static const double ONE_YEAR_IN_SEC;
static std::string format_date(time_t date);
protected:
EventUtils();
private:
EventUtils(const EventUtils&) = delete;
EventUtils& operator=(const EventUtils&) = delete;
};
} // namespace stuff
#endif /* EVENT_UTILS_HH */
|