diff options
-rw-r--r-- | include/datetime/planner.h | 5 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/planner.cpp | 10 |
3 files changed, 10 insertions, 6 deletions
diff --git a/include/datetime/planner.h b/include/datetime/planner.h index 43991ec..55e72e7 100644 --- a/include/datetime/planner.h +++ b/include/datetime/planner.h @@ -37,12 +37,11 @@ namespace datetime { class Planner { public: - virtual ~Planner() =default; - + virtual ~Planner(); virtual core::Property<std::vector<Appointment>>& appointments() =0; protected: - Planner() =default; + Planner(); static void sort(std::vector<Appointment>&); static void trim(std::vector<Appointment>&, const DateTime& begin, const DateTime& end); }; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2852a75..512cc5c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ set (SERVICE_CXX_SOURCES locations-settings.cpp menu.cpp notifications.cpp + planner.cpp planner-aggregate.cpp planner-snooze.cpp planner-month.cpp diff --git a/src/planner.cpp b/src/planner.cpp index 3f73030..15dab52 100644 --- a/src/planner.cpp +++ b/src/planner.cpp @@ -19,6 +19,8 @@ #include <datetime/planner.h> +#include <algorithm> + namespace unity { namespace indicator { namespace datetime { @@ -35,6 +37,7 @@ Planner::~Planner() { } +#if 0 void Planner::set_range_to_calendar_month(const DateTime& dt) { @@ -59,6 +62,7 @@ Planner::set_range_to_upcoming_month(const DateTime& begin) end.format(fmt).c_str()); range().set(std::make_pair(begin,end)); } +#endif void Planner::sort(std::vector<Appointment>& appts) @@ -73,9 +77,9 @@ Planner::trim(std::vector<Appointment>& appts, const DateTime& begin, const DateTime& end) { - decltype(appts) tmp; - auto predicate = [begin,end](const Appointment& a){return begin<=a.begin && a.begin<=end;} - std::copy(std::begin(appts), std::end(appts), std::back_inserter(tmp), predicate); + std::vector<Appointment> tmp; + auto predicate = [begin,end](const Appointment& a){return begin<=a.begin && a.begin<=end;}; + std::copy_if(std::begin(appts), std::end(appts), std::back_inserter(tmp), predicate); appts.swap(tmp); } |