KiCad PCB EDA Suite
FP_CACHE_ITEM Class Reference

Class FP_CACHE_ITEM is helper class for creating a footprint library cache. More...

Public Member Functions

 FP_CACHE_ITEM (MODULE *aModule, const wxFileName &aFileName)
 
wxString GetName () const
 
wxFileName GetFileName () const
 
bool IsModified () const
 Tell if the disk content or the lib_path has changed. More...
 
MODULEGetModule () const
 
void UpdateModificationTime ()
 

Private Attributes

wxFileName m_file_name
 The the full file name and path of the footprint to cache. More...
 
wxDateTime m_mod_time
 The last file modified time stamp. More...
 
std::unique_ptr< MODULEm_module
 

Detailed Description

Class FP_CACHE_ITEM is helper class for creating a footprint library cache.

The new footprint library design is a file path of individual module files that contain a single module per file. This class is a helper only for the footprint portion of the PLUGIN API, and only for the PCB_IO plugin. It is private to this implementation file so it is not placed into a header.

Definition at line 92 of file kicad_plugin.cpp.

Constructor & Destructor Documentation

FP_CACHE_ITEM::FP_CACHE_ITEM ( MODULE aModule,
const wxFileName &  aFileName 
)

Definition at line 112 of file kicad_plugin.cpp.

References m_file_name, and m_mod_time.

112  :
113  m_module( aModule )
114 {
115  m_file_name = aFileName;
116 
117  if( m_file_name.FileExists() )
118  m_mod_time = m_file_name.GetModificationTime();
119  else
120  m_mod_time.Now();
121 }
std::unique_ptr< MODULE > m_module
wxFileName m_file_name
The the full file name and path of the footprint to cache.
wxDateTime m_mod_time
The last file modified time stamp.

Member Function Documentation

wxFileName FP_CACHE_ITEM::GetFileName ( ) const
inline

Definition at line 102 of file kicad_plugin.cpp.

102 { return m_file_name; }
wxFileName m_file_name
The the full file name and path of the footprint to cache.
MODULE* FP_CACHE_ITEM::GetModule ( ) const
inline

Definition at line 107 of file kicad_plugin.cpp.

107 { return m_module.get(); }
std::unique_ptr< MODULE > m_module
wxString FP_CACHE_ITEM::GetName ( ) const
inline

Definition at line 101 of file kicad_plugin.cpp.

101 { return m_file_name.GetDirs().Last(); }
wxFileName m_file_name
The the full file name and path of the footprint to cache.
bool FP_CACHE_ITEM::IsModified ( ) const

Tell if the disk content or the lib_path has changed.

Definition at line 124 of file kicad_plugin.cpp.

References GetChars(), m_file_name, m_mod_time, and traceFootprintLibrary.

125 {
126  if( !m_file_name.FileExists() )
127  return false;
128 
129  wxLogTrace( traceFootprintLibrary, wxT( "File '%s', m_mod_time %s-%s, file mod time: %s-%s." ),
130  GetChars( m_file_name.GetFullPath() ),
131  GetChars( m_mod_time.FormatDate() ), GetChars( m_mod_time.FormatTime() ),
132  GetChars( m_file_name.GetModificationTime().FormatDate() ),
133  GetChars( m_file_name.GetModificationTime().FormatTime() ) );
134 
135  return m_file_name.GetModificationTime() != m_mod_time;
136 }
wxFileName m_file_name
The the full file name and path of the footprint to cache.
wxDateTime m_mod_time
The last file modified time stamp.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
static const wxString traceFootprintLibrary
Flag to enable KiCad PCB plugin debug output.
void FP_CACHE_ITEM::UpdateModificationTime ( )
inline

Definition at line 108 of file kicad_plugin.cpp.

108 { m_mod_time = m_file_name.GetModificationTime(); }
wxFileName m_file_name
The the full file name and path of the footprint to cache.
wxDateTime m_mod_time
The last file modified time stamp.

Member Data Documentation

wxFileName FP_CACHE_ITEM::m_file_name
private

The the full file name and path of the footprint to cache.

Definition at line 94 of file kicad_plugin.cpp.

Referenced by FP_CACHE_ITEM(), and IsModified().

wxDateTime FP_CACHE_ITEM::m_mod_time
private

The last file modified time stamp.

Definition at line 95 of file kicad_plugin.cpp.

Referenced by FP_CACHE_ITEM(), and IsModified().

std::unique_ptr<MODULE> FP_CACHE_ITEM::m_module
private

Definition at line 96 of file kicad_plugin.cpp.


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