7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 06:56:57 +00:00

Implement severity checking for CLI_REPORTER.

This commit is contained in:
Jeff Young 2025-03-05 00:12:08 +00:00
parent 9be7464681
commit 699fd2b3ac
2 changed files with 19 additions and 0 deletions

View File

@ -138,10 +138,24 @@ REPORTER& CLI_REPORTER::Report( const wxString& aMsg, SEVERITY aSeverity )
else
wxFprintf( target, aMsg + wxS( "\n" ) );
m_hasMessageMap[aSeverity] = true;
return *this;
}
bool CLI_REPORTER::HasMessageOfSeverity( int aSeverityMask ) const
{
for( const auto& [severity, flag] : m_hasMessageMap )
{
if( ( aSeverityMask & severity ) > 0 && flag )
return true;
}
return false;
}
REPORTER& CLI_REPORTER::GetInstance()
{
static CLI_REPORTER s_cliReporter;

View File

@ -26,6 +26,7 @@
#define _REPORTER_H_
#include <memory>
#include <map>
#include <eda_units.h>
#include <widgets/report_severity.h>
@ -238,6 +239,10 @@ public:
REPORTER& Report( const wxString& aMsg, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
bool HasMessage() const override { return false; }
bool HasMessageOfSeverity( int aSeverityMask ) const override;
private:
std::map<SEVERITY, bool> m_hasMessageMap;
};