21#include <unordered_set> 
   29#include <wx/filename.h> 
   30#include <wx/translation.h> 
   33#define FMT_UNIMPLEMENTED wxT( "IO interface \"%s\" does not implement the \"%s\" function." ) 
   34#define NOT_IMPLEMENTED( aCaller )                                       \ 
   35    THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED,                 \ 
   37                                      wxString::FromUTF8( aCaller ) ) ); 
 
   47                             const std::map<std::string, UTF8>* aProperties )
 
 
   54                             const std::map<std::string, UTF8>* aProperties )
 
 
   79        wxString fileExt = wxFileName( aFileName ).GetExt().Lower();
 
   81        for( 
const std::string& ext : exts )
 
   83            if( fileExt == wxString( ext ).Lower() )
 
   89        wxDir dir( aFileName );
 
   95        std::unordered_set<wxString> lowerExts;
 
   97        for( 
const std::string& ext : exts )
 
   98            lowerExts.emplace( wxString( ext ).MakeLower() );
 
  100        wxString filenameStr;
 
  102        bool cont = dir.GetFirst( &filenameStr, wxEmptyString, wxDIR_FILES | wxDIR_HIDDEN );
 
  106            wxString ext = wxS( 
"" );
 
  108            int idx = filenameStr.Find( 
'.', 
true );
 
  111                ext = filenameStr.Mid( idx + 1 ).MakeLower();
 
  113            if( lowerExts.count( ext ) )
 
  116            cont = dir.GetNext( &filenameStr );
 
 
virtual void AdvanceProgressPhase()
 
REPORTER * m_reporter
Reporter to log errors/warnings to, may be nullptr.
 
virtual bool DeleteLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
Delete an existing library and returns true, or if library does not exist returns false,...
 
virtual const IO_FILE_DESC GetLibraryDesc() const =0
Get the descriptor for the library container that this IO plugin operates on.
 
virtual void GetLibraryOptions(std::map< std::string, UTF8 > *aListToAppendTo) const
Append supported IO options to aListToAppenTo along with internationalized descriptions.
 
PROGRESS_REPORTER * m_progressReporter
Progress reporter to track the progress of the operation, may be nullptr.
 
virtual bool CanReadLibrary(const wxString &aFileName) const
Checks if this IO object can read the specified library file/directory.
 
virtual bool IsLibraryWritable(const wxString &aLibraryPath)
Return true if the library at aLibraryPath is writable.
 
virtual void CreateLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
Create a new empty library at aLibraryPath empty.
 
virtual void Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
 
#define NOT_IMPLEMENTED(aCaller)
 
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
 
Container that describes file type info.
 
std::vector< std::string > m_ExtensionsInDir
 
bool m_IsFile
Whether the library is a folder or a file.
 
wxString m_Description
Description shown in the file picker dialog.
 
std::vector< std::string > m_FileExtensions
Filter used for file pickers if m_IsFile is true.
 
wxString FileFilter() const
 
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
 
Definition of file extensions used in Kicad.