55 void Add(
DOWNGRADE_BUCKET aBucket,
const wxString& aFeature,
const wxString& aDetail = wxEmptyString,
61 if( entry.m_bucket == aBucket && entry.m_feature == aFeature )
63 entry.m_count += aCount;
65 if( entry.m_detail.IsEmpty() )
66 entry.m_detail = aDetail;
72 m_entries.push_back( { aBucket, aFeature, aDetail, aCount } );
95 if( entry.m_bucket == aBucket )
96 total += entry.m_count;
103 wxString
ToText(
const wxString& aTargetName )
const
105 wxString
text =
_(
"KiCad Compatibility Report" ) + wxS(
"\n" );
106 text += wxString::Format(
_(
"Target: %s" ), aTargetName ) + wxS(
"\n\n" );
107 text +=
_(
"Compatibility preview. This report describes planned changes." ) + wxS(
"\n" );
110 text +=
_(
"Export is blocked by unsupported features." );
112 text +=
_(
"Export requires approval for the changes below." );
114 text +=
_(
"No compatibility changes were reported." );
116 text += wxS(
"\n\n" ) +
_(
"Counts cover reported items only." ) + wxS(
"\n" );
120 text += wxString::Format( wxS(
"\n%s: %d\n" ), aLabel,
Count( aBucket ) );
124 if( entry.m_bucket != aBucket )
127 text += wxString::Format( wxS(
" %s (%d)\n" ), entry.m_feature, entry.m_count );
129 if( !entry.m_detail.IsEmpty() )
130 text += wxString::Format( wxS(
" %s\n" ), entry.m_detail );
148 switch( entry.m_bucket )
156 aReporter->
Report( wxString::Format( wxT(
" [%s] %s (%d): %s\n" ), label, entry.m_feature, entry.m_count,
167 if( entry.m_bucket == aBucket )
What an export to a given target will keep, approximate, drop, or block.
wxString ToText(const wxString &aTargetName) const
A readable preview of the classified export, including counts and feature details.
bool Has(DOWNGRADE_BUCKET aBucket) const
std::vector< COMPAT_ENTRY > m_entries
void Add(DOWNGRADE_BUCKET aBucket, const wxString &aFeature, const wxString &aDetail=wxEmptyString, int aCount=1)
void Print(REPORTER *aReporter) const
void Merge(const COMPATIBILITY_REPORT &aOther)
bool IsLossy() const
True if anything is approximated or dropped. This is what triggers the lossy warning.
bool IsBlocked() const
True if some feature makes the target impossible. The user cannot export anyway.
int Count(DOWNGRADE_BUCKET aBucket) const
const std::vector< COMPAT_ENTRY > & Entries() const
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
DOWNGRADE_BUCKET
What happens to a feature when we export to an older KiCad.
@ BLOCK
Cannot be represented at all, export to this target is not possible.
@ KEEP
Exists in the target, written unchanged.
@ LOWER
Approximated down to a simpler equivalent.
@ DROP
No equivalent, left out.
One line in the compatibility report.
wxString m_feature
e.g. "Net chains"
DOWNGRADE_BUCKET m_bucket
wxString m_detail
optional note, e.g. the electrical consequence