From f3f77a4c781cd88b888a6a0886a003a862db84e1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 9 Jun 2009 22:48:03 -0400 Subject: [PATCH] Enhancement - report stubs - Stubbed all non-1.8.0 reports. - Updated all handler signatures. --- src/Context.cpp | 56 ++++++++++++++++++++++++------------------------- src/command.cpp | 22 +++++++++---------- src/import.cpp | 8 +++---- src/report.cpp | 27 +++++++++++------------- src/task.cpp | 5 ++++- src/task.h | 54 +++++++++++++++++++++++------------------------ 6 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 957f6d325..7cb84dc7c 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -160,43 +160,43 @@ void Context::dispatch () std::string out; /* // Read-only commands with no side effects. - if (command == "export") { out = handleExport (tdb, task); } + if (command == "export") { out = handleExport (); } */ if (cmd.command == "projects") { out = handleProjects (); } else if (cmd.command == "tags") { out = handleTags (); } else if (cmd.command == "colors") { out = handleColor (); } /* - else if (command == "info") { out = handleInfo (tdb, task); } - else if (command == "stats") { out = handleReportStats (tdb, task); } - else if (command == "history") { out = handleReportHistory (tdb, task); } - else if (command == "ghistory") { out = handleReportGHistory (tdb, task); } - else if (command == "calendar") { out = handleReportCalendar (tdb, task); } - else if (command == "summary") { out = handleReportSummary (tdb, task); } - else if (command == "timesheet") { out = handleReportTimesheet (tdb, task); } - else if (command == "version") { out = handleVersion ( ); } - else if (command == "help") { out = longUsage ( ); } + else if (command == "info") { out = handleInfo (); } + else if (command == "stats") { out = handleReportStats (); } + else if (command == "history") { out = handleReportHistory (); } + else if (command == "ghistory") { out = handleReportGHistory (); } + else if (command == "calendar") { out = handleReportCalendar (); } + else if (command == "summary") { out = handleReportSummary (); } + else if (command == "timesheet") { out = handleReportTimesheet (); } + else if (command == "version") { out = handleVersion (); } + else if (command == "help") { out = longUsage (); } // Commands that cause updates. - else if (command == "" && task.getId ()) { cmdMod = true; out = handleModify (tdb, task); } - else if (command == "add") { cmdMod = true; out = handleAdd (tdb, task); } - else if (command == "append") { cmdMod = true; out = handleAppend (tdb, task); } - else if (command == "annotate") { cmdMod = true; out = handleAnnotate (tdb, task); } - else if (command == "done") { cmdMod = true; out = handleDone (tdb, task); } - else if (command == "undelete") { cmdMod = true; out = handleUndelete (tdb, task); } - else if (command == "delete") { cmdMod = true; out = handleDelete (tdb, task); } - else if (command == "start") { cmdMod = true; out = handleStart (tdb, task); } - else if (command == "stop") { cmdMod = true; out = handleStop (tdb, task); } - else if (command == "undo") { cmdMod = true; out = handleUndo (tdb, task); } - else if (command == "import") { cmdMod = true; out = handleImport (tdb, task); } - else if (command == "duplicate") { cmdMod = true; out = handleDuplicate (tdb, task); } - else if (command == "edit") { cmdMod = true; out = handleEdit (tdb, task); } + else if (command == "" && task.getId ()) { cmdMod = true; out = handleModify (); } + else if (command == "add") { cmdMod = true; out = handleAdd (); } + else if (command == "append") { cmdMod = true; out = handleAppend (); } + else if (command == "annotate") { cmdMod = true; out = handleAnnotate (); } + else if (command == "done") { cmdMod = true; out = handleDone (); } + else if (command == "undelete") { cmdMod = true; out = handleUndelete (); } + else if (command == "delete") { cmdMod = true; out = handleDelete (); } + else if (command == "start") { cmdMod = true; out = handleStart (); } + else if (command == "stop") { cmdMod = true; out = handleStop (); } + else if (command == "undo") { cmdMod = true; out = handleUndo (); } + else if (command == "import") { cmdMod = true; out = handleImport (); } + else if (command == "duplicate") { cmdMod = true; out = handleDuplicate (); } + else if (command == "edit") { cmdMod = true; out = handleEdit (); } // Command that display IDs and therefore need TDB::gc first. - else if (command == "completed") { if (gc) gcMod = tdb.gc (); out = handleCompleted (tdb, task); } - else if (command == "next") { if (gc) gcMod = tdb.gc (); out = handleReportNext (tdb, task); } - else if (command == "active") { if (gc) gcMod = tdb.gc (); out = handleReportActive (tdb, task); } - else if (command == "overdue") { if (gc) gcMod = tdb.gc (); out = handleReportOverdue (tdb, task); } - else if (isCustomReport (command)) { if (gc) gcMod = tdb.gc (); out = handleCustomReport (tdb, task, command); } + else if (command == "completed") { if (gc) gcMod = tdb.gc (); out = handleCompleted (); } + else if (command == "next") { if (gc) gcMod = tdb.gc (); out = handleReportNext (); } + else if (command == "active") { if (gc) gcMod = tdb.gc (); out = handleReportActive (); } + else if (command == "overdue") { if (gc) gcMod = tdb.gc (); out = handleReportOverdue (); } + else if (isCustomReport (command)) { if (gc) gcMod = tdb.gc (); out = handleCustomReport (command); } // If the command is not recognized, display usage. else { out = shortUsage (); } diff --git a/src/command.cpp b/src/command.cpp index 9f3da72fd..5a3aa1c97 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -47,7 +47,7 @@ extern Context context; //////////////////////////////////////////////////////////////////////////////// -std::string handleAdd (TDB& tdb, T& task) +std::string handleAdd () { std::stringstream out; /* @@ -193,7 +193,7 @@ std::string handleTags () //////////////////////////////////////////////////////////////////////////////// // If a task is deleted, but is still in the pending file, then it may be // undeleted simply by changing it's status. -std::string handleUndelete (TDB& tdb, T& task) +std::string handleUndelete () { std::stringstream out; /* @@ -231,7 +231,7 @@ std::string handleUndelete (TDB& tdb, T& task) //////////////////////////////////////////////////////////////////////////////// // If a task is done, but is still in the pending file, then it may be undone // simply by changing it's status. -std::string handleUndo (TDB& tdb, T& task) +std::string handleUndo () { std::stringstream out; /* @@ -428,7 +428,7 @@ std::string handleVersion () } //////////////////////////////////////////////////////////////////////////////// -std::string handleDelete (TDB& tdb, T& task) +std::string handleDelete () { std::stringstream out; /* @@ -519,7 +519,7 @@ std::string handleDelete (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleStart (TDB& tdb, T& task) +std::string handleStart () { std::stringstream out; /* @@ -584,7 +584,7 @@ std::string handleStop (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleDone (TDB& tdb, T& task) +std::string handleDone () { /* int count = 0; @@ -651,7 +651,7 @@ std::string handleDone (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleExport (TDB& tdb, T& task) +std::string handleExport () { std::stringstream output; /* @@ -708,7 +708,7 @@ std::string handleExport (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleModify (TDB& tdb, T& task) +std::string handleModify () { /* int count = 0; @@ -765,7 +765,7 @@ std::string handleModify (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleAppend (TDB& tdb, T& task) +std::string handleAppend () { /* int count = 0; @@ -818,7 +818,7 @@ std::string handleAppend (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleDuplicate (TDB& tdb, T& task) +std::string handleDuplicate () { /* int count = 0; @@ -965,7 +965,7 @@ std::string handleColor () } //////////////////////////////////////////////////////////////////////////////// -std::string handleAnnotate (TDB& tdb, T& task) +std::string handleAnnotate () { /* if (task.getDescription () == "") diff --git a/src/import.cpp b/src/import.cpp index f5b5a0f1d..7b4817cd3 100644 --- a/src/import.cpp +++ b/src/import.cpp @@ -675,7 +675,7 @@ static std::string importTaskCmdLine ( T task; std::string command; parse (args, command, task); - handleAdd (tdb, task); + handleAdd (); } catch (...) @@ -1127,10 +1127,10 @@ static std::string importCSV ( } //////////////////////////////////////////////////////////////////////////////// -std::string handleImport (TDB& tdb, T& task) +std::string handleImport () { std::stringstream out; - +#if 0 // Use the description as a file name. std::string file = trim (task.getDescription ()); if (file.length () > 0) @@ -1194,7 +1194,7 @@ std::string handleImport (TDB& tdb, T& task) } else throw std::string ("You must specify a file to import."); - +#endif return out.str (); } diff --git a/src/report.cpp b/src/report.cpp index ddeab8416..36eaefd80 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -204,7 +204,7 @@ void filter (std::vector& all, T& task) //////////////////////////////////////////////////////////////////////////////// // Successively apply filters based on the task object built from the command // line. Tasks that match all the specified criteria are listed. -std::string handleCompleted (TDB& tdb, T& task) +std::string handleCompleted () { std::stringstream out; /* @@ -310,7 +310,7 @@ std::string handleCompleted (TDB& tdb, T& task) //////////////////////////////////////////////////////////////////////////////// // Display all information for the given task. -std::string handleInfo (TDB& tdb, T& task) +std::string handleInfo () { std::stringstream out; /* @@ -553,7 +553,7 @@ std::string handleInfo (TDB& tdb, T& task) // Project Remaining Avg Age Complete 0% 100% // A 12 13d 55% XXXXXXXXXXXXX----------- // B 109 3d 12h 10% XXX--------------------- -std::string handleReportSummary (TDB& tdb, T& task) +std::string handleReportSummary () { std::stringstream out; /* @@ -716,7 +716,7 @@ std::string handleReportSummary (TDB& tdb, T& task) // // Make the "three" tasks a configurable number // -std::string handleReportNext (TDB& tdb, T& task) +std::string handleReportNext () { std::stringstream out; /* @@ -902,7 +902,7 @@ time_t monthlyEpoch (const std::string& date) return 0; } -std::string handleReportHistory (TDB& tdb, T& task) +std::string handleReportHistory () { std::stringstream out; /* @@ -1095,7 +1095,7 @@ std::string handleReportHistory (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleReportGHistory (TDB& tdb, T& task) +std::string handleReportGHistory () { std::stringstream out; /* @@ -1340,7 +1340,7 @@ std::string handleReportGHistory (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleReportTimesheet (TDB& tdb, T& task) +std::string handleReportTimesheet () { std::stringstream out; /* @@ -1704,7 +1704,7 @@ std::string renderMonths ( } //////////////////////////////////////////////////////////////////////////////// -std::string handleReportCalendar (TDB& tdb, T& task) +std::string handleReportCalendar () { std::stringstream out; /* @@ -1830,7 +1830,7 @@ std::string handleReportCalendar (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleReportActive (TDB& tdb, T& task) +std::string handleReportActive () { std::stringstream out; /* @@ -1964,7 +1964,7 @@ std::string handleReportActive (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleReportOverdue (TDB& tdb, T& task) +std::string handleReportOverdue () { std::stringstream out; /* @@ -2088,7 +2088,7 @@ std::string handleReportOverdue (TDB& tdb, T& task) } //////////////////////////////////////////////////////////////////////////////// -std::string handleReportStats (TDB& tdb, T& task) +std::string handleReportStats () { std::stringstream out; /* @@ -2477,10 +2477,7 @@ void gatherNextTasks ( //////////////////////////////////////////////////////////////////////////////// // This report will eventually become the one report that many others morph into // via the .taskrc file. -std::string handleCustomReport ( - TDB& tdb, - T& task, - const std::string& report) +std::string handleCustomReport (const std::string& report) { /* // Determine window size, and set table accordingly. diff --git a/src/task.cpp b/src/task.cpp index bd405b884..55a89a012 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -404,6 +404,7 @@ void updateShadowFile (TDB& tdb) } //////////////////////////////////////////////////////////////////////////////// +// TODO Obsolete std::string runTaskCommand ( int argc, char** argv, @@ -424,6 +425,7 @@ std::cout << "arg=" << argv[i] << std::endl; } //////////////////////////////////////////////////////////////////////////////// +// TODO Obsolete std::string runTaskCommand ( std::vector & args, TDB& tdb, @@ -450,7 +452,7 @@ std::string runTaskCommand ( bool gcMod = false; // Change occurred by way of gc. bool cmdMod = false; // Change occurred by way of command type. std::string out; - +/* // Read-only commands with no side effects. if (command == "export") { out = handleExport (tdb, task); } else if (command == "info") { out = handleInfo (tdb, task); } @@ -492,6 +494,7 @@ std::string runTaskCommand ( // and if an actual change occurred (gcMod || cmdMod). if (shadow && (gcMod || cmdMod)) updateShadowFile (tdb); +*/ return out; } diff --git a/src/task.h b/src/task.h index e3c360a9e..d10dfbf4f 100644 --- a/src/task.h +++ b/src/task.h @@ -55,7 +55,7 @@ std::string runTaskCommand (int, char**, TDB&, bool gc = true, bool shadow = tru std::string runTaskCommand (std::vector &, TDB&, bool gc = false, bool shadow = false); // recur.cpp -void handleRecurrence (TDB&, std::vector &); +void handleRecurrence (); Date getNextRecurrence (Date&, std::string&); bool generateDueDates (T&, std::vector &); void updateRecurrenceMask (TDB&, std::vector &, T&); @@ -63,22 +63,22 @@ int getDueState (const std::string&); void nag (TDB&, T&); // command.cpp -std::string handleAdd (TDB&, T&); -std::string handleAppend (TDB&, T&); -std::string handleExport (TDB&, T&); -std::string handleDone (TDB&, T&); -std::string handleModify (TDB&, T&); +std::string handleAdd (); +std::string handleAppend (); +std::string handleExport (); +std::string handleDone (); +std::string handleModify (); std::string handleProjects (); std::string handleTags (); -std::string handleUndelete (TDB&, T&); +std::string handleUndelete (); std::string handleVersion (); -std::string handleDelete (TDB&, T&); -std::string handleStart (TDB&, T&); -std::string handleStop (TDB&, T&); -std::string handleUndo (TDB&, T&); +std::string handleDelete (); +std::string handleStart (); +std::string handleStop (); +std::string handleUndo (); std::string handleColor (); -std::string handleAnnotate (TDB&, T&); -std::string handleDuplicate (TDB&, T&); +std::string handleAnnotate (); +std::string handleDuplicate (); int deltaAppend (T&, T&); int deltaDescription (T&, T&); int deltaTags (T&, T&); @@ -86,24 +86,24 @@ int deltaAttributes (T&, T&); int deltaSubstitutions (T&, T&); // edit.cpp -std::string handleEdit (TDB&, T&); +std::string handleEdit (); // report.cpp void filterSequence (std::vector&, T&); void filter (std::vector&, T&); -std::string handleInfo (TDB&, T&); -std::string handleCompleted (TDB&, T&); -std::string handleReportSummary (TDB&, T&); -std::string handleReportNext (TDB&, T&); -std::string handleReportHistory (TDB&, T&); -std::string handleReportGHistory (TDB&, T&); -std::string handleReportCalendar (TDB&, T&); -std::string handleReportActive (TDB&, T&); -std::string handleReportOverdue (TDB&, T&); -std::string handleReportStats (TDB&, T&); -std::string handleReportTimesheet (TDB&, T&); +std::string handleInfo (); +std::string handleCompleted (); +std::string handleReportSummary (); +std::string handleReportNext (); +std::string handleReportHistory (); +std::string handleReportGHistory (); +std::string handleReportCalendar (); +std::string handleReportActive (); +std::string handleReportOverdue (); +std::string handleReportStats (); +std::string handleReportTimesheet (); -std::string handleCustomReport (TDB&, T&, const std::string&); +std::string handleCustomReport (const std::string&); void validReportColumns (const std::vector &); void validSortColumns (const std::vector &, const std::vector &); @@ -112,7 +112,7 @@ void initializeColorRules (); void autoColorize (T&, Text::color&, Text::color&); // import.cpp -std::string handleImport (TDB&, T&); +std::string handleImport (); // list template ///////////////////////////////////////////////////////////////////////////////