mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Task Refactoring
- Task is no longer a map of string to Att. Att is itself a name/ value pair, so the name was redundant. Task is now a map of string to string. This brings the obsoletion of Att much closer.
This commit is contained in:
parent
85e77c1958
commit
e2a8f85a2f
13 changed files with 120 additions and 128 deletions
|
@ -199,14 +199,14 @@ std::string CmdEdit::formatTask (Task task)
|
|||
<< "# The ' -- ' separator between the date and text field should not be removed.\n"
|
||||
<< "# A \"blank slot\" for adding an annotation follows for your convenience.\n";
|
||||
|
||||
std::vector <Att> annotations;
|
||||
std::map <std::string, std::string> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
std::vector <Att>::iterator anno;
|
||||
std::map <std::string, std::string>::iterator anno;
|
||||
for (anno = annotations.begin (); anno != annotations.end (); ++anno)
|
||||
{
|
||||
Date dt (strtol (anno->name ().substr (11).c_str (), NULL, 10));
|
||||
Date dt (strtol (anno->first.substr (11).c_str (), NULL, 10));
|
||||
before << " Annotation: " << dt.toString (context.config.get ("dateformat.annotation"))
|
||||
<< " -- " << anno->value () << "\n";
|
||||
<< " -- " << anno->second << "\n";
|
||||
}
|
||||
|
||||
Date now;
|
||||
|
@ -252,7 +252,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after)
|
|||
{
|
||||
if (value != "")
|
||||
{
|
||||
if (Att::validNameValue ("priority", "", value))
|
||||
if (context.columns["priority"]->validate (value))
|
||||
{
|
||||
context.footnote ("Priority modified.");
|
||||
task.set ("priority", value);
|
||||
|
@ -541,7 +541,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after)
|
|||
}
|
||||
|
||||
// Annotations
|
||||
std::vector <Att> annotations;
|
||||
std::map <std::string, std::string> annotations;
|
||||
std::string::size_type found = 0;
|
||||
while ((found = after.find ("\n Annotation:", found)) != std::string::npos)
|
||||
{
|
||||
|
@ -567,7 +567,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after)
|
|||
std::stringstream name;
|
||||
name << "annotation_" << when.toEpoch ();
|
||||
std::string text = trim (value.substr (gap + 4), "\t ");
|
||||
annotations.push_back (Att (name.str (), text));
|
||||
annotations.insert (std::make_pair (name.str (), text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue