KiCad PCB EDA Suite
LIBRARY_TRAVERSER Class Reference

Traverser implementation that looks to find any and all "folder" libraries by looking for files with a specific extension inside folders. More...

Inheritance diagram for LIBRARY_TRAVERSER:

Public Member Functions

 LIBRARY_TRAVERSER (wxString aSearchExtension, wxString aInitialDir)
 
virtual wxDirTraverseResult OnFile (const wxString &aFileName) override
 
virtual wxDirTraverseResult OnOpenError (const wxString &aOpenErrorName) override
 
bool HasDirectoryOpenFailures ()
 
virtual wxDirTraverseResult OnDir (const wxString &aDirName) override
 
void GetPaths (wxArrayString &aPathArray)
 
void GetFailedPaths (wxArrayString &aPathArray)
 

Private Attributes

wxString m_searchExtension
 
wxString m_currentDir
 
std::unordered_map< wxString, int > m_foundDirs
 
std::unordered_map< wxString, int > m_failedDirs
 

Detailed Description

Traverser implementation that looks to find any and all "folder" libraries by looking for files with a specific extension inside folders.

Definition at line 141 of file panel_fp_lib_table.cpp.

Constructor & Destructor Documentation

◆ LIBRARY_TRAVERSER()

LIBRARY_TRAVERSER::LIBRARY_TRAVERSER ( wxString  aSearchExtension,
wxString  aInitialDir 
)
inline

Definition at line 144 of file panel_fp_lib_table.cpp.

145  : m_searchExtension( aSearchExtension ),
146  m_currentDir( aInitialDir )
147  {
148  }

Member Function Documentation

◆ GetFailedPaths()

void LIBRARY_TRAVERSER::GetFailedPaths ( wxArrayString &  aPathArray)
inline

Definition at line 183 of file panel_fp_lib_table.cpp.

184  {
185  for( std::pair<const wxString, int>& failedDirsPair : m_failedDirs )
186  aPathArray.Add( failedDirsPair.first );
187  }
std::unordered_map< wxString, int > m_failedDirs

References m_failedDirs.

◆ GetPaths()

void LIBRARY_TRAVERSER::GetPaths ( wxArrayString &  aPathArray)
inline

Definition at line 177 of file panel_fp_lib_table.cpp.

178  {
179  for( std::pair<const wxString, int>& foundDirsPair : m_foundDirs )
180  aPathArray.Add( foundDirsPair.first );
181  }
std::unordered_map< wxString, int > m_foundDirs

References m_foundDirs.

Referenced by PANEL_FP_LIB_TABLE::browseLibrariesHandler().

◆ HasDirectoryOpenFailures()

bool LIBRARY_TRAVERSER::HasDirectoryOpenFailures ( )
inline

Definition at line 166 of file panel_fp_lib_table.cpp.

167  {
168  return m_failedDirs.size() > 0;
169  }
std::unordered_map< wxString, int > m_failedDirs

References m_failedDirs.

◆ OnDir()

virtual wxDirTraverseResult LIBRARY_TRAVERSER::OnDir ( const wxString &  aDirName)
inlineoverridevirtual

Definition at line 171 of file panel_fp_lib_table.cpp.

172  {
173  m_currentDir = aDirName;
174  return wxDIR_CONTINUE;
175  }

References m_currentDir.

◆ OnFile()

virtual wxDirTraverseResult LIBRARY_TRAVERSER::OnFile ( const wxString &  aFileName)
inlineoverridevirtual

Definition at line 150 of file panel_fp_lib_table.cpp.

151  {
152  wxFileName file( aFileName );
153 
154  if( m_searchExtension.IsSameAs( file.GetExt(), false ) )
155  m_foundDirs.insert( { m_currentDir, 1 } );
156 
157  return wxDIR_CONTINUE;
158  }
std::unordered_map< wxString, int > m_foundDirs

References m_currentDir, m_foundDirs, and m_searchExtension.

◆ OnOpenError()

virtual wxDirTraverseResult LIBRARY_TRAVERSER::OnOpenError ( const wxString &  aOpenErrorName)
inlineoverridevirtual

Definition at line 160 of file panel_fp_lib_table.cpp.

161  {
162  m_failedDirs.insert( { aOpenErrorName, 1 } );
163  return wxDIR_IGNORE;
164  }
std::unordered_map< wxString, int > m_failedDirs

References m_failedDirs.

Member Data Documentation

◆ m_currentDir

wxString LIBRARY_TRAVERSER::m_currentDir
private

Definition at line 191 of file panel_fp_lib_table.cpp.

Referenced by OnDir(), and OnFile().

◆ m_failedDirs

std::unordered_map<wxString, int> LIBRARY_TRAVERSER::m_failedDirs
private

Definition at line 193 of file panel_fp_lib_table.cpp.

Referenced by GetFailedPaths(), HasDirectoryOpenFailures(), and OnOpenError().

◆ m_foundDirs

std::unordered_map<wxString, int> LIBRARY_TRAVERSER::m_foundDirs
private

Definition at line 192 of file panel_fp_lib_table.cpp.

Referenced by GetPaths(), and OnFile().

◆ m_searchExtension

wxString LIBRARY_TRAVERSER::m_searchExtension
private

Definition at line 190 of file panel_fp_lib_table.cpp.

Referenced by OnFile().


The documentation for this class was generated from the following file: