diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2015-06-03 00:09:09 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2015-06-03 00:23:19 +0200 |
| commit | 41c45d4a4d6f8bea9b45d76ddef5d8bac71cfc5a (patch) | |
| tree | 70f5e4a20a7659529a48174a50ff24da92a01e44 /src/event.hh | |
| parent | 823dc403a9b56e00be4982d0082d30b8df5e53d6 (diff) | |
A start for an event handler
Diffstat (limited to 'src/event.hh')
| -rw-r--r-- | src/event.hh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/event.hh b/src/event.hh new file mode 100644 index 0000000..425a70f --- /dev/null +++ b/src/event.hh @@ -0,0 +1,51 @@ +#ifndef EVENT_HH +#define EVENT_HH + +#include <memory> +#include <set> +#include <string> +#include <vector> + +namespace stuff { + +class DB; + +class Event { +public: + virtual ~Event() {} + + virtual const std::string& name() const = 0; + virtual void set_name(const std::string& name) = 0; + + virtual const std::string& text() const = 0; + virtual void set_text(const std::string& text) = 0; + + virtual time_t start() const = 0; + virtual void set_start(time_t start) = 0; + + virtual void going(std::set<std::string>* going, + std::set<std::string>* not_going) const = 0; + virtual bool is_going(const std::string& name) const = 0; + + virtual void update_going(const std::string& name, bool going) = 0; + + virtual bool store() = 0; + + virtual bool remove() = 0; + + static bool setup(DB* db); + + static std::unique_ptr<Event> next(std::shared_ptr<DB> db); + static std::vector<std::unique_ptr<Event>> all(std::shared_ptr<DB> db); + static std::unique_ptr<Event> create(std::shared_ptr<DB> db, + const std::string& name, time_t start); + +protected: + Event() { } + Event(const Event&) = delete; + Event& operator=(const Event&) = delete; +}; + +} // namespace stuff + +#endif /* EVENT_HH */ |
