From c97db9b6c41bed18347b3117ad9076ef075dc5cf Mon Sep 17 00:00:00 2001 From: afkiwers Date: Wed, 27 Sep 2023 10:38:25 +1000 Subject: [PATCH] fixed for field duplication This removes case-sensitivity when mapping. --- .../http_lib/sch_http_lib_plugin.cpp | 17 ++++++++--------- .../sch_plugins/http_lib/sch_http_lib_plugin.h | 14 +++++++------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.cpp b/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.cpp index a3b4e68182..538091539c 100644 --- a/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.cpp +++ b/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.cpp @@ -390,40 +390,40 @@ LIB_SYMBOL* SCH_HTTP_LIB_PLUGIN::loadSymbolFromPart( const wxString& aS for( auto& _field : aPart.fields ) { - std::string fieldName = _field.first; - std::tuple fieldProperties = _field.second; + wxString fieldName = wxString( _field.first ); + std::tuple fieldProperties = _field.second; - if( fieldName == footprint_field ) + if( fieldName.Lower() == footprint_field ) { field = &symbol->GetFootprintField(); field->SetText( std::get<0>( fieldProperties ) ); field->SetVisible( std::get<1>( fieldProperties ) ); } - else if( fieldName == description_field ) + else if( fieldName.Lower() == description_field ) { field = &symbol->GetDescriptionField(); field->SetText( std::get<0>( fieldProperties ) ); field->SetVisible( std::get<1>( fieldProperties ) ); } - else if( fieldName == value_field ) + else if( fieldName.Lower() == value_field ) { field = &symbol->GetValueField(); field->SetText( std::get<0>( fieldProperties ) ); field->SetVisible( std::get<1>( fieldProperties ) ); } - else if( fieldName == datasheet_field ) + else if( fieldName.Lower() == datasheet_field ) { field = &symbol->GetDatasheetField(); field->SetText( std::get<0>( fieldProperties ) ); field->SetVisible( std::get<1>( fieldProperties ) ); } - else if( fieldName == reference_field ) + else if( fieldName.Lower() == reference_field ) { field = &symbol->GetReferenceField(); field->SetText( std::get<0>( fieldProperties ) ); field->SetVisible( std::get<1>( fieldProperties ) ); } - else if( fieldName == keywords_field ) + else if( fieldName.Lower() == keywords_field ) { symbol->SetKeyWords( std::get<0>( fieldProperties ) ); } @@ -444,7 +444,6 @@ LIB_SYMBOL* SCH_HTTP_LIB_PLUGIN::loadSymbolFromPart( const wxString& aS return symbol; } - void SCH_HTTP_LIB_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol, const STRING_UTF8_MAP* aProperties ) { diff --git a/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.h b/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.h index 2314d7a4bf..ba950c0e86 100644 --- a/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.h +++ b/eeschema/sch_plugins/http_lib/sch_http_lib_plugin.h @@ -117,13 +117,13 @@ private: wxString m_lastError; - std::string symbol_field = "symbol"; - std::string footprint_field = "footprint"; - std::string description_field = "description"; - std::string keywords_field = "keywords"; - std::string value_field = "value"; - std::string datasheet_field = "datasheet"; - std::string reference_field = "reference"; + wxString symbol_field = "symbol"; + wxString footprint_field = "footprint"; + wxString description_field = "description"; + wxString keywords_field = "keywords"; + wxString value_field = "value"; + wxString datasheet_field = "datasheet"; + wxString reference_field = "reference"; };