|
KiCad PCB EDA Suite
|
Saves DRC panel entries back to .kicad_dru files. More...
#include <drc_re_rule_saver.h>
Public Member Functions | |
| DRC_RULE_SAVER () | |
| 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 | GenerateRulesText (const std::vector< DRC_RE_LOADED_PANEL_ENTRY > &aEntries, const BOARD *aBoard=nullptr) |
| Generate rule text from panel entries. | |
Private Member Functions | |
| wxString | generateRuleText (const DRC_RE_LOADED_PANEL_ENTRY &aEntry, const BOARD *aBoard) |
| Generate the rule text for a single panel entry. | |
| wxString | generateLayerClause (const LSET &aLayers, const BOARD *aBoard) |
| Generate a layer clause from an LSET. | |
| wxString | generateSeverityClause (SEVERITY aSeverity) |
| Generate a severity clause. | |
Saves DRC panel entries back to .kicad_dru files.
This class handles the conversion of graphical panel entries back to text-based DRC rules. It supports round-trip preservation, meaning unedited rules will be saved with their original text intact.
Definition at line 43 of file drc_re_rule_saver.h.
| DRC_RULE_SAVER::DRC_RULE_SAVER | ( | ) |
Definition at line 33 of file drc_re_rule_saver.cpp.
Generate a layer clause from an LSET.
| aLayers | The layer set. |
| aBoard | The board for layer name resolution. |
Definition at line 118 of file drc_re_rule_saver.cpp.
References BOARD::GetLayerName(), and LSET::Seq().
Referenced by generateRuleText().
| wxString DRC_RULE_SAVER::GenerateRulesText | ( | const std::vector< DRC_RE_LOADED_PANEL_ENTRY > & | aEntries, |
| const BOARD * | aBoard = nullptr ) |
Generate rule text from panel entries.
| aEntries | Vector of panel entries to convert. |
| aBoard | Optional board for layer name resolution. |
Definition at line 55 of file drc_re_rule_saver.cpp.
References generateRuleText(), and result.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and SaveFile().
|
private |
Generate the rule text for a single panel entry.
If the entry has not been edited and has original text, the original text is returned for round-trip fidelity. Otherwise, the rule is regenerated from the panel data.
| aEntry | The panel entry to convert. |
| aBoard | Optional board for layer name resolution. |
Definition at line 72 of file drc_re_rule_saver.cpp.
References RULE_GENERATION_CONTEXT::comment, DRC_RE_LOADED_PANEL_ENTRY::condition, RULE_GENERATION_CONTEXT::conditionExpression, RULE_GENERATION_CONTEXT::constraintCode, DRC_RE_LOADED_PANEL_ENTRY::constraintData, generateLayerClause(), DRC_RE_BASE_CONSTRAINT_DATA::GenerateRule(), generateSeverityClause(), RULE_EDITOR_DATA_BASE::GetComment(), DRC_RE_BASE_CONSTRAINT_DATA::GetConstraintCode(), RULE_GENERATION_CONTEXT::layerClause, DRC_RE_LOADED_PANEL_ENTRY::layerCondition, DRC_RE_LOADED_PANEL_ENTRY::originalRuleText, RPT_SEVERITY_ERROR, RPT_SEVERITY_UNDEFINED, DRC_RE_LOADED_PANEL_ENTRY::ruleName, RULE_GENERATION_CONTEXT::ruleName, DRC_RE_LOADED_PANEL_ENTRY::severity, and DRC_RE_LOADED_PANEL_ENTRY::wasEdited.
Referenced by GenerateRulesText().
|
private |
Generate a severity clause.
| aSeverity | The severity level. |
Definition at line 134 of file drc_re_rule_saver.cpp.
References RPT_SEVERITY_ERROR, RPT_SEVERITY_EXCLUSION, RPT_SEVERITY_IGNORE, and RPT_SEVERITY_WARNING.
Referenced by generateRuleText().
| bool DRC_RULE_SAVER::SaveFile | ( | const wxString & | aPath, |
| const std::vector< DRC_RE_LOADED_PANEL_ENTRY > & | aEntries, | ||
| const BOARD * | aBoard = nullptr ) |
Save all panel entries to a file.
| aPath | Path to the output file. |
| aEntries | Vector of panel entries to save. |
| aBoard | Optional board for layer name resolution. |
Definition at line 38 of file drc_re_rule_saver.cpp.
References GenerateRulesText().
Referenced by DIALOG_DRC_RULE_EDITOR::SaveRulesToFile().