|
KiCad PCB EDA Suite
|
#include <drc_rule_editor_utils.h>
Public Types | |
| using | RuleConverter = std::function<std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>( const std::shared_ptr<DRC_RULE>& )> |
Static Public Member Functions | |
| static void | RegisterRuleConverter (RuleConverter aConverter) |
| static bool | IsBoolInputType (const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType) |
| static bool | IsNumericInputType (const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType) |
| static std::string | FormatErrorMessage (const int &aErrorCount, const std::string aErrorMessage) |
| static std::vector< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > > | ParseRules (const wxString &aRules) |
| static bool | SaveRules (const wxString &aFilename, const std::vector< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > > &aRules, const BOARD *aBoard) |
| static wxString | GetConstraintCode (DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType) |
| Translate a rule tree node type into the keyword used by the rules file for that constraint. | |
| static std::optional< DRC_RULE_EDITOR_CONSTRAINT_NAME > | GetConstraintTypeFromCode (const wxString &aCode) |
| Resolve a constraint keyword from a rules file into the corresponding rule tree enumeration value. | |
| static wxString | ConstraintToKicadDrc (DRC_RULE_EDITOR_CONSTRAINT_NAME aType) |
| Convert a constraint type into the keyword used in a .kicad_drc file. | |
| static bool | ConstraintFromKicadDrc (const wxString &aCode, DRC_RE_BASE_CONSTRAINT_DATA *aData) |
| Populate a constraint data object using a keyword from a .kicad_drc file. | |
| static bool | ValidateNumericCtrl (wxTextCtrl *aTextCtrl, std::string aLabel, bool aCanBeZero, int *aErrorCount, std::string *aValidationMessage) |
| Validates a numeric input control, checking if the value is valid, non-empty, and greater than zero. | |
| static bool | ValidateIntegerCtrl (wxTextCtrl *aTextCtrl, std::string aLabel, bool aCanBeZero, int *aErrorCount, std::string *aValidationMessage) |
| Validates an integer input control, ensuring the value is a valid integer, non-empty, and greater than zero. | |
| static bool | ValidateComboCtrl (wxComboBox *aComboBox, std::string aLabel, int *aErrorCount, std::string *aValidationMessage) |
| Validates a combo box control, ensuring that a selection has been made. | |
| static bool | ValidateMinMaxCtrl (wxTextCtrl *aMinTextCtrl, wxTextCtrl *aMaxTextCtrl, std::string aMinLabel, std::string aMaxLabel, int *aErrorCount, std::string *aValidationMessage) |
| Validates the minimum and maximum value controls, ensuring that the minimum value is not greater than the maximum value. | |
| static bool | ValidateMinPreferredMaxCtrl (wxTextCtrl *aMinTextCtrl, wxTextCtrl *aPreferredTextCtrl, wxTextCtrl *aMaxTextCtrl, std::string aMinLabel, std::string aPreferredLabel, std::string aMaxLabel, int *aErrorCount, std::string *aValidationMessage) |
| Validates the minimum, preferred, and maximum value controls, ensuring that: | |
| static bool | ValidateCheckBoxCtrls (const std::vector< wxCheckBox * > &aCheckboxes, std::string aLabel, int *aErrorCount, std::string *aValidationMessage) |
| Validates a list of checkboxes, ensuring that at least one option is selected. | |
| static bool | ValidateNumericValue (double aValue, bool aCanBeZero, const std::string &aLabel, VALIDATION_RESULT *aResult) |
| Validates a numeric value. | |
| static bool | ValidateNumericString (const std::string &aValueStr, bool aCanBeZero, bool aIntegerOnly, const std::string &aLabel, VALIDATION_RESULT *aResult) |
| Validates that a string represents a valid numeric value. | |
| static bool | ValidateMinMax (double aMin, double aMax, const std::string &aMinLabel, const std::string &aMaxLabel, VALIDATION_RESULT *aResult) |
| Validates that min <= max. | |
| static bool | ValidateMinPreferredMax (double aMin, double aPreferred, double aMax, const std::string &aMinLabel, const std::string &aPrefLabel, const std::string &aMaxLabel, VALIDATION_RESULT *aResult) |
| Validates that min <= preferred <= max. | |
| static bool | ValidateAtLeastOneSelected (const std::vector< bool > &aSelected, const std::string &aLabel, VALIDATION_RESULT *aResult) |
| Validates that at least one option is selected. | |
| static bool | ValidateSelection (int aSelectionIndex, const std::string &aLabel, VALIDATION_RESULT *aResult) |
| Validates that a selection has been made (index >= 0). | |
Definition at line 42 of file drc_rule_editor_utils.h.
| using DRC_RULE_EDITOR_UTILS::RuleConverter = std::function<std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>( const std::shared_ptr<DRC_RULE>& )> |
Definition at line 45 of file drc_rule_editor_utils.h.
|
static |
Populate a constraint data object using a keyword from a .kicad_drc file.
| aCode | The keyword read from the rules file. |
| aData | The constraint data instance to update. |
Definition at line 248 of file drc_rule_editor_utils.cpp.
References GetConstraintCode(), GetConstraintTypeFromCode(), and DRC_RE_BASE_CONSTRAINT_DATA::SetConstraintCode().
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleNodeFromKicadDrc().
|
static |
Convert a constraint type into the keyword used in a .kicad_drc file.
| aType | The constraint type to convert. |
Definition at line 242 of file drc_rule_editor_utils.cpp.
References GetConstraintCode().
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode().
|
static |
Definition at line 534 of file drc_rule_editor_utils.cpp.
Referenced by ValidateCheckBoxCtrls(), ValidateComboCtrl(), DRC_RE_ABSOLUTE_LENGTH_TWO_PANEL::ValidateInputs(), DRC_RE_BOOL_INPUT_PANEL::ValidateInputs(), DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_PANEL::ValidateInputs(), DRC_RE_NUMERIC_INPUT_PANEL::ValidateInputs(), DRC_RE_PERMITTED_LAYERS_PANEL::ValidateInputs(), DRC_RE_ROUTING_DIFF_PAIR_PANEL::ValidateInputs(), DRC_RE_ROUTING_WIDTH_PANEL::ValidateInputs(), DRC_RE_VIA_STYLE_PANEL::ValidateInputs(), PANEL_DRC_RULE_EDITOR::ValidateInputs(), ValidateIntegerCtrl(), ValidateMinMaxCtrl(), ValidateMinPreferredMaxCtrl(), and ValidateNumericCtrl().
|
static |
Translate a rule tree node type into the keyword used by the rules file for that constraint.
| aConstraintType | The constraint type selected in the rule tree. |
Definition at line 222 of file drc_rule_editor_utils.cpp.
References sCodeMap.
Referenced by ConstraintFromKicadDrc(), ConstraintToKicadDrc(), and DRC_RULE_LOADER::createConstraintData().
|
static |
Resolve a constraint keyword from a rules file into the corresponding rule tree enumeration value.
| aCode | The textual keyword for the constraint. |
Definition at line 232 of file drc_rule_editor_utils.cpp.
References sCodeReverse.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleNodeFromKicadDrc(), and ConstraintFromKicadDrc().
|
static |
Definition at line 265 of file drc_rule_editor_utils.cpp.
References VIAS_UNDER_SMD.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), PANEL_DRC_RULE_EDITOR::getConstraintPanel(), and RegisterDefaultConverters().
|
static |
Definition at line 275 of file drc_rule_editor_utils.cpp.
References BASIC_CLEARANCE, BOARD_OUTLINE_CLEARANCE, COPPER_TO_EDGE_CLEARANCE, COPPER_TO_HOLE_CLEARANCE, COURTYARD_CLEARANCE, CREEPAGE_DISTANCE, HOLE_SIZE, HOLE_TO_HOLE_CLEARANCE, HOLE_TO_HOLE_DISTANCE, MATCHED_LENGTH_DIFF_PAIR, MAXIMUM_ALLOWED_DEVIATION, MAXIMUM_VIA_COUNT, MINIMUM_ANGULAR_RING, MINIMUM_ANNULAR_WIDTH, MINIMUM_CLEARANCE, MINIMUM_CONNECTION_WIDTH, MINIMUM_ITEM_CLEARANCE, MINIMUM_SOLDERMASK_SILVER, MINIMUM_THERMAL_RELIEF_SPOKE_COUNT, MINIMUM_THROUGH_HOLE, MINIMUM_TRACK_WIDTH, MINIMUM_UVIA_DIAMETER, MINIMUM_UVIA_HOLE, MINIMUM_VIA_DIAMETER, SILK_TO_SILK_CLEARANCE, SILK_TO_SOLDERMASK_CLEARANCE, SOLDERMASK_EXPANSION, and SOLDERPASTE_EXPANSION.
Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), DRC_RULE_LOADER::createConstraintData(), PANEL_DRC_RULE_EDITOR::getConstraintPanel(), and RegisterDefaultConverters().
|
static |
Definition at line 687 of file drc_rule_editor_utils.cpp.
References GetRuleConverters(), DRC_RULES_PARSER::Parse(), and RegisterDefaultConverters().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 100 of file drc_rule_editor_utils.cpp.
References GetRuleConverters().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and RegisterDefaultConverters().
|
static |
Definition at line 734 of file drc_rule_editor_utils.cpp.
References RULE_GENERATION_CONTEXT::comment, RULE_GENERATION_CONTEXT::conditionExpression, RULE_GENERATION_CONTEXT::constraintCode, BOARD::GetLayerName(), RULE_GENERATION_CONTEXT::layerClause, and RULE_GENERATION_CONTEXT::ruleName.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Validates that at least one option is selected.
| aSelected | Vector of boolean values indicating selection state. |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 659 of file drc_rule_editor_utils.cpp.
References VALIDATION_RESULT::AddError().
|
static |
Validates a list of checkboxes, ensuring that at least one option is selected.
| aCheckboxes | A vector of wxCheckBox controls to validate. |
| aLabel | The label for the checkbox list. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 506 of file drc_rule_editor_utils.cpp.
References FormatErrorMessage(), VALIDATE_CHECKBOX_LIST::GetValidationState(), and VALIDATE_CHECKBOX_LIST::NotSelected.
|
static |
Validates a combo box control, ensuring that a selection has been made.
| aComboBox | The combo box control to validate. |
| aLabel | The label of the combo box for error messages. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 396 of file drc_rule_editor_utils.cpp.
References FormatErrorMessage(), VALIDATOR_COMBO_CTRL::GetValidationState(), and VALIDATOR_COMBO_CTRL::NothingSelected.
|
static |
Validates an integer input control, ensuring the value is a valid integer, non-empty, and greater than zero.
| aTextCtrl | The text control to validate. |
| aLabel | The label of the control for error messages. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 355 of file drc_rule_editor_utils.cpp.
References VALIDATOR_NUMERIC_CTRL::Empty, FormatErrorMessage(), VALIDATOR_NUMERIC_CTRL::GetValidationState(), VALIDATOR_NUMERIC_CTRL::NotGreaterThanZero, and VALIDATOR_NUMERIC_CTRL::NotInteger.
|
static |
Validates that min <= max.
| aMin | The minimum value. |
| aMax | The maximum value. |
| aMinLabel | The label for the minimum value. |
| aMaxLabel | The label for the maximum value. |
| aResult | The validation result to update. |
Definition at line 616 of file drc_rule_editor_utils.cpp.
References VALIDATION_RESULT::AddError().
|
static |
Validates the minimum and maximum value controls, ensuring that the minimum value is not greater than the maximum value.
| aMinTextCtrl | The minimum value text control to validate. |
| aMaxTextCtrl | The maximum value text control to validate. |
| aMinLabel | The label for the minimum value text control. |
| aMaxLabel | The label for the maximum value text control. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 422 of file drc_rule_editor_utils.cpp.
References FormatErrorMessage(), VALIDATE_MIN_MAX_CTRL::GetValidationState(), and VALIDATE_MIN_MAX_CTRL::MinGreaterThanMax.
|
static |
Validates that min <= preferred <= max.
| aMin | The minimum value. |
| aPreferred | The preferred value. |
| aMax | The maximum value. |
| aMinLabel | The label for the minimum value. |
| aPrefLabel | The label for the preferred value. |
| aMaxLabel | The label for the maximum value. |
| aResult | The validation result to update. |
Definition at line 629 of file drc_rule_editor_utils.cpp.
References VALIDATION_RESULT::AddError().
|
static |
Validates the minimum, preferred, and maximum value controls, ensuring that:
| aMinTextCtrl | The minimum value text control to validate. |
| aPreferredTextCtrl | The preferred value text control to validate. |
| aMaxTextCtrl | The maximum value text control to validate. |
| aMinLabel | The label for the minimum value text control. |
| aPreferredLabel | The label for the preferred value text control. |
| aMaxLabel | The label for the maximum value text control. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 455 of file drc_rule_editor_utils.cpp.
References FormatErrorMessage(), VALIDATE_MIN_PREFERRED_MAX_CTRL::GetValidationState(), VALIDATE_MIN_PREFERRED_MAX_CTRL::MinGreaterThanMax, VALIDATE_MIN_PREFERRED_MAX_CTRL::MinGreaterThanPreferred, and VALIDATE_MIN_PREFERRED_MAX_CTRL::PreferredGreaterThanMax.
|
static |
Validates a numeric input control, checking if the value is valid, non-empty, and greater than zero.
| aTextCtrl | The text control to validate. |
| aLabel | The label of the control for error messages. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aErrorCount | The count of errors encountered during validation. |
| aValidationMessage | The validation error messages accumulated. |
Definition at line 314 of file drc_rule_editor_utils.cpp.
References VALIDATOR_NUMERIC_CTRL::Empty, FormatErrorMessage(), VALIDATOR_NUMERIC_CTRL::GetValidationState(), VALIDATOR_NUMERIC_CTRL::NotGreaterThanZero, and VALIDATOR_NUMERIC_CTRL::NotNumeric.
|
static |
Validates that a string represents a valid numeric value.
| aValueStr | The string to validate. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aIntegerOnly | If true, only integer values are accepted. |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 555 of file drc_rule_editor_utils.cpp.
References VALIDATION_RESULT::AddError().
|
static |
Validates a numeric value.
| aValue | The value to validate. |
| aCanBeZero | If true, zero is allowed; otherwise, the value must be greater than zero. |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 542 of file drc_rule_editor_utils.cpp.
References VALIDATION_RESULT::AddError().
|
static |
Validates that a selection has been made (index >= 0).
| aSelectionIndex | The selection index (-1 for no selection). |
| aLabel | The label for error messages. |
| aResult | The validation result to update. |
Definition at line 674 of file drc_rule_editor_utils.cpp.
References VALIDATION_RESULT::AddError().