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 86 of file kicad_plugin.cpp.

Constructor & Destructor Documentation

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

Definition at line 106 of file kicad_plugin.cpp.

References m_file_name, and m_mod_time.

106  :
107  m_module( aModule )
108 {
109  m_file_name = aFileName;
110 
111  if( m_file_name.FileExists() )
112  m_mod_time = m_file_name.GetModificationTime();
113  else
114  m_mod_time.Now();
115 }
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 96 of file kicad_plugin.cpp.

96 { 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 101 of file kicad_plugin.cpp.

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

Definition at line 95 of file kicad_plugin.cpp.

95 { 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 118 of file kicad_plugin.cpp.

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

119 {
120  if( !m_file_name.FileExists() )
121  return false;
122 
123  wxLogTrace( traceFootprintLibrary, wxT( "File '%s', m_mod_time %s-%s, file mod time: %s-%s." ),
124  GetChars( m_file_name.GetFullPath() ),
125  GetChars( m_mod_time.FormatDate() ), GetChars( m_mod_time.FormatTime() ),
126  GetChars( m_file_name.GetModificationTime().FormatDate() ),
127  GetChars( m_file_name.GetModificationTime().FormatTime() ) );
128 
129  return m_file_name.GetModificationTime() != m_mod_time;
130 }
wxFileName m_file_name
The the full file name and path of the footprint to cache.
static const wxString traceFootprintLibrary(wxT("KicadFootprintLib"))
Definition for enabling and disabling footprint library trace output.
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
void FP_CACHE_ITEM::UpdateModificationTime ( )
inline

Definition at line 102 of file kicad_plugin.cpp.

102 { 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 88 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 89 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 90 of file kicad_plugin.cpp.


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