Task: Improved method signature

This commit is contained in:
Paul Beckingham 2016-12-31 15:55:06 -05:00
parent cfc3e098c1
commit 5193f7d03e
10 changed files with 21 additions and 49 deletions

View file

@ -90,8 +90,7 @@ int CmdDenotate::execute (std::string&)
{
Task before (task);
std::map <std::string, std::string> annotations;
task.getAnnotations (annotations);
auto annotations = task.getAnnotations ();
if (annotations.size () == 0)
throw std::string (STRING_CMD_DENO_NONE);

View file

@ -245,9 +245,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
<< "# " << STRING_EDIT_HEADER_14 << '\n'
<< "# " << STRING_EDIT_HEADER_15 << '\n';
std::map <std::string, std::string> annotations;
task.getAnnotations (annotations);
for (auto& anno : annotations)
for (auto& anno : task.getAnnotations ())
{
Datetime dt (strtol (anno.first.substr (11).c_str (), NULL, 10));
before << " Annotation: " << dt.toString (dateformat)

View file

@ -134,9 +134,7 @@ int CmdInfo::execute (std::string& output)
std::string description = task.get ("description");
int indent = context.config.getInteger ("indent.annotation");
std::map <std::string, std::string> annotations;
task.getAnnotations (annotations);
for (auto& anno : annotations)
for (auto& anno : task.getAnnotations ())
description += '\n'
+ std::string (indent, ' ')
+ Datetime (anno.first.substr (11)).toString (dateformatanno)

View file

@ -140,10 +140,7 @@ int CmdStats::execute (std::string& output)
daysPending += (now.toEpoch () - entry) / 86400.0;
descLength += task.get ("description").length ();
std::map <std::string, std::string> annotations;
task.getAnnotations (annotations);
annotationsT += annotations.size ();
annotationsT += task.getAnnotations ().size ();
auto tags = task.getTags ();
if (tags.size ())

View file

@ -142,9 +142,7 @@ int CmdTimesheet::execute (std::string& output)
std::string description = task.get ("description");
int indent = context.config.getInteger ("indent.annotation");
std::map <std::string, std::string> annotations;
task.getAnnotations (annotations);
for (auto& ann : annotations)
for (auto& ann : task.getAnnotations ())
description += '\n'
+ std::string (indent, ' ')
+ Datetime (ann.first.substr (11)).toString (context.config.get ("dateformat"))
@ -198,9 +196,7 @@ int CmdTimesheet::execute (std::string& output)
std::string description = task.get ("description");
int indent = context.config.getInteger ("indent.annotation");
std::map <std::string, std::string> annotations;
task.getAnnotations (annotations);
for (auto& ann : annotations)
for (auto& ann : task.getAnnotations ())
description += '\n'
+ std::string (indent, ' ')
+ Datetime (ann.first.substr (11)).toString (context.config.get ("dateformat"))