32#include <wx/filename.h>
52 std::vector<std::unique_ptr<LIB_SYMBOL>> owners;
57 wxFileName absPath( aPath );
58 absPath.MakeAbsolute();
59 wxString absStr = absPath.GetFullPath();
62 std::vector<LIB_SYMBOL*> rawList;
78 std::unique_ptr<LIB_SYMBOL> owner(
new LIB_SYMBOL( *sym ) );
79 map[owner->GetName()] = owner.get();
80 owners.push_back( std::move( owner ) );
86 std::map<wxString, LIB_SYMBOL*> byName;
88 for(
const std::unique_ptr<LIB_SYMBOL>& owner : owners )
89 byName[owner->GetName()] = owner.get();
91 for(
const std::unique_ptr<LIB_SYMBOL>& owner : owners )
93 if( owner->GetParentName().IsEmpty() )
96 auto it = byName.find( owner->GetParentName() );
98 if( it != byName.end() )
99 owner->SetParent( it->second );
102 return { std::move( owners ), std::move( map ) };
110 std::unique_ptr<LIB_SYMBOL> before = aBefore->
Flatten();
111 std::unique_ptr<LIB_SYMBOL> after = aAfter->
Flatten();
129 return hasSymbolDifferences( aA, aB );
143 std::unique_ptr<LIB_SYMBOL> before = beforeIt->second->Flatten();
144 std::unique_ptr<LIB_SYMBOL> after = afterIt->second->Flatten();
152 child.
kind = element.kind;
155 if( !element.key.IsEmpty() )
156 child.
refdes = element.key;
158 change.
children.push_back( std::move( child ) );
const SYMBOL_MAP & m_before
~SYM_LIB_DIFFER() override
SYM_LIB_DIFFER(const SYMBOL_MAP &aBefore, const SYMBOL_MAP &aAfter, const wxString &aPath=wxEmptyString)
const SYMBOL_MAP & m_after
DOCUMENT_DIFF Diff() override
Produce a DOCUMENT_DIFF of the inputs the concrete differ was constructed with.
static std::pair< std::vector< std::unique_ptr< LIB_SYMBOL > >, SYMBOL_MAP > LoadLibrary(const wxString &aPath)
Convenience: load a .kicad_sym path into a SYMBOL_MAP using SCH_IO_KICAD_SEXPR::EnumerateSymbolLib.
std::map< wxString, const LIB_SYMBOL * > SYMBOL_MAP
Library content is a map of (canonical_name -> LIB_SYMBOL*).
Define a library symbol object.
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true, bool aIgnoreLabelsOnInvisiblePins=true) const
Get the bounding box for the symbol.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
A SCH_IO derivation for loading schematic files using the new s-expression file format.
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
std::vector< SYM_ELEMENT > DiffSymbolElements(const LIB_SYMBOL *aBefore, const LIB_SYMBOL *aAfter)
Compares the elements of two library symbols.
std::vector< PROPERTY_DELTA > DiffItemProperties(const INSPECTABLE *aBefore, const INSPECTABLE *aAfter)
Enumerate the property deltas between two items of the same dynamic type.
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.
The full set of changes between two parsed documents of one type.
One change record on a single item.
std::vector< PROPERTY_DELTA > properties
std::optional< wxString > refdes
std::vector< ITEM_CHANGE > children
wxString result
Test unit parsing edge cases and error handling.