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:
Paul Beckingham 2011-08-07 22:41:25 -04:00
parent 85e77c1958
commit e2a8f85a2f
13 changed files with 120 additions and 128 deletions

View file

@ -137,7 +137,7 @@ int CmdImport::execute (std::string& output)
// 'description' values and must be converted.
if (i->first == "annotations")
{
std::vector <Att> annos;
std::map <std::string, std::string> annos;
json::array* atts = (json::array*)i->second;
json_array_iter annotations;
@ -151,7 +151,7 @@ int CmdImport::execute (std::string& output)
std::string name = "annotation_" + Date (when->_data).toEpochString ();
annos.push_back (Att (name, what->_data));
annos.insert (std::make_pair (name, what->_data));
}
task.setAnnotations (annos);
@ -336,14 +336,14 @@ void CmdImport::decorateTask (Task& task)
std::string defaultPriority = context.config.get ("default.priority");
if (!task.has ("priority") &&
defaultPriority != "" &&
Att::validNameValue ("priority", "", defaultPriority))
context.columns["priority"]->validate (defaultPriority))
task.set ("priority", defaultPriority);
// Override with default.due, if not specified.
std::string defaultDue = context.config.get ("default.due");
if (!task.has ("due") &&
defaultDue != "" &&
Att::validNameValue ("due", "", defaultDue))
context.columns["due"]->validate (defaultDue))
task.set ("due", defaultDue);
}