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

Constructor & Destructor Documentation

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

Definition at line 109 of file kicad_plugin.cpp.

References m_file_name, and m_mod_time.

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

99 { 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 104 of file kicad_plugin.cpp.

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

Definition at line 98 of file kicad_plugin.cpp.

98 { 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 121 of file kicad_plugin.cpp.

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

122 {
123  if( !m_file_name.FileExists() )
124  return false;
125 
126  wxLogTrace( traceFootprintLibrary, wxT( "File '%s', m_mod_time %s-%s, file mod time: %s-%s." ),
127  GetChars( m_file_name.GetFullPath() ),
128  GetChars( m_mod_time.FormatDate() ), GetChars( m_mod_time.FormatTime() ),
129  GetChars( m_file_name.GetModificationTime().FormatDate() ),
130  GetChars( m_file_name.GetModificationTime().FormatTime() ) );
131 
132  return m_file_name.GetModificationTime() != m_mod_time;
133 }
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 105 of file kicad_plugin.cpp.

105 { 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 91 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 92 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 93 of file kicad_plugin.cpp.


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