|
KiCad PCB EDA Suite
|
Loads DRC rules from .kicad_dru files and converts them to panel entries. More...
#include <drc_re_rule_loader.h>
Public Member Functions | |
| DRC_RULE_LOADER () | |
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > | LoadRule (const DRC_RULE &aRule, const wxString &aOriginalText) |
| Load a single DRC_RULE and convert it to panel entries. | |
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > | LoadFile (const wxString &aPath) |
| Load all rules from a .kicad_dru file. | |
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > | LoadFromString (const wxString &aRulesText) |
| Load rules from a text string. | |
Private Member Functions | |
| std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > | createConstraintData (DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, const DRC_RULE &aRule, const std::set< DRC_CONSTRAINT_T > &aClaimedConstraints) |
| Create the appropriate constraint data object for a panel type. | |
| const DRC_CONSTRAINT * | findConstraint (const DRC_RULE &aRule, DRC_CONSTRAINT_T aType) |
| Find a constraint of a specific type in a rule. | |
| double | toMM (int aValue) |
| Convert internal units (nanometers) to millimeters. | |
| wxString | extractRuleText (const wxString &aContent, const wxString &aRuleName) |
| Extract the complete original text of a rule from file content. | |
Private Attributes | |
| DRC_PANEL_MATCHER | m_matcher |
Loads DRC rules from .kicad_dru files and converts them to panel entries.
This class handles the conversion of text-based DRC rules into the appropriate graphical panel representations. Rules with multiple constraints may be split across multiple panel entries, with the condition and severity duplicated to each.
Definition at line 47 of file drc_re_rule_loader.h.
| DRC_RULE_LOADER::DRC_RULE_LOADER | ( | ) |
Definition at line 46 of file drc_re_rule_loader.cpp.
|
private |
Create the appropriate constraint data object for a panel type.
| aPanel | The target panel type. |
| aRule | The source rule. |
| aClaimedConstraints | The constraints this panel should handle. |
Definition at line 70 of file drc_re_rule_loader.cpp.
References ABSOLUTE_LENGTH, ALLOWED_ORIENTATION, ASSERTION_CONSTRAINT, DRC_RULE_EDITOR_UTILS::CreateNumericConstraintData(), CUSTOM_RULE, DIFF_PAIR_GAP_CONSTRAINT, DISALLOW_CONSTRAINT, DRC_DISALLOW_BLIND_VIAS, DRC_DISALLOW_BURIED_VIAS, DRC_DISALLOW_MICRO_VIAS, DRC_DISALLOW_THROUGH_VIAS, findConstraint(), DRC_RULE_EDITOR_UTILS::GetConstraintCode(), DRC_RULE_CONDITION::GetExpression(), DRC_CONSTRAINT::GetValue(), HOLE_SIZE_CONSTRAINT, DRC_RULE_EDITOR_UTILS::IsNumericInputType(), LENGTH_CONSTRAINT, DRC_CONSTRAINT::m_DisallowFlags, DRC_RULE::m_Name, DRC_CONSTRAINT::m_Test, MATCHED_LENGTH_DIFF_PAIR, MINOPTMAX< T >::Max(), MAX_UNCOUPLED_CONSTRAINT, MINOPTMAX< T >::Min(), MIN_RESOLVED_SPOKES_CONSTRAINT, MINIMUM_TEXT_HEIGHT_AND_THICKNESS, MINOPTMAX< T >::Opt(), PERMITTED_LAYERS, ROUTING_DIFF_PAIR, ROUTING_WIDTH, SKEW_CONSTRAINT, TEXT_HEIGHT_CONSTRAINT, TEXT_THICKNESS_CONSTRAINT, toMM(), TRACK_WIDTH_CONSTRAINT, VIA_COUNT_CONSTRAINT, VIA_DIAMETER_CONSTRAINT, VIA_STYLE, and VIAS_UNDER_SMD.
Referenced by LoadRule().
|
private |
Extract the complete original text of a rule from file content.
| aContent | The full file content. |
| aRuleName | The name of the rule to extract. |
Definition at line 436 of file drc_re_rule_loader.cpp.
Referenced by LoadFromString().
|
private |
Find a constraint of a specific type in a rule.
| aRule | The rule to search. |
| aType | The constraint type to find. |
Definition at line 57 of file drc_re_rule_loader.cpp.
References DRC_RULE::m_Constraints, and DRC_CONSTRAINT::m_Type.
Referenced by createConstraintData(), and LoadRule().
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > DRC_RULE_LOADER::LoadFile | ( | const wxString & | aPath | ) |
Load all rules from a .kicad_dru file.
| aPath | Path to the rules file. |
Definition at line 527 of file drc_re_rule_loader.cpp.
References LoadFromString().
Referenced by DIALOG_DRC_RULE_EDITOR::LoadExistingRules().
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > DRC_RULE_LOADER::LoadFromString | ( | const wxString & | aRulesText | ) |
Load rules from a text string.
| aRulesText | The text content of the rules. |
Definition at line 401 of file drc_re_rule_loader.cpp.
References extractRuleText(), LoadRule(), and DRC_RULES_PARSER::Parse().
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(), 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 LoadFile().
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > DRC_RULE_LOADER::LoadRule | ( | const DRC_RULE & | aRule, |
| const wxString & | aOriginalText ) |
Load a single DRC_RULE and convert it to panel entries.
If the rule contains more constraints than a single panel can handle, it will be split into multiple entries, preserving order.
| aRule | The parsed DRC rule to convert. |
| aOriginalText | The original text of the rule for round-trip fidelity. |
Definition at line 333 of file drc_re_rule_loader.cpp.
References ALLOWED_ORIENTATION, ASSERTION_CONSTRAINT, createConstraintData(), CUSTOM_RULE, findConstraint(), DRC_RULE_CONDITION::GetExpression(), DRC_RE_LOADED_PANEL_ENTRY::layerSource, DRC_RULE::m_Condition, DRC_RULE::m_LayerCondition, DRC_RULE::m_LayerSource, m_matcher, DRC_RULE::m_Name, DRC_RULE::m_Severity, DRC_CONSTRAINT::m_Test, DRC_RE_LOADED_PANEL_ENTRY::originalRuleText, and PERMITTED_LAYERS.
Referenced by LoadFromString().
|
private |
Convert internal units (nanometers) to millimeters.
Definition at line 51 of file drc_re_rule_loader.cpp.
Referenced by createConstraintData().
|
private |
Definition at line 118 of file drc_re_rule_loader.h.
Referenced by LoadRule().