00001 #ifndef ERIS_CALENDAR_H
00002 #define ERIS_CALENDAR_H
00003
00004 #include <Eris/Types.h>
00005 #include <Atlas/Message/Element.h>
00006
00007 #include <sigc++/trackable.h>
00008 #include <sigc++/connection.h>
00009
00010 namespace Eris
00011 {
00012
00013 class Calendar;
00014
00018 class DateTime
00019 {
00020 public:
00021 DateTime() : m_valid(false) { }
00022
00023 bool valid() const { return m_valid; }
00024
00025 unsigned int year() const { return m_year; }
00026 unsigned int month() const { return m_month; }
00027 unsigned int dayOfMonth() const { return m_dayOfMonth; }
00028
00029 unsigned int seconds() const { return m_seconds; }
00030 unsigned int minutes() const { return m_minutes; }
00031 unsigned int hours() const { return m_hours; }
00032 private:
00033 friend class Calendar;
00034
00035 unsigned int m_year,
00036 m_month,
00037 m_dayOfMonth;
00038
00039 unsigned int m_seconds,
00040 m_minutes,
00041 m_hours;
00042
00043 bool m_valid;
00044 };
00045
00046 class Calendar : public sigc::trackable
00047 {
00048 public:
00049 Calendar(Avatar*);
00050
00051 DateTime now() const;
00052
00053 private:
00054 void topLevelEntityChanged();
00055 void calendarAttrChanged(const std::string&, const Atlas::Message::Element& value);
00056
00057 void initFromCalendarAttr(const Atlas::Message::MapType& cal);
00058
00059 Avatar* m_avatar;
00060
00061 unsigned int m_daysPerMonth,
00062 m_monthsPerYear,
00063 m_hoursPerDay,
00064 m_minutesPerHour,
00065 m_secondsPerMinute;
00066
00067 sigc::connection m_calendarObserver;
00068 };
00069
00070 }
00071
00072 #endif