mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 15:47:19 +02:00
Code Cleanup
- Obsoleted Filter.{h,cpp}. - Obsoleted Sequence.{h,cpp}. - Eliminated Context::autoFilter. - Stubbed Expression::eval.
This commit is contained in:
parent
6b85669812
commit
f971fcd110
28 changed files with 148 additions and 616 deletions
112
src/Context.cpp
112
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 <std::string> words;
|
||||
split (words, a.value (), ' ');
|
||||
std::vector <std::string>::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 +/-<tag> 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 <std::string>::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?'.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue