KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DRC_RE_BASE_CONSTRAINT_DATA Class Reference

#include <drc_re_base_constraint_data.h>

Inheritance diagram for DRC_RE_BASE_CONSTRAINT_DATA:
RULE_EDITOR_DATA_BASE ICopyable DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA DRC_RE_BOOL_INPUT_CONSTRAINT_DATA DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA DRC_RE_VIA_STYLE_CONSTRAINT_DATA

Public Member Functions

 DRC_RE_BASE_CONSTRAINT_DATA ()=default
 
 DRC_RE_BASE_CONSTRAINT_DATA (int aId, int aParentId, wxString aRuleName)
 
virtual ~DRC_RE_BASE_CONSTRAINT_DATA ()=default
 
virtual VALIDATION_RESULT Validate () const
 Validates the constraint data.
 
virtual wxString GenerateRule (const RULE_GENERATION_CONTEXT &aContext)
 
std::vector< PCB_LAYER_IDGetLayers ()
 
void SetLayers (std::vector< PCB_LAYER_ID > aLayers)
 
wxString GetRuleCondition ()
 
void SetRuleCondition (wxString aRuleCondition)
 
wxString GetConstraintCode ()
 
void SetConstraintCode (wxString aCode)
 
wxString GetGeneratedRule () const
 
void SetGeneratedRule (const wxString &aRule)
 
wxString GetOriginalRuleText () const
 
void SetOriginalRuleText (const wxString &aText)
 
bool WasEdited () const
 
void SetWasEdited (bool aEdited)
 
void CopyFrom (const ICopyable &aSource) override
 
int GetId ()
 Get the unique ID of the rule.
 
void SetId (int aId)
 Set the unique ID of the rule.
 
int GetParentId ()
 Get the parent ID of the rule.
 
void SetParentId (int aParentId)
 Set the parent ID of the rule.
 
wxString GetRuleName ()
 Get the name of the rule.
 
void SetRuleName (wxString aRuleName)
 Set the name of the rule.
 
wxString GetComment ()
 Get the comment associated with the rule.
 
void SetComment (wxString aComment)
 Set the comment for the rule.
 
bool IsNew ()
 Check if the rule is marked as new.
 
void SetIsNew (bool aIsNew)
 Mark the rule as new or not.
 

Protected Member Functions

wxString buildRule (const RULE_GENERATION_CONTEXT &aContext, const std::vector< wxString > &aConstraintClauses) const
 

Static Protected Member Functions

static wxString sanitizeRuleName (const wxString &aRuleName)
 
static wxString quoteString (const wxString &aCondition)
 
static wxString trimTrailingZeros (const wxString &aValue)
 
static wxString formatDouble (double aValue, int aPrecision=6)
 

Private Attributes

std::vector< PCB_LAYER_IDm_layers
 
wxString m_ruleCondition
 
wxString m_constraintCode
 
wxString m_generatedRule
 
wxString m_originalRuleText
 
bool m_wasEdited = false
 
int m_id
 
std::optional< int > m_parentId
 
wxString m_ruleName
 
wxString m_comment
 
bool m_isNew
 Flag indicating if the user is creating a new rule (true) or editing an existing rule (false).
 

Detailed Description

Definition at line 33 of file drc_re_base_constraint_data.h.

Constructor & Destructor Documentation

◆ DRC_RE_BASE_CONSTRAINT_DATA() [1/2]

DRC_RE_BASE_CONSTRAINT_DATA::DRC_RE_BASE_CONSTRAINT_DATA ( )
default

Referenced by CopyFrom(), DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA::DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA(), DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA::DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA(), DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA::DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA(), DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA::DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA(), DRC_RE_BOOL_INPUT_CONSTRAINT_DATA::DRC_RE_BOOL_INPUT_CONSTRAINT_DATA(), DRC_RE_BOOL_INPUT_CONSTRAINT_DATA::DRC_RE_BOOL_INPUT_CONSTRAINT_DATA(), DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA::DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA(), DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA::DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA(), DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA::DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA(), DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA::DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA(), DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA::DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA(), DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA::DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA(), DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA::DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA(), DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA::DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA(), DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA::DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA(), DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA::DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA(), DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA::DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA(), DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA::DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA(), DRC_RE_VIA_STYLE_CONSTRAINT_DATA::DRC_RE_VIA_STYLE_CONSTRAINT_DATA(), and DRC_RE_VIA_STYLE_CONSTRAINT_DATA::DRC_RE_VIA_STYLE_CONSTRAINT_DATA().

◆ DRC_RE_BASE_CONSTRAINT_DATA() [2/2]

DRC_RE_BASE_CONSTRAINT_DATA::DRC_RE_BASE_CONSTRAINT_DATA ( int aId,
int aParentId,
wxString aRuleName )
inlineexplicit

◆ ~DRC_RE_BASE_CONSTRAINT_DATA()

virtual DRC_RE_BASE_CONSTRAINT_DATA::~DRC_RE_BASE_CONSTRAINT_DATA ( )
virtualdefault

