Task: Renamed ::getUDAOrphans to ::getUDAOrphanUUIDs

This commit is contained in:
Paul Beckingham 2016-12-31 12:27:20 -05:00
parent fdcb084df6
commit 6c9660aee8
3 changed files with 7 additions and 6 deletions

View file

@ -1336,12 +1336,15 @@ void Task::removeTag (const std::string& tag)
#ifdef PRODUCT_TASKWARRIOR #ifdef PRODUCT_TASKWARRIOR
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// A UDA Orphan is an attribute that is not represented in context.columns. // A UDA Orphan is an attribute that is not represented in context.columns.
void Task::getUDAOrphans (std::vector <std::string>& names) const std::vector <std::string> Task::getUDAOrphanUUIDs () const
{ {
std::vector <std::string> orphans;
for (auto& it : data) for (auto& it : data)
if (it.first.compare (0, 11, "annotation_", 11) != 0) if (it.first.compare (0, 11, "annotation_", 11) != 0)
if (context.columns.find (it.first) == context.columns.end ()) if (context.columns.find (it.first) == context.columns.end ())
names.push_back (it.first); orphans.push_back (it.first);
return orphans;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -145,7 +145,7 @@ public:
void getDependencies (std::vector <std::string>&) const; void getDependencies (std::vector <std::string>&) const;
void getDependencies (std::vector <Task>&) const; void getDependencies (std::vector <Task>&) const;
void getUDAOrphans (std::vector <std::string>&) const; std::vector <std::string> getUDAOrphanUUIDs () const;
void substitute (const std::string&, const std::string&, const std::string&); void substitute (const std::string&, const std::string&, const std::string&);
#endif #endif

View file

@ -312,9 +312,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
} }
// UDA orphans // UDA orphans
std::vector <std::string> orphans; auto orphans = task.getUDAOrphanUUIDs ();
task.getUDAOrphans (orphans);
if (orphans.size ()) if (orphans.size ())
{ {
before << "# " << STRING_EDIT_UDA_ORPHAN_SEP << '\n'; before << "# " << STRING_EDIT_UDA_ORPHAN_SEP << '\n';