Code Cleanup

- Migrated from Context::message to Context::footnote.  This more clear
  to the developer where the messages will be shown.
This commit is contained in:
Paul Beckingham 2009-06-25 15:00:32 -04:00
parent 104ad5a5b5
commit c5d7b41d98
3 changed files with 9 additions and 26 deletions

View file

@ -144,12 +144,12 @@ int Context::run ()
catch (const std::string& error) catch (const std::string& error)
{ {
message (error); footnote (error);
} }
catch (...) catch (...)
{ {
message (stringtable.get (100, "Unknown error.")); footnote (stringtable.get (100, "Unknown error."));
} }
// Dump all debug messages. // Dump all debug messages.
@ -164,17 +164,9 @@ int Context::run ()
// Dump the report output. // Dump the report output.
std::cout << output; std::cout << output;
// Dump all messages.
foreach (m, messages)
std::cout << colorizeMessage (*m) << std::endl;
// Dump all footnotes. // Dump all footnotes.
if (footnotes.size ())
{
std::cout << std::endl;
foreach (f, footnotes) foreach (f, footnotes)
std::cout << colorizeFootnote (*f) << std::endl; std::cout << colorizeFootnote (*f) << std::endl;
}
return 0; return 0;
} }
@ -360,7 +352,7 @@ void Context::loadCorrectConfigFile ()
n.getUntilEOS (value)) n.getUntilEOS (value))
{ {
config.set (name, value); config.set (name, value);
message (std::string ("Configuration override ") + // TODO i18n footnote (std::string ("Configuration override ") + // TODO i18n
arg->substr (3, std::string::npos)); arg->substr (3, std::string::npos));
} }
} }
@ -682,12 +674,6 @@ void Context::header (const std::string& input)
headers.push_back (input); headers.push_back (input);
} }
////////////////////////////////////////////////////////////////////////////////
void Context::message (const std::string& input)
{
messages.push_back (input);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Context::footnote (const std::string& input) void Context::footnote (const std::string& input)
{ {
@ -704,7 +690,6 @@ void Context::debug (const std::string& input)
void Context::clearMessages () void Context::clearMessages ()
{ {
headers.clear (); headers.clear ();
messages.clear ();
footnotes.clear (); footnotes.clear ();
debugMessages.clear (); debugMessages.clear ();
} }

View file

@ -55,9 +55,8 @@ public:
int getWidth (); // determine terminal width int getWidth (); // determine terminal width
void header (const std::string&); // Header sink void header (const std::string&); // Header message sink
void message (const std::string&); // Message sink void footnote (const std::string&); // Footnote message sink
void footnote (const std::string&); // Footnote sink
void debug (const std::string&); // Debug message sink void debug (const std::string&); // Debug message sink
void clearMessages (); void clearMessages ();
@ -90,7 +89,6 @@ public:
private: private:
std::vector <std::string> headers; std::vector <std::string> headers;
std::vector <std::string> messages;
std::vector <std::string> footnotes; std::vector <std::string> footnotes;
std::vector <std::string> debugMessages; std::vector <std::string> debugMessages;
bool inShadow; bool inShadow;

View file

@ -457,7 +457,7 @@ bool nag (Task& task)
if (pri == ' ' && !overdue && !high && !medium && !low) return false; if (pri == ' ' && !overdue && !high && !medium && !low) return false;
// All the excuses are made, all that remains is to nag the user. // All the excuses are made, all that remains is to nag the user.
context.message (nagMessage); context.footnote (nagMessage);
return true; return true;
} }