KiCad PCB EDA Suite
|
#include <pcb_plugin.h>
Public Member Functions | |
FP_CACHE (PCB_PLUGIN *aOwner, const wxString &aLibraryPath) | |
wxString | GetPath () const |
bool | IsWritable () const |
bool | Exists () const |
FP_CACHE_FOOTPRINT_MAP & | GetFootprints () |
void | Save (FOOTPRINT *aFootprint=nullptr) |
Save the footprint cache or a single footprint from it to disk. More... | |
void | Load () |
void | Remove (const wxString &aFootprintName) |
bool | IsModified () |
Return true if the cache is not up-to-date. More... | |
bool | IsPath (const wxString &aPath) const |
Check if aPath is the same as the current cache path. More... | |
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). More... | |
Private Attributes | |
PCB_PLUGIN * | m_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 |
Definition at line 198 of file pcb_plugin.h.
FP_CACHE::FP_CACHE | ( | PCB_PLUGIN * | aOwner, |
const wxString & | aLibraryPath | ||
) |
Definition at line 74 of file pcb_plugin.cpp.
References m_cache_dirty, m_cache_timestamp, m_lib_path, m_lib_raw_path, and m_owner.
|
inline |
Definition at line 217 of file pcb_plugin.h.
References m_lib_path.
Referenced by PCB_PLUGIN::FootprintSave().
|
inline |
Definition at line 219 of file pcb_plugin.h.
References m_footprints.
Referenced by PCB_PLUGIN::FootprintEnumerate(), PCB_PLUGIN::FootprintSave(), PCB_PLUGIN::getFootprint(), PCBNEW_JOBS_HANDLER::JobExportFpSvg(), PCBNEW_JOBS_HANDLER::JobExportFpUpgrade(), and SetPath().
|
inline |
Definition at line 213 of file pcb_plugin.h.
References m_lib_raw_path.
|
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 264 of file pcb_plugin.cpp.
References KiCadFootprintFileExtension, and TimestampDir().
Referenced by PCB_PLUGIN::GetLibraryTimestamp(), IsModified(), and Load().
bool FP_CACHE::IsModified | ( | ) |
Return true if the cache is not up-to-date.
Definition at line 256 of file pcb_plugin.cpp.
References GetTimestamp(), m_cache_dirty, m_cache_timestamp, and m_lib_path.
Referenced by PCB_PLUGIN::validateCache().
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.
aPath | is the library path to test against. |
Definition at line 237 of file pcb_plugin.cpp.
References m_lib_raw_path.
Referenced by PCB_PLUGIN::FootprintLibDelete(), and PCB_PLUGIN::validateCache().
|
inline |
Definition at line 215 of file pcb_plugin.h.
References m_lib_path.
Referenced by PCB_PLUGIN::FootprintDelete(), PCB_PLUGIN::FootprintSave(), and PCB_PLUGIN::IsFootprintLibWritable().
void FP_CACHE::Load | ( | ) |
Definition at line 154 of file pcb_plugin.cpp.
References _, WX_FILENAME::GetFullPath(), WX_FILENAME::GetName(), GetTimestamp(), KiCadFootprintFileExtension, m_cache_dirty, m_cache_timestamp, m_footprints, m_lib_raw_path, PCB_PARSER::Parse(), FOOTPRINT::SetFPID(), WX_FILENAME::SetFullName(), THROW_IO_ERROR, and IO_ERROR::What().
Referenced by PCBNEW_JOBS_HANDLER::JobExportFpSvg(), PCBNEW_JOBS_HANDLER::JobExportFpUpgrade(), and PCB_PLUGIN::validateCache().
void FP_CACHE::Remove | ( | const wxString & | aFootprintName | ) |
Definition at line 218 of file pcb_plugin.cpp.
References _, m_footprints, m_lib_raw_path, and THROW_IO_ERROR.
Referenced by PCB_PLUGIN::FootprintDelete().
void FP_CACHE::Save | ( | FOOTPRINT * | aFootprint = nullptr | ) |
Save the footprint cache or a single footprint from it to disk.
aFootprint | if set, save only this footprint, otherwise, save the full library |
Definition at line 84 of file pcb_plugin.cpp.
References _, KIPLATFORM::IO::DuplicatePermissions(), PCB_PLUGIN::Format(), WX_FILENAME::GetFullPath(), WX_FILENAME::GetPath(), WX_FILENAME::GetTimestamp(), m_cache_dirty, m_cache_timestamp, m_footprints, m_lib_path, m_lib_raw_path, m_owner, PCB_PLUGIN::SetOutputFormatter(), THROW_IO_ERROR, and traceKicadPcbPlugin.
Referenced by PCB_PLUGIN::FootprintLibCreate(), PCB_PLUGIN::FootprintSave(), and PCBNEW_JOBS_HANDLER::JobExportFpUpgrade().
void FP_CACHE::SetPath | ( | const wxString & | aPath | ) |
Definition at line 243 of file pcb_plugin.cpp.
References GetFootprints(), m_lib_path, and m_lib_raw_path.
Referenced by PCBNEW_JOBS_HANDLER::JobExportFpUpgrade().
|
private |
Definition at line 205 of file pcb_plugin.h.
Referenced by FP_CACHE(), IsModified(), Load(), and Save().
|
private |
Definition at line 207 of file pcb_plugin.h.
Referenced by FP_CACHE(), IsModified(), Load(), and Save().
|
private |
Definition at line 203 of file pcb_plugin.h.
Referenced by GetFootprints(), Load(), Remove(), and Save().
|
private |
Definition at line 201 of file pcb_plugin.h.
Referenced by Exists(), FP_CACHE(), IsModified(), IsWritable(), Save(), and SetPath().
|
private |
Definition at line 202 of file pcb_plugin.h.
Referenced by FP_CACHE(), GetPath(), IsPath(), Load(), Remove(), Save(), and SetPath().
|
private |
Definition at line 200 of file pcb_plugin.h.
Referenced by FP_CACHE(), and Save().