34 static const boost::uuids::uuid s_namespace =
35 boost::uuids::string_generator()(
"6f9619ff-8b86-d011-b42d-00cf4fc964ff" );
37 boost::uuids::name_generator_sha1 generator( s_namespace );
38 boost::uuids::uuid uuid = generator( aUniqueId.utf8_string() );
40 return KIID( wxString::FromUTF8( boost::uuids::to_string( uuid ) ) );
48 for(
const wxString& token : wxSplit( aValue,
'|' ) )
50 int eqPos = token.Find(
'=' );
52 if( eqPos == wxNOT_FOUND )
55 wxString key = token.Left( eqPos ).Trim().Trim(
false );
56 wxString val = token.Mid( eqPos + 1 ).Trim().Trim(
false );
58 if( key.CmpNoCase( wxS(
"Designator" ) ) == 0 )
62 else if( key.CmpNoCase( wxS(
"UniqueId" ) ) == 0 )
66 int sep = val.Find(
'\\',
true );
68 if( sep != wxNOT_FOUND )
73 else if( key.CmpNoCase( wxS(
"Kind" ) ) == 0 )
77 entry.
kind =
static_cast<int>( k );
79 else if( key.CmpNoCase( wxS(
"AlternatePart" ) ) == 0 )
96 bool inAlternatePart =
false;
98 for(
const wxString& token : wxSplit( aValue,
'|' ) )
100 int eqPos = token.Find(
'=' );
102 if( eqPos == wxNOT_FOUND )
105 wxString key = token.Left( eqPos ).Trim().Trim(
false );
106 wxString val = token.Mid( eqPos + 1 ).Trim().Trim(
false );
108 if( key.CmpNoCase( wxS(
"AlternatePart" ) ) == 0 )
110 inAlternatePart =
true;
120 if( inAlternatePart && !val.empty() )
130 std::map<wxString, wxString> parameters;
132 wxFileConfig
config( wxEmptyString, wxEmptyString, wxEmptyString, aPrjPcbPath,
133 wxCONFIG_USE_NO_ESCAPE_CHARACTERS );
138 for(
bool more =
config.GetFirstGroup( groupname, groupid ); more;
139 more =
config.GetNextGroup( groupname, groupid ) )
141 if( !groupname.StartsWith( wxS(
"Parameter" ) ) )
146 wxString numStr = groupname.Mid( 9 );
149 if( !numStr.ToLong( &num ) )
152 wxString
name =
config.Read( groupname + wxS(
"/Name" ), wxEmptyString );
157 wxString value =
config.Read( groupname + wxS(
"/Value" ), wxEmptyString );
164 parameters[
name] = value;
173 std::vector<ALTIUM_PROJECT_VARIANT> variants;
175 wxFileConfig
config( wxEmptyString, wxEmptyString, wxEmptyString, aPrjPcbPath,
176 wxCONFIG_USE_NO_ESCAPE_CHARACTERS );
181 for(
bool more =
config.GetFirstGroup( groupname, groupid ); more;
182 more =
config.GetNextGroup( groupname, groupid ) )
184 if( !groupname.StartsWith( wxS(
"ProjectVariant" ) ) )
187 wxString numStr = groupname.Mid( 14 );
190 if( !numStr.ToLong( &num ) )
195 pv.
description =
config.Read( groupname + wxS(
"/Description" ), wxEmptyString );
198 if( pv.
name.empty() )
201 long variationCount = 0;
202 config.Read( groupname + wxS(
"/VariationCount" ), &variationCount, 0 );
204 for(
long vi = 1; vi <= variationCount; ++vi )
206 wxString key = wxString::Format( wxS(
"%s/Variation%ld" ), groupname, vi );
207 wxString value =
config.Read( key, wxEmptyString );
215 pv.
variations.push_back( std::move( entry ) );
219 variants.push_back( std::move( pv ) );
A single component variation within an Altium project variant.
std::map< wxString, wxString > alternateFields