KiCad PCB EDA Suite
Loading...
Searching...
No Matches
IMPORT_MESSAGE_COLLECTOR Class Reference

Reporter handed to an importer during an import job. More...

#include <job_import_utils.h>

Inheritance diagram for IMPORT_MESSAGE_COLLECTOR:
REPORTER

Public Types

enum  LOCATION { LOC_HEAD = 0 , LOC_BODY , LOC_TAIL }
 Location where the message is to be reported. More...
 

Public Member Functions

 IMPORT_MESSAGE_COLLECTOR (REPORTER &aJobReporter)
 
 ~IMPORT_MESSAGE_COLLECTOR () override
 
REPORTER & Report (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
 Report a string with a given severity.
 
bool HasMessage () const override
 Returns true if any messages were reported.
 
void Clear () override
 
void Flush (IMPORT_REPORT_FORMAT aFormat, IMPORT_REPORT_DATA &aData)
 Move the collected messages into aData when a report will be written, otherwise forward them to the job's reporter.
 
virtual REPORTER & Report (const KI_ERROR &aError)
 Report a structured KI_ERROR.
 
REPORTER & Report (const char *aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
virtual REPORTER & ReportTail (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 Places the report at the end of the list, for objects that support report ordering.
 
virtual REPORTER & ReportHead (const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 Places the report at the beginning of the list for objects that support ordering.
 
REPORTER & operator<< (const wxString &aText)
 
virtual bool HasMessageOfSeverity (int aSeverityMask) const
 Returns true if the reporter has one or more messages matching the specified severity mask.
 
virtual EDA_UNITS GetUnits () const
 
virtual void Finalize ()
 

Private Member Functions

void forward ()
 

Private Attributes

REPORTER & m_jobReporter
 
std::vector< wxString > m_warnings
 
std::vector< wxString > m_errors
 
int m_reportedSeverityMask
 

Detailed Description

Reporter handed to an importer during an import job.

It keeps the importer's warnings and errors so the job can place them in its report, and drops informational and debug messages. Messages still held when it is destroyed, e.g. after a failed load, are forwarded to the job's reporter.

Definition at line 78 of file job_import_utils.h.

Member Enumeration Documentation

◆ LOCATION

enum REPORTER::LOCATION
inherited

Location where the message is to be reported.

LOC_HEAD messages are printed before all others (typically intro messages) LOC_BODY messages are printed in the middle LOC_TAIL messages are printed after all others (typically status messages)

Enumerator
LOC_HEAD 
LOC_BODY 
LOC_TAIL 

Definition at line 88 of file reporter.h.

Constructor & Destructor Documentation

◆ IMPORT_MESSAGE_COLLECTOR()

IMPORT_MESSAGE_COLLECTOR::IMPORT_MESSAGE_COLLECTOR ( REPORTER & aJobReporter)
inlineexplicit

Definition at line 81 of file job_import_utils.h.

References m_jobReporter, and REPORTER::REPORTER().

◆ ~IMPORT_MESSAGE_COLLECTOR()

IMPORT_MESSAGE_COLLECTOR::~IMPORT_MESSAGE_COLLECTOR ( )
override

Definition at line 134 of file job_import_utils.cpp.

References forward().

Member Function Documentation

◆ Clear()

void IMPORT_MESSAGE_COLLECTOR::Clear ( )
overridevirtual

Reimplemented from REPORTER.

Definition at line 126 of file job_import_utils.cpp.

References REPORTER::Clear(), m_errors, and m_warnings.

Referenced by Flush(), and forward().

◆ Finalize()

virtual void REPORTER::Finalize ( )
inlinevirtualinherited

Reimplemented in INFOBAR_REPORTER, and SYNC_REPORTER.

Definition at line 167 of file reporter.h.

◆ Flush()

void IMPORT_MESSAGE_COLLECTOR::Flush ( IMPORT_REPORT_FORMAT aFormat,
IMPORT_REPORT_DATA & aData )

Move the collected messages into aData when a report will be written, otherwise forward them to the job's reporter.

Definition at line 152 of file job_import_utils.cpp.

References Clear(), forward(), m_errors, m_warnings, and NONE.

Referenced by EESCHEMA_JOBS_HANDLER::JobImport(), and PCBNEW_JOBS_HANDLER::JobImport().

◆ forward()

void IMPORT_MESSAGE_COLLECTOR::forward ( )
private

◆ GetUnits()

virtual EDA_UNITS REPORTER::GetUnits ( ) const
inlinevirtualinherited

Reimplemented in KI_TEST::CAPTURING_REPORTER, SYNC_REPORTER, and WX_HTML_REPORT_BOX.

Definition at line 157 of file reporter.h.

References MM.

◆ HasMessage()

bool IMPORT_MESSAGE_COLLECTOR::HasMessage ( ) const
inlineoverridevirtual

Returns true if any messages were reported.

Reimplemented from REPORTER.

Definition at line 89 of file job_import_utils.h.

References m_errors, and m_warnings.

◆ HasMessageOfSeverity()

virtual bool REPORTER::HasMessageOfSeverity ( int aSeverityMask) const
inlinevirtualinherited

Returns true if the reporter has one or more messages matching the specified severity mask.

Reimplemented in SYNC_REPORTER, and WX_HTML_PANEL_REPORTER.

Definition at line 152 of file reporter.h.

References m_reportedSeverityMask.

Referenced by DRC_ENGINE::compileRules(), DIALOG_SIM_MODEL< T >::loadLibrary(), NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries(), SIM_LIB_MGR::SetLibrary(), and SIMULATOR_FRAME::showNetlistErrors().

◆ operator<<()

REPORTER & REPORTER::operator<< ( const wxString & aText)
inlineinherited

Definition at line 138 of file reporter.h.

References Report(), and REPORTER().

◆ Report() [1/3]

REPORTER & IMPORT_MESSAGE_COLLECTOR::Report ( const wxString & aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED )
overridevirtual

Report a string with a given severity.

Parameters
aTextis the string to report.
aSeverityis an indicator ( RPT_UNDEFINED, RPT_INFO, RPT_WARNING, RPT_ERROR, RPT_ACTION ) used to filter and format messages

Reimplemented from REPORTER.

Definition at line 110 of file job_import_utils.cpp.

References m_errors, m_warnings, REPORTER::Report(), REPORTER::REPORTER(), RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and text.

◆ Report() [2/3]

REPORTER & REPORTER::Report ( const char * aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED )
inherited

Definition at line 79 of file reporter.cpp.

References From_UTF8(), Report(), and REPORTER().

◆ Report() [3/3]

REPORTER & REPORTER::Report ( const KI_ERROR & aError)
virtualinherited

Report a structured KI_ERROR.

The default implementation flattens the error onto Report(const wxString&, SEVERITY). Reporters that want to render the title / description / debug hierarchy separately override this.

Reimplemented in STATUSBAR_WARNING_REPORTER, and WX_HTML_REPORT_BOX.

Definition at line 86 of file reporter.cpp.

References KI_ERROR::AsString(), KI_ERROR::GetSeverity(), Report(), and REPORTER().

◆ ReportHead()

virtual REPORTER & REPORTER::ReportHead ( const wxString & aText,
SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED )
inlinevirtualinherited

Places the report at the beginning of the list for objects that support ordering.

Reimplemented in SYNC_REPORTER, and WX_HTML_PANEL_REPORTER.

Definition at line 130 of file reporter.h.

References Report(), REPORTER(), and RPT_SEVERITY_UNDEFINED.

Referenced by BACK_ANNOTATE::applyChangelist(), and SCH_EDIT_FRAME::WriteNetListFile().

◆ ReportTail()

Member Data Documentation

◆ m_errors

std::vector<wxString> IMPORT_MESSAGE_COLLECTOR::m_errors
private

Definition at line 104 of file job_import_utils.h.

Referenced by Clear(), Flush(), forward(), HasMessage(), and Report().

◆ m_jobReporter

REPORTER& IMPORT_MESSAGE_COLLECTOR::m_jobReporter
private

Definition at line 102 of file job_import_utils.h.

Referenced by forward(), and IMPORT_MESSAGE_COLLECTOR().

◆ m_reportedSeverityMask

int REPORTER::m_reportedSeverityMask
privateinherited

Definition at line 170 of file reporter.h.

Referenced by Clear(), HasMessage(), HasMessageOfSeverity(), Report(), and REPORTER().

◆ m_warnings

std::vector<wxString> IMPORT_MESSAGE_COLLECTOR::m_warnings
private

Definition at line 103 of file job_import_utils.h.

Referenced by Clear(), Flush(), forward(), HasMessage(), and Report().


The documentation for this class was generated from the following files: