KiCad PCB EDA Suite
SCH_NETNAME_VALIDATOR Class Reference

#include <sch_validators.h>

Inheritance diagram for SCH_NETNAME_VALIDATOR:
NETNAME_VALIDATOR

Public Member Functions

 SCH_NETNAME_VALIDATOR (wxString *aVal=nullptr)
 
 SCH_NETNAME_VALIDATOR (bool aAllowSpaces)
 
 SCH_NETNAME_VALIDATOR (const SCH_NETNAME_VALIDATOR &aValidator)
 
virtual wxObject * Clone () const override
 
virtual bool TransferToWindow () override
 
virtual bool TransferFromWindow () override
 
virtual bool Validate (wxWindow *aParent) override
 

Protected Member Functions

wxString IsValid (const wxString &aVal) const override
 

Detailed Description

Definition at line 77 of file sch_validators.h.

Constructor & Destructor Documentation

◆ SCH_NETNAME_VALIDATOR() [1/3]

SCH_NETNAME_VALIDATOR::SCH_NETNAME_VALIDATOR ( wxString *  aVal = nullptr)
inline

Definition at line 80 of file sch_validators.h.

80  :
81  NETNAME_VALIDATOR( aVal )
82  { }
NETNAME_VALIDATOR(wxString *aVal=nullptr)
Definition: validators.cpp:319

◆ SCH_NETNAME_VALIDATOR() [2/3]

SCH_NETNAME_VALIDATOR::SCH_NETNAME_VALIDATOR ( bool  aAllowSpaces)
inline

Definition at line 84 of file sch_validators.h.

84  :
85  NETNAME_VALIDATOR( aAllowSpaces )
86  { }
NETNAME_VALIDATOR(wxString *aVal=nullptr)
Definition: validators.cpp:319

◆ SCH_NETNAME_VALIDATOR() [3/3]

SCH_NETNAME_VALIDATOR::SCH_NETNAME_VALIDATOR ( const SCH_NETNAME_VALIDATOR aValidator)
inline

Definition at line 88 of file sch_validators.h.

88  :
89  NETNAME_VALIDATOR( aValidator )
90  { }
NETNAME_VALIDATOR(wxString *aVal=nullptr)
Definition: validators.cpp:319

Member Function Documentation

◆ Clone()

virtual wxObject* NETNAME_VALIDATOR::Clone ( ) const
inlineoverridevirtualinherited

Definition at line 207 of file validators.h.

207 { return new NETNAME_VALIDATOR( *this ); }
NETNAME_VALIDATOR(wxString *aVal=nullptr)
Definition: validators.cpp:319

References NETNAME_VALIDATOR::NETNAME_VALIDATOR().

◆ IsValid()

wxString SCH_NETNAME_VALIDATOR::IsValid ( const wxString &  aVal) const
overrideprotected

Definition at line 191 of file sch_validators.cpp.

192 {
193  if( NET_SETTINGS::ParseBusGroup( str, nullptr, nullptr ) )
194  return wxString();
195 
196  if( ( str.Contains( '[' ) || str.Contains( ']' ) ) &&
197  !NET_SETTINGS::ParseBusVector( str, nullptr, nullptr ) )
198  return _( "Signal name contains '[' or ']' but is not a valid vector bus name" );
199 
200  return NETNAME_VALIDATOR::IsValid( str );
201 }
static bool ParseBusGroup(wxString aGroup, wxString *name, std::vector< wxString > *aMemberList)
Parses a bus group label into the name and a list of components.
#define _(s)
Definition: 3d_actions.cpp:33
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parses a bus vector (e.g.
wxString IsValid(const wxString &aVal) const override
Definition: validators.cpp:364

References _, NETNAME_VALIDATOR::IsValid(), NET_SETTINGS::ParseBusGroup(), and NET_SETTINGS::ParseBusVector().

◆ TransferFromWindow()

virtual bool NETNAME_VALIDATOR::TransferFromWindow ( )
inlineoverridevirtualinherited

Definition at line 211 of file validators.h.

211 { return true; }

◆ TransferToWindow()

virtual bool NETNAME_VALIDATOR::TransferToWindow ( )
inlineoverridevirtualinherited

Definition at line 209 of file validators.h.

209 { return true; }

◆ Validate()

bool NETNAME_VALIDATOR::Validate ( wxWindow *  aParent)
overridevirtualinherited

Definition at line 340 of file validators.cpp.

341 {
342  // If window is disabled, simply return
343  if ( !m_validatorWindow->IsEnabled() )
344  return true;
345 
346  wxTextEntry * const text = GetTextEntry();
347 
348  if ( !text )
349  return false;
350 
351  const wxString& errormsg = IsValid( text->GetValue() );
352 
353  if( !errormsg.empty() )
354  {
355  m_validatorWindow->SetFocus();
356  wxMessageBox( errormsg, _( "Invalid signal name" ), wxOK | wxICON_EXCLAMATION, aParent );
357  return false;
358  }
359 
360  return true;
361 }
#define _(s)
Definition: 3d_actions.cpp:33
wxString IsValid(const wxString &aVal) const override
Definition: validators.cpp:364

References _, and NETNAME_VALIDATOR::IsValid().


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