KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_assign_netclass.cpp File Reference
#include "dialogs/dialog_assign_netclass.h"
#include <wx/regex.h>
#include <widgets/wx_html_report_box.h>
#include <project.h>
#include <project/project_file.h>
#include <project/net_settings.h>
#include <eda_base_frame.h>
#include <string_utils.h>

Go to the source code of this file.

Functions

wxString UpgradeGlobStarToRegex (const wxString &aPattern)
 
static wxString GetStringCommonPrefix (const wxArrayString &aSet)
 
static wxString GetNetclassPatternForSet (const std::set< wxString > &aNetNames)
 Propose a netclass pattern for a set of net names.
 

Function Documentation

◆ GetNetclassPatternForSet()

static wxString GetNetclassPatternForSet ( const std::set< wxString > & aNetNames)
static

Propose a netclass pattern for a set of net names.

This is a bit of a fudge, as there is no true answer for a perfect pattern. (e.g. if you have A0 and A1, is the answer A*, A[0-9], A[0|1] or A0|A1, or something else?)

Also if you select A0, A1 and there is an A2 in the schematics, is the answer to include A2 or exclude it? E.g. A*, A0|A1 are not the same.

For now, we just glue the net names together with a pipe, handle the most basic case of a single prefix if we can. No attempt is made to see if a star is safe (i.e. the options given are all the options there are).

Definition at line 90 of file dialog_assign_netclass.cpp.

References GetStringCommonPrefix(), INSENSITIVE, StrNumSort(), and UpgradeGlobStarToRegex().

Referenced by DIALOG_ASSIGN_NETCLASS::TransferDataToWindow().

◆ GetStringCommonPrefix()

static wxString GetStringCommonPrefix ( const wxArrayString & aSet)
static

Definition at line 48 of file dialog_assign_netclass.cpp.

Referenced by GetNetclassPatternForSet().

◆ UpgradeGlobStarToRegex()

wxString UpgradeGlobStarToRegex ( const wxString & aPattern)

Definition at line 36 of file dialog_assign_netclass.cpp.

References result.

Referenced by GetNetclassPatternForSet().