Member Function Documentation

◆ buildRule()

◆ CopyFrom()

◆ formatDouble()

◆ GenerateRule()

◆ GetComment()

wxString RULE_EDITOR_DATA_BASE::GetComment ( )
inlineinherited

Get the comment associated with the rule.

Returns
The comment of the rule.

Definition at line 104 of file rule_editor_data_base.h.

References m_comment.

Referenced by DRC_RULE_SAVER::generateRuleText().

◆ GetConstraintCode()

◆ GetGeneratedRule()

wxString DRC_RE_BASE_CONSTRAINT_DATA::GetGeneratedRule ( ) const
inline

Definition at line 67 of file drc_re_base_constraint_data.h.

References m_generatedRule.

◆ GetId()

int RULE_EDITOR_DATA_BASE::GetId ( )
inlineinherited

Get the unique ID of the rule.

Returns
The unique ID of the rule.

Definition at line 62 of file rule_editor_data_base.h.

References m_id.

Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), and DIALOG_DRC_RULE_EDITOR::LoadExistingRules().

◆ GetLayers()

std::vector< PCB_LAYER_ID > DRC_RE_BASE_CONSTRAINT_DATA::GetLayers ( )
inline

Definition at line 55 of file drc_re_base_constraint_data.h.

References m_layers.

◆ GetOriginalRuleText()

wxString DRC_RE_BASE_CONSTRAINT_DATA::GetOriginalRuleText ( ) const
inline

Definition at line 71 of file drc_re_base_constraint_data.h.

References m_originalRuleText.

◆ GetParentId()

int RULE_EDITOR_DATA_BASE::GetParentId ( )
inlineinherited

Get the parent ID of the rule.

Returns
The parent ID of the rule, or -1 if no parent is set.

Definition at line 76 of file rule_editor_data_base.h.

References m_parentId.

Referenced by RULE_EDITOR_DIALOG_BASE::AppendNewRuleTreeItem().

◆ GetRuleCondition()

wxString DRC_RE_BASE_CONSTRAINT_DATA::GetRuleCondition ( )
inline

Definition at line 59 of file drc_re_base_constraint_data.h.

References m_ruleCondition.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ GetRuleName()

wxString RULE_EDITOR_DATA_BASE::GetRuleName ( )
inlineinherited

Get the name of the rule.

Returns
The name of the rule.

Definition at line 90 of file rule_editor_data_base.h.

References m_ruleName.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and DIALOG_DRC_RULE_EDITOR::UpdateRuleTypeTreeItemData().

◆ IsNew()

bool RULE_EDITOR_DATA_BASE::IsNew ( )
inlineinherited

Check if the rule is marked as new.

Returns
True if the rule is new (being created), false if it is being edited.

Definition at line 118 of file rule_editor_data_base.h.

References m_isNew.

Referenced by DIALOG_DRC_RULE_EDITOR::RemoveRule().

◆ quoteString()

static wxString DRC_RE_BASE_CONSTRAINT_DATA::quoteString ( const wxString & aCondition)
inlinestaticprotected

Definition at line 124 of file drc_re_base_constraint_data.h.

References CTX_QUOTED_STR, and EscapeString().

Referenced by buildRule().

◆ sanitizeRuleName()

static wxString DRC_RE_BASE_CONSTRAINT_DATA::sanitizeRuleName ( const wxString & aRuleName)
inlinestaticprotected

Definition at line 93 of file drc_re_base_constraint_data.h.

References result.

Referenced by buildRule().

◆ SetComment()

void RULE_EDITOR_DATA_BASE::SetComment ( wxString aComment)
inlineinherited

Set the comment for the rule.

Parameters
aCommentThe comment to set.

Definition at line 111 of file rule_editor_data_base.h.

References m_comment.

◆ SetConstraintCode()

void DRC_RE_BASE_CONSTRAINT_DATA::SetConstraintCode ( wxString aCode)
inline

◆ SetGeneratedRule()

void DRC_RE_BASE_CONSTRAINT_DATA::SetGeneratedRule ( const wxString & aRule)
inline

Definition at line 69 of file drc_re_base_constraint_data.h.

References m_generatedRule.

◆ SetId()

void RULE_EDITOR_DATA_BASE::SetId ( int aId)
inlineinherited

Set the unique ID of the rule.

Parameters
aIdThe unique ID to set.

Definition at line 69 of file rule_editor_data_base.h.

References m_id.

Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNodeData().

◆ SetIsNew()

void RULE_EDITOR_DATA_BASE::SetIsNew ( bool aIsNew)
inlineinherited

Mark the rule as new or not.

Parameters
aIsNewTrue to mark the rule as new, false to mark it as existing.

Definition at line 125 of file rule_editor_data_base.h.

References m_isNew.

Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNode(), and DIALOG_DRC_RULE_EDITOR::UpdateRuleTypeTreeItemData().

◆ SetLayers()

