39 const std::vector<DRC_RE_LOADED_PANEL_ENTRY>& aEntries,
42 wxFFile file( aPath,
"w" );
44 if( !file.IsOpened() )
48 file.Write( content );
58 wxString
result =
"(version 1)\n";
64 if( !ruleText.IsEmpty() )
102 if( !severityClause.IsEmpty() && !ruleText.Contains(
"(severity" ) )
105 size_t lastParen = ruleText.rfind(
')' );
107 if( lastParen != wxString::npos )
109 ruleText = ruleText.Left( lastParen ) +
"\n\t" + severityClause +
")";
120 if( !aBoard || !aLayers.any() )
121 return wxEmptyString;
123 wxString layerStr =
"(layer";
126 layerStr +=
" \"" + aBoard->
GetLayerName( layer ) +
"\"";
142 default:
return wxEmptyString;
Information pertinent to a Pcbnew printed circuit board.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
wxString GetConstraintCode()
virtual wxString GenerateRule(const RULE_GENERATION_CONTEXT &aContext)
bool SaveFile(const wxString &aPath, const std::vector< DRC_RE_LOADED_PANEL_ENTRY > &aEntries, const BOARD *aBoard=nullptr)
Save all panel entries to a file.
wxString generateLayerClause(const LSET &aLayers, const BOARD *aBoard)
Generate a layer clause from an LSET.
wxString generateRuleText(const DRC_RE_LOADED_PANEL_ENTRY &aEntry, const BOARD *aBoard)
Generate the rule text for a single panel entry.
wxString GenerateRulesText(const std::vector< DRC_RE_LOADED_PANEL_ENTRY > &aEntries, const BOARD *aBoard=nullptr)
Generate rule text from panel entries.
wxString generateSeverityClause(SEVERITY aSeverity)
Generate a severity clause.
LSET is a set of PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
wxString GetComment()
Get the comment associated with the rule.
PCB_LAYER_ID
A quick note on layer IDs:
Represents a rule loaded from a .kicad_dru file and mapped to a panel.
wxString originalRuleText
std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > constraintData
wxString conditionExpression
wxString result
Test unit parsing edge cases and error handling.