diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-09-02 11:15:58 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-09-02 11:15:58 -0500 |
commit | 63493709a92c76169ad065cc3804b13dbd786537 (patch) | |
tree | 10e5ee05388699cc9ba5aed39ed3e41106f7ebd1 | |
parent | d3732ff1a0d149544f89d08fa489e4f0fca8da07 (diff) | |
download | ayatana-indicator-datetime-63493709a92c76169ad065cc3804b13dbd786537.tar.gz ayatana-indicator-datetime-63493709a92c76169ad065cc3804b13dbd786537.tar.bz2 ayatana-indicator-datetime-63493709a92c76169ad065cc3804b13dbd786537.zip |
add planner.cpp to the build
-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); } |