void DRC_RE_BASE_CONSTRAINT_DATA::SetLayers ( std::vector< PCB_LAYER_ID > aLayers)
inline

Definition at line 57 of file drc_re_base_constraint_data.h.

References m_layers.

◆ SetOriginalRuleText()

void DRC_RE_BASE_CONSTRAINT_DATA::SetOriginalRuleText ( const wxString & aText)
inline

Definition at line 73 of file drc_re_base_constraint_data.h.

References m_originalRuleText.

◆ SetParentId()

void RULE_EDITOR_DATA_BASE::SetParentId ( int aParentId)
inlineinherited

Set the parent ID of the rule.

Parameters
aParentIdThe parent ID to set.

Definition at line 83 of file rule_editor_data_base.h.

References m_parentId.

Referenced by DIALOG_DRC_RULE_EDITOR::buildRuleTreeNodeData().

◆ SetRuleCondition()

void DRC_RE_BASE_CONSTRAINT_DATA::SetRuleCondition ( wxString aRuleCondition)
inline

Definition at line 61 of file drc_re_base_constraint_data.h.

References m_ruleCondition.

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetRuleName()

void RULE_EDITOR_DATA_BASE::SetRuleName ( wxString aRuleName)
inlineinherited

Set the name of the rule.

Parameters
aRuleNameThe name of the rule to set.

Definition at line 97 of file rule_editor_data_base.h.

References m_ruleName.

◆ SetWasEdited()

void DRC_RE_BASE_CONSTRAINT_DATA::SetWasEdited ( bool aEdited)
inline

Definition at line 77 of file drc_re_base_constraint_data.h.

References m_wasEdited.

◆ trimTrailingZeros()

static wxString DRC_RE_BASE_CONSTRAINT_DATA::trimTrailingZeros ( const wxString & aValue)
inlinestaticprotected

Definition at line 129 of file drc_re_base_constraint_data.h.

References result.

Referenced by formatDouble().

◆ Validate()

◆ WasEdited()

bool DRC_RE_BASE_CONSTRAINT_DATA::WasEdited ( ) const
inline

Definition at line 75 of file drc_re_base_constraint_data.h.

References m_wasEdited.

Member Data Documentation

◆ m_comment

wxString RULE_EDITOR_DATA_BASE::m_comment
privateinherited

Definition at line 143 of file rule_editor_data_base.h.

Referenced by CopyFrom(), GetComment(), and SetComment().

◆ m_constraintCode

wxString DRC_RE_BASE_CONSTRAINT_DATA::m_constraintCode
private

Definition at line 192 of file drc_re_base_constraint_data.h.

Referenced by CopyFrom(), GetConstraintCode(), and SetConstraintCode().

◆ m_generatedRule

wxString DRC_RE_BASE_CONSTRAINT_DATA::m_generatedRule
private

Definition at line 193 of file drc_re_base_constraint_data.h.

Referenced by CopyFrom(), GetGeneratedRule(), and SetGeneratedRule().

◆ m_id

int RULE_EDITOR_DATA_BASE::m_id
privateinherited

Definition at line 140 of file rule_editor_data_base.h.

Referenced by GetId(), RULE_EDITOR_DATA_BASE(), and SetId().

◆ m_isNew

bool RULE_EDITOR_DATA_BASE::m_isNew
privateinherited

Flag indicating if the user is creating a new rule (true) or editing an existing rule (false).

Definition at line 144 of file rule_editor_data_base.h.

Referenced by IsNew(), RULE_EDITOR_DATA_BASE(), and SetIsNew().

◆ m_layers

std::vector<PCB_LAYER_ID> DRC_RE_BASE_CONSTRAINT_DATA::m_layers
private

Definition at line 190 of file drc_re_base_constraint_data.h.

Referenced by CopyFrom(), GetLayers(), and SetLayers().

◆ m_originalRuleText

wxString DRC_RE_BASE_CONSTRAINT_DATA::m_originalRuleText
private

◆ m_parentId

std::optional<int> RULE_EDITOR_DATA_BASE::m_parentId
privateinherited

Definition at line 141 of file rule_editor_data_base.h.

Referenced by GetParentId(), RULE_EDITOR_DATA_BASE(), and SetParentId().

◆ m_ruleCondition

wxString DRC_RE_BASE_CONSTRAINT_DATA::m_ruleCondition
private

Definition at line 191 of file drc_re_base_constraint_data.h.

Referenced by GetRuleCondition(), and SetRuleCondition().

◆ m_ruleName

wxString RULE_EDITOR_DATA_BASE::m_ruleName
privateinherited

Definition at line 142 of file rule_editor_data_base.h.

Referenced by GetRuleName(), RULE_EDITOR_DATA_BASE(), and SetRuleName().

◆ m_wasEdited

bool DRC_RE_BASE_CONSTRAINT_DATA::m_wasEdited = false
private

Definition at line 195 of file drc_re_base_constraint_data.h.

Referenced by CopyFrom(), SetWasEdited(), and WasEdited().


The documentation for this class was generated from the following file: