Code Cleanup - obsolete code

- Removed obsolete T::removeAttributes.
- Removed obsolete T::sequenceContains.
- Modified handleInfo so it no longer uses T::sequenceContains, and
  instead uses filterSequence.
This commit is contained in:
Paul Beckingham 2009-05-23 18:30:51 -04:00
parent 8fa38fc4c3
commit 0eff6fa2b1
5 changed files with 218 additions and 231 deletions

View file

@ -42,6 +42,14 @@ public:
virtual std::string composeCSV () = 0; virtual std::string composeCSV () = 0;
void parse (const std::string&); void parse (const std::string&);
/*
void getAttributes (std::map<std::string, std::string>&);
const std::string getAttribute (const std::string&);
void setAttribute (const std::string&, const std::string&);
void setAttributes (const std::map <std::string, std::string>&);
void removeAttribute (const std::string&);
*/
private: private:
std::vector <Att> mAtts; std::vector <Att> mAtts;
}; };

View file

@ -230,12 +230,6 @@ void T::setAttributes (const std::map <std::string, std::string>& attributes)
} }
} }
////////////////////////////////////////////////////////////////////////////////
void T::removeAttributes ()
{
mAttributes.clear ();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void T::removeAttribute (const std::string& name) void T::removeAttribute (const std::string& name)
{ {
@ -290,16 +284,6 @@ void T::addAnnotation (const std::string& description)
mAnnotations[time (NULL)] = sanitized; mAnnotations[time (NULL)] = sanitized;
} }
////////////////////////////////////////////////////////////////////////////////
bool T::sequenceContains (int id) const
{
foreach (seq, mSequence)
if (*seq == id)
return true;
return false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// uuid status [tags] [attributes] [annotations] description // uuid status [tags] [attributes] [annotations] description
// //

View file

@ -79,12 +79,10 @@ public:
void setAttribute (const std::string&, const std::string&); void setAttribute (const std::string&, const std::string&);
void setAttributes (const std::map <std::string, std::string>&); void setAttributes (const std::map <std::string, std::string>&);
void removeAttribute (const std::string&); void removeAttribute (const std::string&);
void removeAttributes ();
void getAnnotations (std::map <time_t, std::string>&) const; void getAnnotations (std::map <time_t, std::string>&) const;
void setAnnotations (const std::map <time_t, std::string>&); void setAnnotations (const std::map <time_t, std::string>&);
void addAnnotation (const std::string&); void addAnnotation (const std::string&);
bool sequenceContains (int) const;
const std::string compose () const; const std::string compose () const;
const std::string composeCSV (); const std::string composeCSV ();

View file

@ -41,6 +41,8 @@ public:
std::string composeF4 (); std::string composeF4 ();
std::string composeCSV (); std::string composeCSV ();
// TODO Series of helper functions.
private: private:
}; };

View file

@ -314,16 +314,12 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf)
// Get all the tasks. // Get all the tasks.
std::vector <T> tasks; std::vector <T> tasks;
tdb.allPendingT (tasks); tdb.allPendingT (tasks);
filterSequence (tasks, task);
// Find the task. // Find the task.
int count = 0; foreach (t, tasks)
for (unsigned int i = 0; i < tasks.size (); ++i)
{ {
T refTask (tasks[i]); T refTask (*t);
if (refTask.getId () == task.getId () || task.sequenceContains (refTask.getId ()))
{
++count;
Table table; Table table;
table.setTableWidth (width); table.setTableWidth (width);
@ -532,9 +528,8 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf)
<< table.render () << table.render ()
<< std::endl; << std::endl;
} }
}
if (! count) if (! tasks.size ())
out << "No matches." << std::endl; out << "No matches." << std::endl;
return out.str (); return out.str ();