95 const wxString& aDocType,
const wxString& aTypeName,
101 result.docType = aDocType;
103 std::set<wxString> allNames;
105 for(
const auto& [
name, item] : aBefore )
106 allNames.insert(
name );
108 for(
const auto& [
name, item] : aAfter )
109 allNames.insert(
name );
114 std::size_t processed = 0;
116 for(
const wxString&
name : allNames )
121 aOptions.
progress( 0.1 + 0.9 * processed / allNames.size() );
123 auto beforeIt = aBefore.find(
name );
124 auto afterIt = aAfter.find(
name );
125 const auto* before = beforeIt == aBefore.end() ? nullptr : beforeIt->second;
126 const auto* after = afterIt == aAfter.end() ? nullptr : afterIt->second;
133 if( before && !after )
136 c.
bbox = aBBox( before );
137 result.changes.push_back( std::move( c ) );
139 else if( !before && after )
142 c.
bbox = aBBox( after );
143 result.changes.push_back( std::move( c ) );
145 else if( before && after && aChanged( before, after ) )
148 c.
bbox = aBBox( after );
149 result.changes.push_back( std::move( c ) );
DOCUMENT_DIFF DiffLibraryByName(const MAP &aBefore, const MAP &aAfter, const wxString &aPath, const wxString &aDocType, const wxString &aTypeName, const KICAD_DIFFER::OPTIONS &aOptions, BBoxFn aBBox, ChangedFn aChanged)
Shared name-keyed library diff used by FP_LIB_DIFFER and SYM_LIB_DIFFER.
wxString result
Test unit parsing edge cases and error handling.