diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 597e89840..e92e6b1c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,7 +17,6 @@ set (task_SRCS API.cpp API.h Duration.cpp Duration.h Expression.cpp Expression.h File.cpp File.h - Filter.cpp Filter.h Hooks.cpp Hooks.h JSON.cpp JSON.h Lexer.cpp Lexer.h @@ -26,7 +25,6 @@ set (task_SRCS API.cpp API.h Path.cpp Path.h Permission.cpp Permission.h Record.cpp Record.h - Sequence.cpp Sequence.h TDB.cpp TDB.h TDB2.cpp TDB2.h Task.cpp Task.h diff --git a/src/Context.cpp b/src/Context.cpp index ca94b1e68..57a687a5d 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -450,118 +450,6 @@ void Context::clear () clearMessages (); } -//////////////////////////////////////////////////////////////////////////////// -// Add all the attributes in the task to the filter. All except uuid. -/* -void Context::autoFilter (Att& a, Filter& f) -{ - // Words are found in the description using the .has modifier. - if (a.name () == "description" && a.mod () == "") - { - std::vector words; - split (words, a.value (), ' '); - std::vector ::iterator word; - for (word = words.begin (); word != words.end (); ++word) - { - f.push_back (Att ("description", "has", *word)); - debug ("auto filter: " + a.name () + ".has:" + *word); - } - } - - // Projects are matched left-most. - else if (a.name () == "project" && (a.mod () == "" || a.mod () == "not")) - { - if (a.value () != "") - { - if (a.mod () == "not") - { - f.push_back (Att ("project", "startswith", a.value (), "negative")); - debug ("auto filter: " + a.name () + ".~startswith:" + a.value ()); - } - else - { - f.push_back (Att ("project", "startswith", a.value ())); - debug ("auto filter: " + a.name () + ".startswith:" + a.value ()); - } - } - else - { - f.push_back (Att ("project", "is", a.value ())); - debug ("auto filter: " + a.name () + ".is:" + a.value ()); - } - } - - // Recurrence periods are matched left-most. - else if (a.name () == "recur" && a.mod () == "") - { - if (a.value () != "") - { - f.push_back (Att ("recur", "startswith", a.value ())); - debug ("auto filter: " + a.name () + ".startswith:" + a.value ()); - } - else - { - f.push_back (Att ("recur", "is", a.value ())); - debug ("auto filter: " + a.name () + ".is:" + a.value ()); - } - } - - // The limit attribute does not participate in filtering, and needs to be - // specifically handled in handleCustomReport. - else if (a.name () == "limit") - { - } - - // Every task has a unique uuid by default, and it shouldn't be included, - // because it is guaranteed to not match. - else if (a.name () == "uuid") - { - } - - // Note: Tags are handled via the +/- syntax, but also via attribute - // modifiers. - - // Generic attribute matching. - else - { - f.push_back (a); - debug ("auto filter: " + - a.name () + - (a.mod () != "" ? - ("." + a.mod () + ":") : - ":") + - a.value ()); - } -} -*/ - -//////////////////////////////////////////////////////////////////////////////// -// Add all the tags in the task to the filter. -/* -void Context::autoFilter (Filter& f) -{ - // This is now a correct implementation of a filter on the presence or absence - // of a tag. The prior code provided the illusion of leftmost partial tag - // matches, but was really using the 'contains' and 'nocontains' attribute - // modifiers. See bug #293. - - // Include tagAdditions. - std::vector ::iterator tag; - for (tag = tagAdditions.begin (); tag != tagAdditions.end (); ++tag) - { - f.push_back (Att ("tags", "word", *tag)); - debug ("auto filter: +" + *tag); - } - - // Include tagRemovals. - for (tag = tagRemovals.begin (); tag != tagRemovals.end (); ++tag) - { - f.push_back (Att ("tags", "noword", *tag)); - debug ("auto filter: -" + *tag); - } -} -*/ - //////////////////////////////////////////////////////////////////////////////// // This capability is to answer the question of 'what did I just do to generate // this output?'. diff --git a/src/Context.h b/src/Context.h index 9c087ca49..b3e08518c 100644 --- a/src/Context.h +++ b/src/Context.h @@ -30,9 +30,7 @@ #include #include -#include #include -#include #include #include #include @@ -77,8 +75,6 @@ private: void determineDataLocation (); void createDefaultConfig (); void loadAliases (); -// void autoFilter (Att&, Filter&); -// void autoFilter (Filter&); void updateXtermTitle (); public: diff --git a/src/Expression.cpp b/src/Expression.cpp index e71468b70..cf1c6041b 100644 --- a/src/Expression.cpp +++ b/src/Expression.cpp @@ -52,17 +52,12 @@ Expression::Expression (Arguments& arguments) context.debug ("Filter --> old"); expand_sequence (); - - if (new_style) - { - implicit_and (); - expand_tag (); - expand_pattern (); - expand_attr (); - expand_attmod (); - expand_word (); - } - + implicit_and (); + expand_tag (); + expand_pattern (); + expand_attr (); + expand_attmod (); + expand_word (); expand_tokens (); postfix (); } @@ -82,24 +77,111 @@ bool Expression::eval (Task& task) { if (arg->second == "op") { + // We already know it's an operator, but we need to know more. Or do we? +/* char type; int precedence; char associativity; Arguments::is_operator (arg->first, type, precedence, associativity); +*/ + // TODO Need helpers that pop, and error out if necessary. if (arg->first == "+") { - // TODO pop - // TODO pop - // TODO add the operators - // TODO push the result + // TODO This needs to be type-aware. + Variant right (value_stack.back ()); + value_stack.pop_back (); + Variant left (value_stack.back ()); + value_stack.pop_back (); + + left = left + right; + + value_stack.push_back (left); } -/* + else if (arg->first == "and") + { + } + + else if (arg->first == "xor") + { + } + + else if (arg->first == "or") + { + } + + else if (arg->first == "<=") + { + } + + else if (arg->first == ">=") + { + } + + else if (arg->first == "!~") + { + } + + else if (arg->first == "!=") + { + } + + else if (arg->first == "=") + { + } + + else if (arg->first == "^") + { + } + + else if (arg->first == ">") + { + } + + else if (arg->first == "~") + { + } + + else if (arg->first == "!") + { + } + + else if (arg->first == "*") + { + } + + else if (arg->first == "/") + { + } + + else if (arg->first == "%") + { + } + + else if (arg->first == "+") + { + } + + else if (arg->first == "-") + { + } + + else if (arg->first == "<") + { + } + + else if (arg->first == "(") + { + } + + else if (arg->first == ")") + { + } + else throw std::string ("Unsupported operator '") + arg->first + "'."; -*/ } /* else @@ -107,6 +189,7 @@ bool Expression::eval (Task& task) */ } + // TODO Any more values on stack? Error. // TODO Return the value that is on the stack. return false; } diff --git a/src/Filter.cpp b/src/Filter.cpp deleted file mode 100644 index 0288351bd..000000000 --- a/src/Filter.cpp +++ /dev/null @@ -1,155 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -// All rights reserved. -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 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, write to the -// -// Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, -// Boston, MA -// 02110-1301 -// USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -// For every Att in the filter, lookup the equivalent in Record, and perform a -// match. Aren't filters easy now that everything is an attribute? -bool Filter::pass (const Record& record) const -{ - Record::const_iterator r; - - // First do description/annotation matches. - foreach (att, (*this)) - { - // Descriptions have special handling such that they are linked to - // annotations, and filtering on description implies identical filtering - // on annotations. - // - // For positive modifiers (has, is ...) either the description or the - // annotation filter must succeed. - // - // For negative modifiers (hasnt, isnt ...) both the description and the - // annotation filter must succeed. - if (att->name () == "description") - { - bool pass = true; - int annotation_pass_count = 0; - int annotation_fail_count = 0; - - if ((r = record.find (att->name ())) != record.end ()) - { - pass = att->match (r->second); - - foreach (ra, record) - { - if (ra->first.length () > 11 && - ra->first.substr (0, 11) == "annotation_") - { - if (att->match (ra->second)) - ++annotation_pass_count; - else - ++annotation_fail_count; - } - } - } - - // Missing attribute implies failure. - else if (! att->match (Att ())) - return false; - - // This innocuous little if-else took significantly more thinking and - // debugging than anything else in task. Only change this code if you - // are willing to invest a week understanding and testing it. - if (att->modType (att->mod ()) == "positive") - { - if (! att->logicSense (pass || annotation_pass_count)) - return false; - } - else - { - if (! att->logicSense (pass && annotation_fail_count == 0)) - return false; - } - } - - // Annotations are skipped, because they are handled above. - else if (att->name ().length () > 11 && - att->name ().substr (0, 11) == "annotation_") - { - } - - else - { - // An individual attribute match failure is enough to fail the filter. - if ((r = record.find (att->name ())) != record.end ()) - { - if (! att->logicSense (att->match (r->second))) - return false; - } - else if (! att->match (Att ())) - return false; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -void Filter::applySequence (std::vector& all, Sequence& sequence) -{ - std::vector filtered; - foreach (task, all) - foreach (i, sequence) - if (task->id == *i) - filtered.push_back (*task); - - if (sequence.size () != filtered.size ()) - { - std::vector filteredSequence; - foreach (task, filtered) - filteredSequence.push_back (task->id); - - std::vector left; - std::vector right; - listDiff (filteredSequence, (std::vector &)sequence, left, right); - if (left.size ()) - throw std::string ("Sequence filtering error - please report this error to support@taskwarrior.org."); - - if (right.size ()) - { - std::stringstream out; - out << "Task"; - - if (right.size () > 1) out << "s"; - - foreach (r, right) - out << " " << *r; - - out << " not found."; - throw out.str (); - } - } - - all = filtered; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Filter.h b/src/Filter.h deleted file mode 100644 index b7567d08b..000000000 --- a/src/Filter.h +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -// All rights reserved. -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 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, write to the -// -// Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, -// Boston, MA -// 02110-1301 -// USA -// -//////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDED_FILTER -#define INCLUDED_FILTER -#define L10N // Localization complete. - -#include -#include -#include -#include - -class Filter : public std::vector -{ -public: - bool pass (const Record&) const; - void applySequence (std::vector&, Sequence&); -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Sequence.cpp b/src/Sequence.cpp deleted file mode 100644 index 95c2addf2..000000000 --- a/src/Sequence.cpp +++ /dev/null @@ -1,161 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -// All rights reserved. -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 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, write to the -// -// Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, -// Boston, MA -// 02110-1301 -// USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include -#include -#include - -extern Context context; - -//////////////////////////////////////////////////////////////////////////////// -Sequence::Sequence () -{ -} - -//////////////////////////////////////////////////////////////////////////////// -Sequence::Sequence (const std::string& input) -{ - parse (input); -} - -//////////////////////////////////////////////////////////////////////////////// -Sequence::~Sequence () -{ -} - -//////////////////////////////////////////////////////////////////////////////// -bool Sequence::valid (const std::string& input) const -{ - std::vector ranges; - split (ranges, input, ','); - - std::vector ::iterator it; - for (it = ranges.begin (); it != ranges.end (); ++it) - { - std::vector range; - split (range, *it, '-'); - - if (range.size () < 1 || - range.size () > 2) - return false; - - if (range.size () <= 2 && !validId (range[0])) - return false; - - if (range.size () == 2 && !validId (range[1])) - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -void Sequence::parse (const std::string& input) -{ - std::vector ranges; - split (ranges, input, ','); - - std::vector ::iterator it; - for (it = ranges.begin (); it != ranges.end (); ++it) - { - std::vector range; - split (range, *it, '-'); - - switch (range.size ()) - { - case 1: - { - if (! validId (range[0])) - throw std::string ("Invalid ID in sequence."); - - int id = strtol (range[0].c_str (), NULL, 10); - this->push_back (id); - } - break; - - case 2: - { - if (! validId (range[0]) || - ! validId (range[1])) - throw std::string ("Invalid ID in range."); - - int low = strtol (range[0].c_str (), NULL, 10); - int high = strtol (range[1].c_str (), NULL, 10); - if (low > high) - throw std::string ("Inverted sequence range high-low."); - - if (high - low >= SEQUENCE_MAX) - throw std::string ("ID Range too large."); - - for (int i = low; i <= high; ++i) - this->push_back (i); - } - break; - - default: - throw std::string ("Not a sequence."); - break; - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -void Sequence::combine (const Sequence& other) -{ - // Create a map using the sequence elements as keys. This will create a - // unique list, with no duplicates. - std::map both; - std::vector ::iterator i1; - for (i1 = this->begin (); i1 != this->end (); ++i1) both[*i1] = 0; - - std::vector ::const_iterator i2; - for (i2 = other.begin (); i2 != other.end (); ++i2) both[*i2] = 0; - - // Now make a sequence out of the keys of the map. - this->clear (); - std::map ::iterator i3; - for (i3 = both.begin (); i3 != both.end (); ++i3) - this->push_back (i3->first); - - std::sort (this->begin (), this->end ()); -} - -//////////////////////////////////////////////////////////////////////////////// -bool Sequence::validId (const std::string& input) const -{ - if (input.length () == 0) - return false; - - return digitsOnly (input); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Sequence.h b/src/Sequence.h deleted file mode 100644 index 57ccb0f9c..000000000 --- a/src/Sequence.h +++ /dev/null @@ -1,52 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez. -// All rights reserved. -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 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, write to the -// -// Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, -// Boston, MA -// 02110-1301 -// USA -// -//////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDED_SEQUENCE -#define INCLUDED_SEQUENCE -#define L10N // Localization complete. - -#include -#include - -#define SEQUENCE_MAX 1000 - -class Sequence : public std::vector -{ -public: - Sequence (); // Default constructor - Sequence (const std::string&); // Parse - ~Sequence (); // Destructor - - bool valid (const std::string&) const; - void parse (const std::string&); - void combine (const Sequence&); - -private: - bool validId (const std::string&) const; -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/TDB.cpp b/src/TDB.cpp index 831f3b44f..b88b3b909 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -124,9 +124,8 @@ void readTaskmods (std::vector &input, // | | open // | | [lock] // | | -// | | +- TDB::load (Filter) +// | | +- TDB::load // | | | read all -// | | | apply filter // | | | return subset // | | | // | | +- TDB::add (T) @@ -238,12 +237,13 @@ void TDB::unlock () // Returns number of filtered tasks. // Note: tasks.clear () is deliberately not called, to allow the combination of // multiple files. -int TDB::load (std::vector & tasks, Filter& filter) +int TDB::load (std::vector & tasks) { // Special optimization: if the filter contains Att ('status', '', 'pending'), // and no other 'status' filters, then loadCompleted can be skipped. int numberStatusClauses = 0; int numberSimpleStatusClauses = 0; +/* foreach (att, filter) { if (att->name () == "status") @@ -256,12 +256,13 @@ int TDB::load (std::vector & tasks, Filter& filter) ++numberSimpleStatusClauses; } } +*/ - loadPending (tasks, filter); + loadPending (tasks); if (numberStatusClauses == 0 || numberStatusClauses != numberSimpleStatusClauses) - loadCompleted (tasks, filter); + loadCompleted (tasks); else context.debug ("load optimization short circuit"); @@ -272,7 +273,7 @@ int TDB::load (std::vector & tasks, Filter& filter) // Returns number of filtered tasks. // Note: tasks.clear () is deliberately not called, to allow the combination of // multiple files. -int TDB::loadPending (std::vector & tasks, Filter& filter) +int TDB::loadPending (std::vector & tasks) { Timer t ("TDB::loadPending"); @@ -316,6 +317,7 @@ int TDB::loadPending (std::vector & tasks, Filter& filter) } // Now filter and return. +/* if (filter.size ()) { foreach (task, mPending) @@ -323,6 +325,7 @@ int TDB::loadPending (std::vector & tasks, Filter& filter) tasks.push_back (*task); } else +*/ { foreach (task, mPending) tasks.push_back (*task); @@ -331,6 +334,7 @@ int TDB::loadPending (std::vector & tasks, Filter& filter) // Hand back any accumulated additions, if TDB::loadPending is being called // repeatedly. int fakeId = mId; +/* if (filter.size ()) { foreach (task, mNew) @@ -341,6 +345,7 @@ int TDB::loadPending (std::vector & tasks, Filter& filter) } } else +*/ { foreach (task, mNew) { @@ -364,7 +369,7 @@ int TDB::loadPending (std::vector & tasks, Filter& filter) // Returns number of filtered tasks. // Note: tasks.clear () is deliberately not called, to allow the combination of // multiple files. -int TDB::loadCompleted (std::vector & tasks, Filter& filter) +int TDB::loadCompleted (std::vector & tasks) { Timer t ("TDB::loadCompleted"); @@ -401,6 +406,7 @@ int TDB::loadCompleted (std::vector & tasks, Filter& filter) } // Now filter and return. +/* if (filter.size ()) { foreach (task, mCompleted) @@ -408,6 +414,7 @@ int TDB::loadCompleted (std::vector & tasks, Filter& filter) tasks.push_back (*task); } else +*/ { foreach (task, mCompleted) tasks.push_back (*task); @@ -599,9 +606,8 @@ int TDB::gc () lock (); - Filter filter; std::vector ignore; - loadPending (ignore, filter); + loadPending (ignore); // Search for dangling dependencies. These are dependencies whose uuid cannot // be converted to an id by TDB. diff --git a/src/TDB.h b/src/TDB.h index 494d0074f..4bb9d92d6 100644 --- a/src/TDB.h +++ b/src/TDB.h @@ -32,7 +32,6 @@ #include #include #include -#include #include // Length of longest line. @@ -53,9 +52,9 @@ public: void lock (bool lockFile = true); void unlock (); - int load (std::vector &, Filter&); - int loadPending (std::vector &, Filter&); - int loadCompleted (std::vector &, Filter&); + int load (std::vector &); + int loadPending (std::vector &); + int loadCompleted (std::vector &); const std::vector & getAllPending (); const std::vector & getAllNew (); diff --git a/src/TDB2.cpp b/src/TDB2.cpp index f8b8f2f89..8b1b68ec7 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -368,7 +368,7 @@ void readTaskmods (std::vector &input, // | | open // | | [lock] // | | -// | | +- TDB::load (Filter) +// | | +- TDB::load // | | | read all // | | | apply filter // | | | return subset diff --git a/src/Task.h b/src/Task.h index eb45ccf7f..b460fe277 100644 --- a/src/Task.h +++ b/src/Task.h @@ -30,7 +30,6 @@ #include #include -#include class Task : public Record { diff --git a/src/Variant.cpp b/src/Variant.cpp index 1000f647e..c4eb03abb 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -343,13 +343,12 @@ Variant& Variant::operator- (const Variant& other) break; case v_date: - // TODO operator-= only takes integers. - //mDate -= other.mDate; + mDuration = Duration (mDate - other.mDate); + mType = v_duration; break; case v_duration: - // TODO Missing operator -= - //mDuration -= other.mDuration; + mDuration = mDuration - other.mDuration; break; case v_unknown: diff --git a/src/commands/CmdBurndown.cpp b/src/commands/CmdBurndown.cpp index b75d472c0..297584c36 100644 --- a/src/commands/CmdBurndown.cpp +++ b/src/commands/CmdBurndown.cpp @@ -987,8 +987,7 @@ int CmdBurndownMonthly::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -1038,8 +1037,7 @@ int CmdBurndownWeekly::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -1089,8 +1087,7 @@ int CmdBurndownDaily::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index 7231317a9..889a9b35f 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -65,10 +65,9 @@ int CmdCalendar::execute (std::string& output) // Get all the tasks. std::vector tasks; - Filter filter; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 76c314314..14b18c8db 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -88,8 +88,7 @@ int CmdCustom::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; // Blank - context.tdb.load (tasks, filter); // No filter. + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdHistory.cpp b/src/commands/CmdHistory.cpp index e0ec5c679..58a810f69 100644 --- a/src/commands/CmdHistory.cpp +++ b/src/commands/CmdHistory.cpp @@ -59,8 +59,7 @@ int CmdHistoryMonthly::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -225,8 +224,7 @@ int CmdHistoryAnnual::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -388,8 +386,7 @@ int CmdGHistoryMonthly::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -594,8 +591,7 @@ int CmdGHistoryAnnual::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdIDs.cpp b/src/commands/CmdIDs.cpp index ee9f67dc4..cb8cf640a 100644 --- a/src/commands/CmdIDs.cpp +++ b/src/commands/CmdIDs.cpp @@ -52,8 +52,7 @@ int CmdIDs::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -93,8 +92,7 @@ int CmdCompletionIds::execute (std::string& output) { std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); - Filter filter; - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -140,8 +138,7 @@ int CmdZshCompletionIds::execute (std::string& output) { std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); - Filter filter; - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index 3d0d462ee..3ad3723ba 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -1178,8 +1178,7 @@ std::string CmdImport::YAML (const std::vector & lines) // Load all the tasks so that the uuid uniqueness can be checked. std::vector tasks; - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); Task t; diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 799be917a..2e89d8518 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -56,8 +56,7 @@ int CmdInfo::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdQuery.cpp b/src/commands/CmdQuery.cpp index 53b6c00fb..20ee60ca0 100644 --- a/src/commands/CmdQuery.cpp +++ b/src/commands/CmdQuery.cpp @@ -51,8 +51,7 @@ int CmdQuery::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdStatistics.cpp b/src/commands/CmdStatistics.cpp index 6204dec61..be60f76d9 100644 --- a/src/commands/CmdStatistics.cpp +++ b/src/commands/CmdStatistics.cpp @@ -80,8 +80,7 @@ int CmdStatistics::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdSummary.cpp b/src/commands/CmdSummary.cpp index abf50c946..8543f69a9 100644 --- a/src/commands/CmdSummary.cpp +++ b/src/commands/CmdSummary.cpp @@ -59,8 +59,7 @@ int CmdSummary::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdTags.cpp b/src/commands/CmdTags.cpp index bd8d86d28..eeb3e743a 100644 --- a/src/commands/CmdTags.cpp +++ b/src/commands/CmdTags.cpp @@ -55,11 +55,10 @@ int CmdTags::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); int quantity = 0; - Filter filter; if (context.config.getBoolean ("list.all.tags")) - quantity += context.tdb.load (tasks, filter); + quantity += context.tdb.load (tasks); else - quantity += context.tdb.loadPending (tasks, filter); + quantity += context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); @@ -147,11 +146,10 @@ int CmdCompletionTags::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); - Filter filter; if (context.config.getBoolean ("complete.all.tags")) - context.tdb.load (tasks, filter); + context.tdb.load (tasks); else - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdTimesheet.cpp b/src/commands/CmdTimesheet.cpp index bd2194fef..efe2f5469 100644 --- a/src/commands/CmdTimesheet.cpp +++ b/src/commands/CmdTimesheet.cpp @@ -55,8 +55,7 @@ int CmdTimesheet::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.load (tasks, filter); + context.tdb.load (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/commands/CmdUrgency.cpp b/src/commands/CmdUrgency.cpp index eab8ca5cd..35e593e8f 100644 --- a/src/commands/CmdUrgency.cpp +++ b/src/commands/CmdUrgency.cpp @@ -51,8 +51,7 @@ int CmdUrgency::execute (std::string& output) std::vector tasks; context.tdb.lock (context.config.getBoolean ("locking")); handleRecurrence (); - Filter filter; - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); context.tdb.commit (); context.tdb.unlock (); diff --git a/src/helpers.cpp b/src/helpers.cpp index 411b28a9b..87f82d061 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -133,8 +133,7 @@ std::string onProjectChange (Task& task, bool scope /* = true */) int count_done = 0; std::vector all; - Filter filter; - context.tdb.load (all, filter); + context.tdb.load (all); countTasks (all, project, context.tdb.getAllModified (), count_pending, count_done); countTasks (context.tdb.getAllModified (), project, (std::vector ) NULL, count_pending, count_done); diff --git a/src/recur.cpp b/src/recur.cpp index 229a0fa21..1e185a25b 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -53,8 +53,7 @@ extern Context context; void handleRecurrence () { std::vector tasks; - Filter filter; - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); std::vector modified; @@ -441,10 +440,9 @@ bool nag (Task& task) { // Load all pending tasks. std::vector tasks; - Filter filter; // Piggy-back on existing locked TDB. - context.tdb.loadPending (tasks, filter); + context.tdb.loadPending (tasks); // Counters. int overdue = 0;