KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FP_CACHE Class Reference

#include <pcb_io_kicad_sexpr.h>

Public Member Functions

 FP_CACHE (PCB_IO_KICAD_SEXPR *aOwner, const wxString &aLibraryPath)
 
wxString GetPath () const
 
bool IsWritable () const
 
bool Exists () const
 
FP_CACHE_FOOTPRINT_MAPGetFootprints ()
 
void Save (FOOTPRINT *aFootprint=nullptr)
 Save the footprint cache or a single footprint from it to disk.
 
void Load ()
 
void Remove (const wxString &aFootprintName)
 
bool IsModified ()
 Return true if the cache is not up-to-date.
 
bool IsPath (const wxString &aPath) const
 Check if aPath is the same as the current cache path.
 
void SetPath (const wxString &aPath)
 

Static Public Member Functions

static long long GetTimestamp (const wxString &aLibPath)
 Generate a timestamp representing all source files in the cache (including the parent directory).
 

Private Attributes

PCB_IO_KICAD_SEXPRm_owner
 
wxFileName m_lib_path
 
wxString m_lib_raw_path
 
FP_CACHE_FOOTPRINT_MAP m_footprints
 
bool m_cache_dirty
 
long long m_cache_timestamp
 

Detailed Description

Definition at line 219 of file pcb_io_kicad_sexpr.h.

Constructor & Destructor Documentation

◆ FP_CACHE()

FP_CACHE::FP_CACHE ( PCB_IO_KICAD_SEXPR aOwner,
const wxString &  aLibraryPath 
)

Member Function Documentation

◆ Exists()

bool FP_CACHE::Exists ( ) const
inline

Definition at line 238 of file pcb_io_kicad_sexpr.h.

References m_lib_path.

Referenced by PCB_IO_KICAD_SEXPR::FootprintSave().

◆ GetFootprints()

◆ GetPath()

wxString FP_CACHE::GetPath ( ) const
inline

Definition at line 234 of file pcb_io_kicad_sexpr.h.

References m_lib_raw_path.

◆ GetTimestamp()

long long FP_CACHE::GetTimestamp ( const wxString &  aLibPath)
static

Generate a timestamp representing all source files in the cache (including the parent directory).

Timestamps should not be considered ordered. They either match or they don't.

Definition at line 281 of file pcb_io_kicad_sexpr.cpp.

References FILEEXT::KiCadFootprintFileExtension, and TimestampDir().

Referenced by PCB_IO_KICAD_SEXPR::GetLibraryTimestamp(), IsModified(), and Load().

◆ IsModified()

bool FP_CACHE::IsModified ( )

Return true if the cache is not up-to-date.

Definition at line 273 of file pcb_io_kicad_sexpr.cpp.

References GetTimestamp(), m_cache_dirty, m_cache_timestamp, and m_lib_path.

Referenced by PCB_IO_KICAD_SEXPR::validateCache().

◆ IsPath()

bool FP_CACHE::IsPath ( const wxString &  aPath) const

Check if aPath is the same as the current cache path.

This tests paths by converting aPath using the native separators. Internally FP_CACHE stores the current path using native separators. This prevents path miscompares on Windows due to the fact that paths can be stored with / instead of \ in the footprint library table.

Parameters
aPathis the library path to test against.
Returns
true if aPath is the same as the cache path.

Definition at line 254 of file pcb_io_kicad_sexpr.cpp.

References m_lib_raw_path.

Referenced by PCB_IO_KICAD_SEXPR::DeleteLibrary(), and PCB_IO_KICAD_SEXPR::validateCache().

◆ IsWritable()

bool FP_CACHE::IsWritable ( ) const
inline

◆ Load()

◆ Remove()

void FP_CACHE::Remove ( const wxString &  aFootprintName)

Definition at line 235 of file pcb_io_kicad_sexpr.cpp.

References _, m_footprints, m_lib_raw_path, and THROW_IO_ERROR.

Referenced by PCB_IO_KICAD_SEXPR::FootprintDelete().

◆ Save()

◆ SetPath()

void FP_CACHE::SetPath ( const wxString &  aPath)

Member Data Documentation

◆ m_cache_dirty

bool FP_CACHE::m_cache_dirty
private

Definition at line 226 of file pcb_io_kicad_sexpr.h.

Referenced by FP_CACHE(), IsModified(), Load(), and Save().

◆ m_cache_timestamp

long long FP_CACHE::m_cache_timestamp
private

Definition at line 228 of file pcb_io_kicad_sexpr.h.

Referenced by FP_CACHE(), IsModified(), Load(), and Save().

◆ m_footprints

FP_CACHE_FOOTPRINT_MAP FP_CACHE::m_footprints
private

Definition at line 224 of file pcb_io_kicad_sexpr.h.

Referenced by GetFootprints(), Load(), Remove(), and Save().

◆ m_lib_path

wxFileName FP_CACHE::m_lib_path
private

Definition at line 222 of file pcb_io_kicad_sexpr.h.

Referenced by Exists(), FP_CACHE(), IsModified(), IsWritable(), Save(), and SetPath().

◆ m_lib_raw_path

wxString FP_CACHE::m_lib_raw_path
private

Definition at line 223 of file pcb_io_kicad_sexpr.h.

Referenced by FP_CACHE(), GetPath(), IsPath(), Load(), Remove(), Save(), and SetPath().

◆ m_owner

PCB_IO_KICAD_SEXPR* FP_CACHE::m_owner
private

Definition at line 221 of file pcb_io_kicad_sexpr.h.

Referenced by FP_CACHE(), and Save().


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