Created STDOUT_REPORTER class for debugging

This commit is contained in:
Maciej Suminski 2018-02-28 11:30:10 +01:00
parent a3941b1dec
commit f7158e834d
2 changed files with 49 additions and 0 deletions

View File

@ -94,3 +94,33 @@ REPORTER& NULL_REPORTER::GetInstance()
return *s_nullReporter;
}
REPORTER& STDOUT_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
{
switch( aSeverity )
{
case RPT_UNDEFINED: std::cout << "RPT_UNDEFINED: "; break;
case RPT_INFO: std::cout << "RPT_INFO: "; break;
case RPT_WARNING: std::cout << "RPT_WARNING: "; break;
case RPT_ERROR: std::cout << "RPT_ERROR: "; break;
case RPT_ACTION: std::cout << "RPT_ACTION: "; break;
}
std::cout << aText << std::endl;
return *this;
}
REPORTER& STDOUT_REPORTER::GetInstance()
{
static REPORTER* s_stdoutReporter = nullptr;
if( !s_stdoutReporter )
{
s_stdoutReporter = new STDOUT_REPORTER();
}
return *s_stdoutReporter;
}

View File

@ -178,4 +178,23 @@ public:
bool HasMessage() const override { return false; }
};
/**
* Class STDOUT_REPORTER
*
* Debug type reporter, forwarding messages to std::cout.
*/
class STDOUT_REPORTER : public REPORTER
{
public:
STDOUT_REPORTER()
{
}
static REPORTER& GetInstance();
REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_UNDEFINED ) override;
bool HasMessage() const override { return false; }
};
#endif // _REPORTER_H_