aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-12-17 22:03:12 -0600
committerCharles Kerr <charles.kerr@canonical.com>2013-12-17 22:03:12 -0600
commit38b878589ffb08d2272169d2529703e887933be9 (patch)
treef4d9815de26bebcfaacc1d092ad4be58f7cea6d7 /include
parent172246c997d7b20d7e98fc25a7b23f4a79a0f6a6 (diff)
downloadayatana-indicator-datetime-38b878589ffb08d2272169d2529703e887933be9.tar.gz
ayatana-indicator-datetime-38b878589ffb08d2272169d2529703e887933be9.tar.bz2
ayatana-indicator-datetime-38b878589ffb08d2272169d2529703e887933be9.zip
add planner + tests
Diffstat (limited to 'include')
-rw-r--r--include/datetime/planner-eds.h49
-rw-r--r--include/datetime/planner.h71
2 files changed, 120 insertions, 0 deletions
diff --git a/include/datetime/planner-eds.h b/include/datetime/planner-eds.h
new file mode 100644
index 0000000..43f222e
--- /dev/null
+++ b/include/datetime/planner-eds.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2013 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Charles Kerr <charles.kerr@canonical.com>
+ */
+
+#ifndef INDICATOR_DATETIME_PLANNER_EDS_H
+#define INDICATOR_DATETIME_PLANNER_EDS_H
+
+#include <datetime/planner.h>
+
+#include <memory> // unique_ptr
+
+namespace unity {
+namespace indicator {
+namespace datetime {
+
+/**
+ * \brief Planner which uses EDS as its backend
+ */
+class PlannerEds: public Planner
+{
+public:
+ PlannerEds();
+ virtual ~PlannerEds();
+
+private:
+ class Impl;
+ std::unique_ptr<Impl> impl_;
+};
+
+} // namespace datetime
+} // namespace indicator
+} // namespace unity
+
+#endif // INDICATOR_DATETIME_PLANNER_EDS_H
diff --git a/include/datetime/planner.h b/include/datetime/planner.h
new file mode 100644
index 0000000..4d27a2b
--- /dev/null
+++ b/include/datetime/planner.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Charles Kerr <charles.kerr@canonical.com>
+ */
+
+#ifndef INDICATOR_DATETIME_PLANNER_H
+#define INDICATOR_DATETIME_PLANNER_H
+
+#include <datetime/appointment.h>
+#include <datetime/date-time.h>
+
+#include <core/property.h>
+
+#include <vector>
+
+namespace unity {
+namespace indicator {
+namespace datetime {
+
+/**
+ * \brief Simple appointment book
+ */
+class Planner
+{
+public:
+ virtual ~Planner() =default;
+
+ /**
+ * \brief Timestamp used to determine the appointments in the `upcoming' and `thisMonth' properties.
+ * Setting this value will cause the planner to re-query its backend and
+ * update the `upcoming' and `thisMonth' properties.
+ */
+ core::Property<DateTime> time;
+
+ /**
+ * \brief The next few appointments that follow the time specified in the time property.
+ */
+ core::Property<std::vector<Appointment>> upcoming;
+
+ /**
+ * \brief The appointments that occur in the same month as the time property
+ */
+ core::Property<std::vector<Appointment>> thisMonth;
+
+protected:
+ Planner() =default;
+
+private:
+ Planner(const Planner&) =delete;
+ Planner& operator=(const Planner&) =delete;
+};
+
+} // namespace datetime
+} // namespace indicator
+} // namespace unity
+
+#endif // INDICATOR_DATETIME_PLANNER_H