38 static const boost::uuids::uuid s_namespace =
39 boost::uuids::string_generator()(
"6f9619ff-8b86-d011-b42d-00cf4fc964ff" );
41 boost::uuids::name_generator_sha1 generator( s_namespace );
42 boost::uuids::uuid uuid = generator( aUniqueId.utf8_string() );
44 return KIID( wxString::FromUTF8( boost::uuids::to_string( uuid ) ) );
52 for(
const wxString& token : wxSplit( aValue,
'|' ) )
54 int eqPos = token.Find(
'=' );
56 if( eqPos == wxNOT_FOUND )
59 wxString key = token.Left( eqPos ).Trim().Trim(
false );
60 wxString val = token.Mid( eqPos + 1 ).Trim().Trim(
false );
62 if( key.CmpNoCase( wxS(
"Designator" ) ) == 0 )
66 else if( key.CmpNoCase( wxS(
"UniqueId" ) ) == 0 )
70 int sep = val.Find(
'\\',
true );
72 if( sep != wxNOT_FOUND )
77 else if( key.CmpNoCase( wxS(
"Kind" ) ) == 0 )
81 entry.
kind =
static_cast<int>( k );
83 else if( key.CmpNoCase( wxS(
"AlternatePart" ) ) == 0 )
100 bool inAlternatePart =
false;
102 for(
const wxString& token : wxSplit( aValue,
'|' ) )
104 int eqPos = token.Find(
'=' );
106 if( eqPos == wxNOT_FOUND )
109 wxString key = token.Left( eqPos ).Trim().Trim(
false );
110 wxString val = token.Mid( eqPos + 1 ).Trim().Trim(
false );
112 if( key.CmpNoCase( wxS(
"AlternatePart" ) ) == 0 )
114 inAlternatePart =
true;
124 if( inAlternatePart && !val.empty() )
134 std::map<wxString, wxString> parameters;
136 wxFileConfig
config( wxEmptyString, wxEmptyString, wxEmptyString, aPrjPcbPath,
137 wxCONFIG_USE_NO_ESCAPE_CHARACTERS );
142 for(
bool more =
config.GetFirstGroup( groupname, groupid ); more;
143 more =
config.GetNextGroup( groupname, groupid ) )
145 if( !groupname.StartsWith( wxS(
"Parameter" ) ) )
150 wxString numStr = groupname.Mid( 9 );
153 if( !numStr.ToLong( &num ) )
156 wxString
name =
config.Read( groupname + wxS(
"/Name" ), wxEmptyString );
161 wxString value =
config.Read( groupname + wxS(
"/Value" ), wxEmptyString );
168 parameters[
name] = value;
177 std::vector<ALTIUM_PROJECT_VARIANT> variants;
179 wxFileConfig
config( wxEmptyString, wxEmptyString, wxEmptyString, aPrjPcbPath,
180 wxCONFIG_USE_NO_ESCAPE_CHARACTERS );
185 for(
bool more =
config.GetFirstGroup( groupname, groupid ); more;
186 more =
config.GetNextGroup( groupname, groupid ) )
188 if( !groupname.StartsWith( wxS(
"ProjectVariant" ) ) )
191 wxString numStr = groupname.Mid( 14 );
194 if( !numStr.ToLong( &num ) )
199 pv.
description =
config.Read( groupname + wxS(
"/Description" ), wxEmptyString );
202 if( pv.
name.empty() )
205 long variationCount = 0;
206 config.Read( groupname + wxS(
"/VariationCount" ), &variationCount, 0 );
208 for(
long vi = 1; vi <= variationCount; ++vi )
210 wxString key = wxString::Format( wxS(
"%s/Variation%ld" ), groupname, vi );
211 wxString value =
config.Read( key, wxEmptyString );
219 pv.
variations.push_back( std::move( entry ) );
223 variants.push_back( std::move( pv ) );
A single component variation within an Altium project variant.
std::map< wxString, wxString > alternateFields