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)
{
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;
}
return 0;
}
@ -360,7 +352,7 @@ void Context::loadCorrectConfigFile ()
n.getUntilEOS (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));
}
}
@ -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 ();
}

View file

@ -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 <std::string> headers;
std::vector <std::string> messages;
std::vector <std::string> footnotes;
std::vector <std::string> debugMessages;
bool inShadow;

View file

@ -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;
}