Code Cleanup

- Eliminated several parse.cpp functions.
- Implemented missing Cmd::allCustomReports.
This commit is contained in:
Paul Beckingham 2009-06-11 01:49:51 -04:00
parent 9a94ea963c
commit 6066fa51ba
5 changed files with 11 additions and 44 deletions

View file

@ -167,3 +167,9 @@ void Cmd::loadCustomReports ()
}
////////////////////////////////////////////////////////////////////////////////
void Cmd::allCustomReports (std::vector <std::string>& all) const
{
all = customReports;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -38,9 +38,10 @@ public:
Cmd (const std::string&); // Default constructor
~Cmd (); // Destructor
bool valid (const std::string&);
bool validCustom (const std::string&);
void parse (const std::string&);
bool valid (const std::string&);
bool validCustom (const std::string&);
void parse (const std::string&);
void allCustomReports (std::vector <std::string>&) const;
public:
std::string command;

View file

@ -42,10 +42,6 @@ bool validPriority (const std::string&);
bool validDate (std::string&);
bool validDuration (std::string&);
bool validDescription (const std::string&);
bool validCommand (std::string&);
void loadCustomReports ();
bool isCustomReport (const std::string&);
void allCustomReports (std::vector <std::string>&);
// task.cpp
void gatherNextTasks (/*const TDB&,*/ T&, std::vector <T>&, std::vector <int>&);

View file

@ -554,40 +554,4 @@ void parse (
}
////////////////////////////////////////////////////////////////////////////////
void loadCustomReports ()
{
std::vector <std::string> all;
context.config.all (all);
foreach (i, all)
{
if (i->substr (0, 7) == "report.")
{
std::string report = i->substr (7, std::string::npos);
std::string::size_type columns = report.find (".columns");
if (columns != std::string::npos)
{
report = report.substr (0, columns);
customReports.push_back (report);
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
bool isCustomReport (const std::string& report)
{
foreach (i, customReports)
if (*i == report)
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////
void allCustomReports (std::vector <std::string>& all)
{
all = customReports;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -203,7 +203,7 @@ std::string shortUsage ()
// Add custom reports here...
std::vector <std::string> all;
allCustomReports (all);
context.cmd.allCustomReports (all);
foreach (report, all)
{
std::string command = std::string ("task ") + *report + std::string (" [tags] [attrs] desc...");