eris 1.4.0
A WorldForge client library.
Calendar.h
1#ifndef ERIS_CALENDAR_H
2#define ERIS_CALENDAR_H
3
4#include <sigc++/trackable.h>
5#include <sigc++/connection.h>
6
7#include <map>
8#include <string>
9
10namespace Atlas
11{
12namespace Message
13{
14class Element;
15typedef std::map<std::string, Element> MapType;
16}
17}
18
19namespace Eris
20{
21
22class Avatar;
23class Calendar;
24
29{
30public:
31 DateTime() = default;
32
33 bool valid() const { return m_valid; }
34
35 int year() const { return m_year; }
36 int month() const { return m_month; }
37 int dayOfMonth() const { return m_dayOfMonth; }
38
39 int seconds() const { return m_seconds; }
40 int minutes() const { return m_minutes; }
41 int hours() const { return m_hours; }
42
43private:
44 friend class Calendar;
45
46 int m_year,
47 m_month,
48 m_dayOfMonth;
49
50 int m_seconds,
51 m_minutes,
52 m_hours;
53
54 bool m_valid;
55};
56
57class Calendar : public sigc::trackable
58{
59public:
60 explicit Calendar(Avatar&);
61
62 DateTime now() const;
63
64 int secondsPerMinute() const { return m_secondsPerMinute; }
65 int minutesPerHour() const { return m_minutesPerHour; }
66 int hoursPerDay() const { return m_hoursPerDay; }
67
69 sigc::signal<void> Updated;
70
71protected:
72 void topLevelEntityChanged();
73 void calendarAttrChanged(const Atlas::Message::Element& value);
74
75 void initFromCalendarAttr(const Atlas::Message::MapType& cal);
76
77 Avatar& m_avatar;
78
79 int m_daysPerMonth,
80 m_monthsPerYear,
81 m_hoursPerDay,
82 m_minutesPerHour,
83 m_secondsPerMinute;
84
85 sigc::connection m_calendarObserver;
86};
87
88} // of namespace Eris
89
90#endif
sigc::signal< void > Updated
Emitted when the calendar is updated.
Definition: Calendar.h:69
Definition: Account.cpp:33