24#include <unordered_set>
28#include <wx/translation.h>
29#include <wx/filename.h>
32#define FMT_UNIMPLEMENTED wxT( "Plugin \"%s\" does not implement the \"%s\" function." )
33#define NOT_IMPLEMENTED( aCaller ) \
34 THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, \
35 GetName().GetData(), \
36 wxString::FromUTF8( aCaller ).GetData() ) );
55 wxString fileExt = wxFileName( aFileName ).GetExt().MakeLower();
57 for(
const std::string& ext : exts )
59 if( fileExt == wxString( ext ).Lower() )
75 wxString fileExt = wxFileName( aFileName ).GetExt().MakeLower();
77 for(
const std::string& ext : exts )
79 if( fileExt == wxString( ext ).Lower() )
85 wxDir dir( aFileName );
91 std::unordered_set<wxString> lowerExts;
93 for(
const std::string& ext : exts )
94 lowerExts.emplace( wxString( ext ).MakeLower() );
98 bool cont = dir.GetFirst( &filenameStr, wxEmptyString, wxDIR_FILES | wxDIR_HIDDEN );
101 wxString ext = wxS(
"" );
103 int idx = filenameStr.Find(
'.',
true );
105 ext = filenameStr.Mid( idx + 1 ).MakeLower();
107 if( lowerExts.count( ext ) )
110 cont = dir.GetNext( &filenameStr );
140 const wxString& aLibraryPath,
149 const wxString& aLibraryPath,
Define a library symbol object.
Holds all the data relating to one schematic.
virtual void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
virtual void SaveSymbol(const wxString &aLibraryPath, const LIB_SYMBOL *aSymbol, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSymbol to an existing library located at aLibraryPath.
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const STRING_UTF8_MAP *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
virtual void SaveLibrary(const wxString &aFileName, const STRING_UTF8_MAP *aProperties=nullptr)
virtual bool CanReadSchematicFile(const wxString &aFileName) const
Checks if this SCH_PLUGIN can read the specified schematic file.
virtual void SymbolLibOptions(STRING_UTF8_MAP *aListToAppendTo) const
Append supported SCH_PLUGIN options to aListToAppenTo along with internationalized descriptions.
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const STRING_UTF8_MAP *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
virtual const wxString & GetError() const
Return an error string to the caller.
virtual void CreateSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Create a new empty symbol library at aLibraryPath.
virtual SCH_SHEET * LoadSchematicFile(const wxString &aFileName, SCHEMATIC *aSchematic, SCH_SHEET *aAppendToMe=nullptr, const STRING_UTF8_MAP *aProperties=nullptr)
Load information from some input file format that this SCH_PLUGIN implementation knows about,...
virtual bool CanReadLibrary(const wxString &aFileName) const
Checks if this SCH_PLUGIN can read the specified symbol library file.
virtual bool DeleteSymbolLib(const wxString &aLibraryPath, const STRING_UTF8_MAP *aProperties=nullptr)
Delete an existing symbol library and returns true if successful, or if library does not exist return...
virtual void SaveSchematicFile(const wxString &aFileName, SCH_SHEET *aSheet, SCHEMATIC *aSchematic, const STRING_UTF8_MAP *aProperties=nullptr)
Write aSchematic to a storage file in a format that this SCH_PLUGIN implementation knows about,...
virtual const PLUGIN_FILE_DESC GetSchematicFileDesc() const
Returns schematic file description for the SCH_PLUGIN.
virtual bool IsSymbolLibWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
virtual const PLUGIN_FILE_DESC GetLibraryFileDesc() const
Returns symbol library description for the SCH_PLUGIN.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
A name/value tuple with unique names and optional values.
#define NOT_IMPLEMENTED(aCaller)
Container that describes file type info.
std::vector< std::string > m_ExtensionsInDir
In case of folders: extensions of files inside.
bool m_IsFile
Whether the library is a folder or a file.
std::vector< std::string > m_FileExtensions
Filter used for file pickers if m_IsFile is true.