33#include <unordered_set>
44static std::optional<int>
getInPcbUnits(
const nlohmann::json& aObj,
const std::string& aKey,
45 std::optional<int> aDefault = std::optional<int>() )
47 if( aObj.contains( aKey ) && aObj[aKey].is_number() )
48 return pcbIUScale.mmToIU( aObj[aKey].get<double>() );
54static std::optional<int>
getInSchUnits(
const nlohmann::json& aObj,
const std::string& aKey,
55 std::optional<int> aDefault = std::optional<int>() )
57 if( aObj.contains( aKey ) && aObj[aKey].is_number() )
58 return schIUScale.MilsToIU( aObj[aKey].get<double>() );
72 []( nlohmann::json& json_array,
const std::shared_ptr<NETCLASS>& nc )
76 nlohmann::json nc_json = { {
"name", nc->GetName().ToUTF8() },
77 {
"priority", nc->GetPriority() },
78 {
"schematic_color", nc->GetSchematicColor(
true ) },
79 {
"pcb_color", nc->GetPcbColor(
true ) },
80 {
"tuning_profile", nc->GetTuningProfile() } };
83 []( nlohmann::json&
json,
const std::string& aKey,
int aValue )
88 if( nc->HasWireWidth() )
90 {
"wire_width",
schIUScale.IUToMils( nc->GetWireWidth() ) } );
92 if( nc->HasBusWidth() )
93 nc_json.push_back( {
"bus_width",
schIUScale.IUToMils( nc->GetBusWidth() ) } );
95 if( nc->HasLineStyle() )
96 nc_json.push_back( {
"line_style", nc->GetLineStyle() } );
98 if( nc->HasClearance() )
99 saveInPcbUnits( nc_json,
"clearance", nc->GetClearance() );
101 if( nc->HasTrackWidth() )
102 saveInPcbUnits( nc_json,
"track_width", nc->GetTrackWidth() );
104 if( nc->HasViaDiameter() )
105 saveInPcbUnits( nc_json,
"via_diameter", nc->GetViaDiameter() );
107 if( nc->HasViaDrill() )
108 saveInPcbUnits( nc_json,
"via_drill", nc->GetViaDrill() );
110 if( nc->HasuViaDiameter() )
111 saveInPcbUnits( nc_json,
"microvia_diameter", nc->GetuViaDiameter() );
113 if( nc->HasuViaDrill() )
114 saveInPcbUnits( nc_json,
"microvia_drill", nc->GetuViaDrill() );
116 if( nc->HasDiffPairWidth() )
117 saveInPcbUnits( nc_json,
"diff_pair_width", nc->GetDiffPairWidth() );
119 if( nc->HasDiffPairGap() )
120 saveInPcbUnits( nc_json,
"diff_pair_gap", nc->GetDiffPairGap() );
122 if( nc->HasDiffPairViaGap() )
123 saveInPcbUnits( nc_json,
"diff_pair_via_gap", nc->GetDiffPairViaGap() );
125 json_array.push_back( nc_json );
129 [](
const nlohmann::json& entry )
131 wxString
name = entry[
"name"];
133 std::shared_ptr<NETCLASS> nc = std::make_shared<NETCLASS>(
name,
false );
135 int priority = entry[
"priority"];
136 nc->SetPriority( priority );
138 nc->SetTuningProfile( entry[
"tuning_profile"] );
141 nc->SetClearance( *value );
144 nc->SetTrackWidth( *value );
147 nc->SetViaDiameter( *value );
150 nc->SetViaDrill( *value );
152 if(
auto value =
getInPcbUnits( entry,
"microvia_diameter" ) )
153 nc->SetuViaDiameter( *value );
156 nc->SetuViaDrill( *value );
159 nc->SetDiffPairWidth( *value );
162 nc->SetDiffPairGap( *value );
164 if(
auto value =
getInPcbUnits( entry,
"diff_pair_via_gap" ) )
165 nc->SetDiffPairViaGap( *value );
168 nc->SetWireWidth( *value );
171 nc->SetBusWidth( *value );
173 if( entry.contains(
"line_style" ) && entry[
"line_style"].is_number() )
174 nc->SetLineStyle( entry[
"line_style"].get<int>() );
176 if( entry.contains(
"pcb_color" ) && entry[
"pcb_color"].is_string() )
177 nc->SetPcbColor( entry[
"pcb_color"].get<KIGFX::COLOR4D>() );
179 if( entry.contains(
"schematic_color" )
180 && entry[
"schematic_color"].is_string() )
182 nc->SetSchematicColor( entry[
"schematic_color"].get<KIGFX::COLOR4D>() );
189 [&]() -> nlohmann::json
191 nlohmann::json ret = nlohmann::json::array();
197 saveNetclass( ret, netclass );
201 [&](
const nlohmann::json& aJson )
203 if( !aJson.is_array() )
208 for(
const nlohmann::json& entry : aJson )
210 if( !entry.is_object() || !entry.contains(
"name" ) )
213 std::shared_ptr<NETCLASS> nc = readNetClass( entry );
215 if( nc->IsDefault() )
224 [&]() -> nlohmann::json
226 nlohmann::json ret = {};
230 std::string key( netname.ToUTF8() );
231 ret[ std::move( key ) ] = color;
236 [&](
const nlohmann::json& aJson )
238 if( !aJson.is_object() )
243 for(
const auto& pair : aJson.items() )
245 wxString key( pair.key().c_str(), wxConvUTF8 );
252 [&]() -> nlohmann::json
254 nlohmann::json ret = {};
258 nlohmann::json netclassesJson = nlohmann::json::array();
260 for(
const auto& netclass : netclassNames )
262 std::string netclassStr( netclass.ToUTF8() );
263 netclassesJson.push_back( std::move( netclassStr ) );
266 std::string key( netname.ToUTF8() );
267 ret[std::move( key )] = netclassesJson;
272 [&](
const nlohmann::json& aJson )
274 if( !aJson.is_object() )
279 for(
const auto& pair : aJson.items() )
281 wxString key( pair.key().c_str(), wxConvUTF8 );
283 for(
const auto& netclassName : pair.value() )
290 [&]() -> nlohmann::json
292 nlohmann::json ret = nlohmann::json::array();
296 nlohmann::json pattern_json = {
297 {
"pattern", matcher->GetPattern().ToUTF8() },
298 {
"netclass", netclassName.ToUTF8() }
301 ret.push_back( std::move( pattern_json ) );
306 [&](
const nlohmann::json& aJson )
308 if( !aJson.is_array() )
313 for(
const nlohmann::json& entry : aJson )
315 if( !entry.is_object() )
318 if( entry.contains(
"pattern" ) && entry[
"pattern"].is_string()
319 && entry.contains(
"netclass" ) && entry[
"netclass"].is_string() )
321 wxString pattern = entry[
"pattern"].get<wxString>();
322 wxString netclass = entry[
"netclass"].get<wxString>();
326 [&](
const wxString& memberPattern )
348 m_parent->ReleaseNestedSettings(
this );
383 for(
auto& netClass :
m_internals->At(
"classes" ).items() )
385 if( netClass.value().contains(
"nets" ) && netClass.value()[
"nets"].is_array() )
387 nlohmann::json migrated = nlohmann::json::array();
389 for(
auto& net : netClass.value()[
"nets"].items() )
392 netClass.value()[
"nets"] = migrated;
411 nlohmann::json patterns = nlohmann::json::array();
413 for(
auto& netClass :
m_internals->At(
"classes" ).items() )
415 if( netClass.value().contains(
"name" )
416 && netClass.value().contains(
"nets" )
417 && netClass.value()[
"nets"].is_array() )
419 wxString netClassName = netClass.value()[
"name"].get<wxString>();
421 for(
auto& net : netClass.value()[
"nets"].items() )
423 nlohmann::json pattern_json = {
424 {
"pattern", net.value().get<wxString>() },
425 {
"netclass", netClassName }
428 patterns.push_back( pattern_json );
433 m_internals->SetFromString(
"netclass_patterns", patterns );
447 for(
auto& netClass :
m_internals->At(
"classes" ).items() )
450 netClass.value()[
"priority"] = std::numeric_limits<int>::max();
452 netClass.value()[
"priority"] = priority++;
457 if(
m_internals->contains(
"netclass_assignments" )
458 &&
m_internals->At(
"netclass_assignments" ).is_object() )
460 nlohmann::json migrated = {};
462 for(
const auto& pair :
m_internals->At(
"netclass_assignments" ).items() )
464 nlohmann::json netclassesJson = nlohmann::json::array();
466 if( pair.value().get<wxString>() != wxEmptyString )
467 netclassesJson.push_back( pair.value() );
469 migrated[pair.key()] = netclassesJson;
472 m_internals->SetFromString(
"netclass_assignments", migrated );
484 const wxString emptyStr =
"";
486 for(
auto& netClass :
m_internals->At(
"classes" ).items() )
487 netClass.value()[
"tuning_profile"] = emptyStr.ToUTF8();
564 const std::set<wxString>& netclasses )
571 const std::set<wxString>& netclasses )
589 [&](
const wxString& memberPattern )
604 if( assignment.first->GetPattern() == pattern && assignment.second == netclass )
610 { std::make_unique<EDA_COMBINED_MATCHER>( pattern,
CTX_NETCLASS ), netclass } );
615 std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>&& netclassPatterns )
622std::vector<std::pair<std::unique_ptr<EDA_COMBINED_MATCHER>, wxString>>&
686 auto getExplicitNetclass =
687 [
this](
const wxString& netclass ) -> std::shared_ptr<NETCLASS>
703 auto getOrAddImplicitNetcless =
704 [
this](
const wxString& netclass ) -> std::shared_ptr<NETCLASS>
710 std::shared_ptr<NETCLASS> nc = std::make_shared<NETCLASS>( netclass,
false );
711 nc->SetPriority( std::numeric_limits<int>::max() - 1 );
722 if( aNetName.IsEmpty() )
729 return cacheItr->second;
732 std::unordered_set<std::shared_ptr<NETCLASS>> resolvedNetclasses;
739 for(
const wxString& netclassName : it->second )
741 std::shared_ptr<NETCLASS> netclass = getExplicitNetclass( netclassName );
745 resolvedNetclasses.insert( std::move( netclass ) );
749 resolvedNetclasses.insert( getOrAddImplicitNetcless( netclassName ) );
757 if( matcher->StartsWith( aNetName ) )
759 std::shared_ptr<NETCLASS> netclass = getExplicitNetclass( netclassName );
763 resolvedNetclasses.insert( std::move( netclass ) );
767 resolvedNetclasses.insert( getOrAddImplicitNetcless( netclassName ) );
773 if( resolvedNetclasses.size() == 0 )
777 std::shared_ptr<NETCLASS> sharedNetclass;
778 bool allSameNetclass =
true;
779 bool isBusPattern =
false;
782 [&](
const wxString& member )
786 if( member == aNetName )
791 if( !allSameNetclass )
796 if( !sharedNetclass )
798 sharedNetclass = memberNc;
800 else if( memberNc->GetName() != sharedNetclass->GetName() )
802 allSameNetclass =
false;
806 if( isBusPattern && allSameNetclass && sharedNetclass
810 return sharedNetclass;
821 std::vector<NETCLASS*> netclassPtrs;
823 for(
const std::shared_ptr<NETCLASS>& nc : resolvedNetclasses )
824 netclassPtrs.push_back( nc.get() );
827 name.Printf(
"Effective for net: %s", aNetName );
828 std::shared_ptr<NETCLASS> effectiveNetclass = std::make_shared<NETCLASS>(
name,
false );
831 if( netclassPtrs.size() == 1 )
835 return *resolvedNetclasses.begin();
839 effectiveNetclass->SetConstituentNetclasses( std::move( netclassPtrs ) );
844 return effectiveNetclass;
854 std::vector<NETCLASS*> constituents = nc->GetConstituentNetclasses();
856 wxASSERT( constituents.size() > 0 );
861 constituents.pop_back();
865 nc->ResetParameters();
867 nc->SetConstituentNetclasses( std::move( constituents ) );
873 std::vector<NETCLASS*>& constituentNetclasses )
const
877 std::sort( constituentNetclasses.begin(), constituentNetclasses.end(),
880 int p1 = nc1->GetPriority();
881 int p2 = nc2->GetPriority();
887 return nc1->GetName().Cmp( nc2->GetName() ) < 0;
893 for(
auto itr = constituentNetclasses.rbegin(); itr != constituentNetclasses.rend(); ++itr )
900 effectiveNetclass->SetClearanceParent( nc );
906 effectiveNetclass->SetTrackWidthParent( nc );
912 effectiveNetclass->SetViaDiameterParent( nc );
917 effectiveNetclass->SetViaDrill( nc->
GetViaDrill() );
918 effectiveNetclass->SetViaDrillParent( nc );
924 effectiveNetclass->SetuViaDiameterParent( nc );
930 effectiveNetclass->SetuViaDrillParent( nc );
936 effectiveNetclass->SetDiffPairWidthParent( nc );
942 effectiveNetclass->SetDiffPairGapParent( nc );
948 effectiveNetclass->SetDiffPairViaGapParent( nc );
954 effectiveNetclass->SetWireWidthParent( nc );
959 effectiveNetclass->SetBusWidth( nc->
GetBusWidth() );
960 effectiveNetclass->SetBusWidthParent( nc );
966 effectiveNetclass->SetLineStyleParent( nc );
973 effectiveNetclass->SetPcbColor( pcbColor );
974 effectiveNetclass->SetPcbColorParent( nc );
981 effectiveNetclass->SetSchematicColor( schColor );
982 effectiveNetclass->SetSchematicColorParent( nc );
988 effectiveNetclass->SetTuningProfileParent( nc );
1000 bool addedDefault =
false;
1004 addedDefault =
true;
1011 addedDefault =
true;
1018 addedDefault =
true;
1025 addedDefault =
true;
1032 addedDefault =
true;
1039 addedDefault =
true;
1046 addedDefault =
true;
1053 addedDefault =
true;
1068 addedDefault =
true;
1075 addedDefault =
true;
1083 addedDefault =
true;
1088 return addedDefault;
1105 return c ==
'_' || c ==
'^' || c ==
'~';
1122 int backslashCount = 0;
1125 while( pos > 0 && aStr[pos - 1] ==
'\\' )
1132 return ( backslashCount % 2 ) == 1;
1137 std::vector<wxString>* aMemberList )
1142 static wxString digits( wxT(
"0123456789" ) );
1143 return digits.Contains( c );
1146 size_t busLen = aBus.length();
1153 int braceNesting = 0;
1154 bool inQuotes =
false;
1156 prefix.reserve( busLen );
1160 for( ; i < busLen; ++i )
1163 if( aBus[i] ==
'"' && !
isEscaped( aBus, i ) )
1165 inQuotes = !inQuotes;
1172 if( aBus[i] ==
'\\' && i + 1 < busLen )
1175 prefix += aBus[++i];
1185 if( aBus[i] ==
'{' )
1191 if( !prefix.IsEmpty() )
1192 prefix.RemoveLast();
1199 else if( aBus[i] ==
'}' )
1206 if( aBus[i] ==
'\\' && i + 1 < busLen && aBus[i + 1] ==
' ' )
1208 prefix += aBus[++i];
1213 if( aBus[i] ==
' ' || aBus[i] ==
']' )
1216 if( aBus[i] ==
'[' )
1229 for( ; i < busLen; ++i )
1231 if( aBus[i] ==
'.' && i + 1 < busLen && aBus[i+1] ==
'.' )
1233 tmp.ToLong( &begin );
1246 tmp = wxEmptyString;
1251 for( ; i < busLen; ++i )
1253 if( aBus[i] ==
']' )
1268 for( ; i < busLen; ++i )
1270 if( aBus[i] ==
'}' )
1274 else if( aBus[i] ==
'+' || aBus[i] ==
'-' || aBus[i] ==
'P' || aBus[i] ==
'N' )
1284 if( braceNesting != 0 )
1289 else if( begin >
end )
1290 std::swap( begin,
end );
1297 for(
long idx = begin; idx <=
end; ++idx )
1299 wxString str = prefix;
1303 aMemberList->emplace_back( str );
1312 std::vector<wxString>* aMemberList )
1314 size_t groupLen = aGroup.length();
1318 int braceNesting = 0;
1319 bool inQuotes =
false;
1321 prefix.reserve( groupLen );
1326 auto escapeSpacesForBus =
1327 [](
const wxString& aMember ) -> wxString
1330 escaped.reserve( aMember.length() * 2 );
1332 for( wxUniChar c : aMember )
1335 escaped += wxT(
"\\ " );
1345 for( ; i < groupLen; ++i )
1348 if( aGroup[i] ==
'"' && !
isEscaped( aGroup, i ) )
1350 inQuotes = !inQuotes;
1357 if( aGroup[i] ==
'\\' && i + 1 < groupLen )
1360 prefix += aGroup[++i];
1364 prefix += aGroup[i];
1370 if( aGroup[i] ==
'{' )
1376 if( !prefix.IsEmpty() )
1377 prefix.RemoveLast();
1384 else if( aGroup[i] ==
'}' )
1391 if( aGroup[i] ==
'\\' && i + 1 < groupLen && aGroup[i + 1] ==
' ' )
1393 prefix += aGroup[++i];
1398 if( aGroup[i] ==
' ' || aGroup[i] ==
'[' || aGroup[i] ==
']' )
1401 prefix += aGroup[i];
1404 if( braceNesting != 0 )
1419 for( ; i < groupLen; ++i )
1422 if( aGroup[i] ==
'"' && !
isEscaped( aGroup, i ) )
1424 inQuotes = !inQuotes;
1431 if( aGroup[i] ==
'\\' && i + 1 < groupLen )
1444 if( aGroup[i] ==
'{' )
1450 if( !tmp.IsEmpty() )
1458 else if( aGroup[i] ==
'}' )
1467 if( aMemberList && !tmp.IsEmpty() )
1475 if( aGroup[i] ==
'\\' && i + 1 < groupLen && aGroup[i + 1] ==
' ' )
1482 if( aGroup[i] ==
' ' || aGroup[i] ==
',' )
1484 if( aMemberList && !tmp.IsEmpty() )
1499 const std::function<
void(
const wxString& )>& aFunction )
1501 std::vector<wxString> members;
1506 for(
const wxString& member : members )
1507 aFunction( member );
1512 for(
const wxString& member : members )
1518 aFunction( aBusPattern );
constexpr EDA_IU_SCALE schIUScale
constexpr EDA_IU_SCALE pcbIUScale
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
std::unique_ptr< JSON_SETTINGS_INTERNALS > m_internals
A color representation with 4 components: red, green, blue, alpha.
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath, bool aLoadFromFile=true)
A collection of nets and the parameters used to route or test these nets.
void SetViaDiameter(int aDia)
void SetViaDrill(int aSize)
bool HasLineStyle() const
int GetViaDiameter() const
void SetWireWidthParent(NETCLASS *parent)
static const char Default[]
the name of the default NETCLASS
void SetuViaDrillParent(NETCLASS *parent)
bool HasuViaDrill() const
void SetDiffPairWidthParent(NETCLASS *parent)
void SetuViaDiameter(int aSize)
void SetDiffPairWidth(int aSize)
int GetDiffPairViaGap() const
void SetViaDrillParent(NETCLASS *parent)
wxString GetTuningProfile() const
void SetDiffPairGapParent(NETCLASS *parent)
void SetTuningProfileParent(NETCLASS *aParent)
int GetDiffPairGap() const
bool HasViaDiameter() const
bool HasDiffPairWidth() const
bool HasuViaDiameter() const
void SetTrackWidthParent(NETCLASS *parent)
int GetuViaDiameter() const
bool HasTrackWidth() const
void SetViaDiameterParent(NETCLASS *parent)
int GetDiffPairWidth() const
void SetuViaDrill(int aSize)
void SetDiffPairGap(int aSize)
void SetBusWidthParent(NETCLASS *parent)
void SetClearance(int aClearance)
COLOR4D GetPcbColor(bool aIsForSave=false) const
bool HasDiffPairGap() const
COLOR4D GetSchematicColor(bool aIsForSave=false) const
void SetBusWidth(int aWidth)
void SetClearanceParent(NETCLASS *parent)
int GetTrackWidth() const
void SetWireWidth(int aWidth)
void SetTuningProfile(const wxString &aTuningProfile)
bool HasTuningProfile() const
bool HasWireWidth() const
void SetuViaDiameterParent(NETCLASS *parent)
void SetTrackWidth(int aWidth)
bool HasDiffPairViaGap() const
bool HasClearance() const
void ClearAllCaches()
Clears the effective netclass cache for all nets.
std::map< wxString, std::shared_ptr< NETCLASS > > m_compositeNetClasses
Map of netclass names to netclass definitions for.
bool addMissingDefaults(NETCLASS *nc) const
Adds any missing fields to the given netclass from the default netclass.
void ClearNetColorAssignments()
Clears all net name to color assignments Calling user is responsible for resetting the effective netc...
bool operator==(const NET_SETTINGS &aOther) const
void ClearCacheForNet(const wxString &netName)
Clears effective netclass cache for the given net.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const wxString &aNetName)
Fetches the effective (may be aggregate) netclass for the given net name.
bool HasEffectiveNetClass(const wxString &aNetName) const
Determines if an effective netclass for the given net name has been cached.
void addSinglePatternAssignment(const wxString &pattern, const wxString &netclass)
Adds a single pattern assignment without bus expansion (internal helper)
void ClearNetclassLabelAssignments()
Clears all net name to netclasses assignments Calling user is responsible for resetting the effective...
void ClearNetclassLabelAssignment(const wxString &netName)
Clears a specific net name to netclass assignment Calling user is responsible for resetting the effec...
void ClearNetclassPatternAssignments()
Clears all netclass pattern assignments.
std::map< wxString, KIGFX::COLOR4D > m_netColorAssignments
A map of fully-qualified net names to colors used in the board context.
void SetNetclasses(const std::map< wxString, std::shared_ptr< NETCLASS > > &netclasses)
Sets all netclass Calling this method will reset the effective netclass calculation caches.
bool HasNetclassLabelAssignment(const wxString &netName) const
Determines if a given net name has netclasses assigned.
void SetNetclassLabelAssignment(const wxString &netName, const std::set< wxString > &netclasses)
Sets a net name to netclasses assignment Calling user is responsible for resetting the effective netc...
std::shared_ptr< NETCLASS > m_defaultNetClass
The default netclass.
static bool ParseBusGroup(const wxString &aGroup, wxString *name, std::vector< wxString > *aMemberList)
Parse a bus group label into the name and a list of components.
void ClearNetclasses()
Clears all netclasses Calling this method will reset the effective netclass calculation caches.
std::map< wxString, std::shared_ptr< NETCLASS > > m_impicitNetClasses
Map of netclass names to netclass definitions for implicit netclasses.
const std::map< wxString, std::shared_ptr< NETCLASS > > & GetCompositeNetclasses() const
Gets all composite (multiple assignment / missing defaults) netclasses.
std::vector< std::pair< std::unique_ptr< EDA_COMBINED_MATCHER >, wxString > > m_netClassPatternAssignments
List of net class pattern assignments.
std::map< wxString, std::shared_ptr< NETCLASS > > m_effectiveNetclassCache
Cache of nets to pattern-matched netclasses.
void SetNetclassPatternAssignments(std::vector< std::pair< std::unique_ptr< EDA_COMBINED_MATCHER >, wxString > > &&netclassPatterns)
Sets all netclass pattern assignments Calling user is responsible for resetting the effective netclas...
void SetNetclassPatternAssignment(const wxString &pattern, const wxString &netclass)
Sets a netclass pattern assignment Calling this method will reset the effective netclass calculation ...
std::map< wxString, std::shared_ptr< NETCLASS > > m_netClasses
Map of netclass names to netclass definitions.
const std::map< wxString, std::set< wxString > > & GetNetclassLabelAssignments() const
Gets all current net name to netclasses assignments.
const std::map< wxString, std::shared_ptr< NETCLASS > > & GetNetclasses() const
Gets all netclasses.
std::shared_ptr< NETCLASS > GetDefaultNetclass()
Gets the default netclass for the project.
static bool ParseBusVector(const wxString &aBus, wxString *aName, std::vector< wxString > *aMemberList)
Parse a bus vector (e.g.
const std::map< wxString, KIGFX::COLOR4D > & GetNetColorAssignments() const
Gets all net name to color assignments.
std::vector< std::pair< std::unique_ptr< EDA_COMBINED_MATCHER >, wxString > > & GetNetclassPatternAssignments()
Gets the netclass pattern assignments.
void RecomputeEffectiveNetclasses()
Recomputes the internal values of all aggregate effective netclasses Called when a value of a user-de...
std::shared_ptr< NETCLASS > GetCachedEffectiveNetClass(const wxString &aNetName) const
Returns an already cached effective netclass for the given net name.
std::map< wxString, std::set< wxString > > m_netClassLabelAssignments
Map of net names to resolved netclasses.
void SetNetclass(const wxString &netclassName, std::shared_ptr< NETCLASS > &netclass)
Sets the given netclass Calling user is responsible for resetting the effective netclass calculation ...
void makeEffectiveNetclass(std::shared_ptr< NETCLASS > &effectiveNetclass, std::vector< NETCLASS * > &netclasses) const
Creates an effective aggregate netclass from the given constituent netclasses.
void AppendNetclassLabelAssignment(const wxString &netName, const std::set< wxString > &netclasses)
Apppends to a net name to netclasses assignment Calling user is responsible for resetting the effecti...
void SetDefaultNetclass(std::shared_ptr< NETCLASS > netclass)
Sets the default netclass for the project Calling user is responsible for resetting the effective net...
static void ForEachBusMember(const wxString &aBusPattern, const std::function< void(const wxString &)> &aFunction)
Call a function for each member of an expanded bus pattern.
std::shared_ptr< NETCLASS > GetNetClassByName(const wxString &aNetName) const
Get a NETCLASS object from a given Netclass name string.
void SetNetColorAssignment(const wxString &netName, const KIGFX::COLOR4D &color)
Sets a net to color assignment Calling user is responsible for resetting the effective netclass calcu...
NET_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
bool HasNetclass(const wxString &netclassName) const
Determines if the given netclass exists.
Like a normal param, but with custom getter and setter functions.
static bool isSuperSubOverbar(wxChar c)
const int netSettingsSchemaVersion
static bool isEscaped(const wxString &aStr, size_t aPos)
Check if a character at the given position is escaped by a backslash.
static std::optional< int > getInSchUnits(const nlohmann::json &aObj, const std::string &aKey, std::optional< int > aDefault=std::optional< int >())
static std::optional< int > getInPcbUnits(const nlohmann::json &aObj, const std::string &aKey, std::optional< int > aDefault=std::optional< int >())
wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...