From c5d7b41d98b9e5704b99877e84ff647afb889ef1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 25 Jun 2009 15:00:32 -0400 Subject: [PATCH] Code Cleanup - Migrated from Context::message to Context::footnote. This more clear to the developer where the messages will be shown. --- src/Context.cpp | 27 ++++++--------------------- src/Context.h | 6 ++---- src/recur.cpp | 2 +- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 6b4c043c6..72c8fe7db 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -144,12 +144,12 @@ int Context::run () catch (const std::string& error) { - message (error); + footnote (error); } catch (...) { - message (stringtable.get (100, "Unknown error.")); + footnote (stringtable.get (100, "Unknown error.")); } // Dump all debug messages. @@ -164,17 +164,9 @@ int Context::run () // Dump the report output. std::cout << output; - // Dump all messages. - foreach (m, messages) - std::cout << colorizeMessage (*m) << std::endl; - // Dump all footnotes. - if (footnotes.size ()) - { - std::cout << std::endl; - foreach (f, footnotes) - std::cout << colorizeFootnote (*f) << std::endl; - } + foreach (f, footnotes) + std::cout << colorizeFootnote (*f) << std::endl; return 0; } @@ -360,8 +352,8 @@ void Context::loadCorrectConfigFile () n.getUntilEOS (value)) { config.set (name, value); - message (std::string ("Configuration override ") + // TODO i18n - arg->substr (3, std::string::npos)); + footnote (std::string ("Configuration override ") + // TODO i18n + arg->substr (3, std::string::npos)); } } else @@ -682,12 +674,6 @@ void Context::header (const std::string& input) headers.push_back (input); } -//////////////////////////////////////////////////////////////////////////////// -void Context::message (const std::string& input) -{ - messages.push_back (input); -} - //////////////////////////////////////////////////////////////////////////////// void Context::footnote (const std::string& input) { @@ -704,7 +690,6 @@ void Context::debug (const std::string& input) void Context::clearMessages () { headers.clear (); - messages.clear (); footnotes.clear (); debugMessages.clear (); } diff --git a/src/Context.h b/src/Context.h index 23003e2db..f59efcd40 100644 --- a/src/Context.h +++ b/src/Context.h @@ -55,9 +55,8 @@ public: int getWidth (); // determine terminal width - void header (const std::string&); // Header sink - void message (const std::string&); // Message sink - void footnote (const std::string&); // Footnote sink + void header (const std::string&); // Header message sink + void footnote (const std::string&); // Footnote message sink void debug (const std::string&); // Debug message sink void clearMessages (); @@ -90,7 +89,6 @@ public: private: std::vector headers; - std::vector messages; std::vector footnotes; std::vector debugMessages; bool inShadow; diff --git a/src/recur.cpp b/src/recur.cpp index e927129a5..fe3ede3ce 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -457,7 +457,7 @@ bool nag (Task& task) if (pri == ' ' && !overdue && !high && !medium && !low) return false; // All the excuses are made, all that remains is to nag the user. - context.message (nagMessage); + context.footnote (nagMessage); return true; }