From 38b878589ffb08d2272169d2529703e887933be9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 17 Dec 2013 22:03:12 -0600 Subject: add planner + tests --- include/datetime/planner-eds.h | 49 +++++++++++++++++++++++++++++ include/datetime/planner.h | 71 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 include/datetime/planner-eds.h create mode 100644 include/datetime/planner.h (limited to 'include') 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 . + * + * Authors: + * Charles Kerr + */ + +#ifndef INDICATOR_DATETIME_PLANNER_EDS_H +#define INDICATOR_DATETIME_PLANNER_EDS_H + +#include + +#include // 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_; +}; + +} // 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 . + * + * Authors: + * Charles Kerr + */ + +#ifndef INDICATOR_DATETIME_PLANNER_H +#define INDICATOR_DATETIME_PLANNER_H + +#include +#include + +#include + +#include + +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 time; + + /** + * \brief The next few appointments that follow the time specified in the time property. + */ + core::Property> upcoming; + + /** + * \brief The appointments that occur in the same month as the time property + */ + core::Property> 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 -- cgit v1.2.3