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

A cache assistant for KiCad legacy symbol libraries. More...

#include <sch_io_kicad_legacy_lib_cache.h>

Inheritance diagram for SCH_IO_KICAD_LEGACY_LIB_CACHE:
SCH_IO_LIB_CACHE

Public Member Functions

 SCH_IO_KICAD_LEGACY_LIB_CACHE (const wxString &aLibraryPath)
 
virtual ~SCH_IO_KICAD_LEGACY_LIB_CACHE ()
 
void Save (const std::optional< bool > &aOpt) override
 Save the entire library to file m_libFileName;.
 
void Load () override
 
void DeleteSymbol (const wxString &aName) override
 
void IncrementModifyHash ()
 
int GetModifyHash ()
 
virtual void AddSymbol (const LIB_SYMBOL *aSymbol)
 
virtual LIB_SYMBOLGetSymbol (const wxString &aName)
 
wxFileName GetRealFile () const
 
wxDateTime GetLibModificationTime ()
 
bool IsFile (const wxString &aFullPathAndFileName) const
 
bool IsFileChanged () const
 
void SetModified (bool aModified=true)
 
wxString GetLogicalName () const
 
void SetFileName (const wxString &aFileName)
 
wxString GetFileName () const
 
const LIB_SYMBOL_MAPGetSymbolMap () const
 

Static Public Member Functions

static LIB_SYMBOLLoadPart (LINE_READER &aReader, int aMajorVersion, int aMinorVersion, LIB_SYMBOL_MAP *aMap=nullptr)
 
static void SaveSymbol (LIB_SYMBOL *aSymbol, OUTPUTFORMATTER &aFormatter, LIB_SYMBOL_MAP *aMap=nullptr)
 

Protected Member Functions

LIB_SYMBOLremoveSymbol (LIB_SYMBOL *aAlias)
 

Protected Attributes

int m_modHash
 
std::mutex m_modHashMutex
 
wxString m_fileName
 
wxFileName m_libFileName
 
wxDateTime m_fileModTime
 
LIB_SYMBOL_MAP m_symbols
 
bool m_isWritable
 
bool m_isModified
 
SCH_LIB_TYPE m_libType
 

Private Member Functions

void loadHeader (FILE_LINE_READER &aReader)
 
void loadDocs ()
 
void saveDocFile ()
 

Static Private Member Functions

static void loadAliases (std::unique_ptr< LIB_SYMBOL > &aSymbol, LINE_READER &aReader, LIB_SYMBOL_MAP *aMap=nullptr)
 
static void loadField (std::unique_ptr< LIB_SYMBOL > &aSymbol, LINE_READER &aReader)
 
static void loadDrawEntries (std::unique_ptr< LIB_SYMBOL > &aSymbol, LINE_READER &aReader, int aMajorVersion, int aMinorVersion)
 
static void loadFootprintFilters (std::unique_ptr< LIB_SYMBOL > &aSymbol, LINE_READER &aReader)
 
static SCH_SHAPEloadArc (LINE_READER &aReader)
 
static SCH_SHAPEloadCircle (LINE_READER &aReader)
 
static SCH_TEXTloadText (LINE_READER &aReader, int aMajorVersion, int aMinorVersion)
 
static SCH_SHAPEloadRect (LINE_READER &aReader)
 
static SCH_PINloadPin (std::unique_ptr< LIB_SYMBOL > &aSymbol, LINE_READER &aReader)
 
static SCH_SHAPEloadPolyLine (LINE_READER &aReader)
 
static SCH_SHAPEloadBezier (LINE_READER &aReader)
 
static FILL_T parseFillMode (LINE_READER &aReader, const char *aLine, const char **aOutput)
 
static void saveArc (SCH_SHAPE *aArc, OUTPUTFORMATTER &aFormatter)
 
static void saveBezier (SCH_SHAPE *aBezier, OUTPUTFORMATTER &aFormatter)
 
static void saveCircle (SCH_SHAPE *aCircle, OUTPUTFORMATTER &aFormatter)
 
static void saveField (const SCH_FIELD *aField, OUTPUTFORMATTER &aFormatter)
 
static void savePin (const SCH_PIN *aPin, OUTPUTFORMATTER &aFormatter)
 
static void savePolyLine (SCH_SHAPE *aPolyLine, OUTPUTFORMATTER &aFormatter)
 
static void saveRectangle (SCH_SHAPE *aRectangle, OUTPUTFORMATTER &aFormatter)
 
static void saveText (const SCH_TEXT *aText, OUTPUTFORMATTER &aFormatter)
 

Private Attributes

friend SCH_IO_KICAD_LEGACY
 
int m_versionMajor
 
int m_versionMinor
 

Detailed Description

A cache assistant for KiCad legacy symbol libraries.

Definition at line 43 of file sch_io_kicad_legacy_lib_cache.h.

Constructor & Destructor Documentation

◆ SCH_IO_KICAD_LEGACY_LIB_CACHE()

SCH_IO_KICAD_LEGACY_LIB_CACHE::SCH_IO_KICAD_LEGACY_LIB_CACHE ( const wxString &  aLibraryPath)

Definition at line 62 of file sch_io_kicad_legacy_lib_cache.cpp.

References m_versionMajor, and m_versionMinor.

◆ ~SCH_IO_KICAD_LEGACY_LIB_CACHE()

virtual SCH_IO_KICAD_LEGACY_LIB_CACHE::~SCH_IO_KICAD_LEGACY_LIB_CACHE ( )
inlinevirtual

Definition at line 47 of file sch_io_kicad_legacy_lib_cache.h.

Member Function Documentation

◆ AddSymbol()

◆ DeleteSymbol()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol ( const wxString &  aName)
overridevirtual

◆ GetFileName()

wxString SCH_IO_LIB_CACHE::GetFileName ( ) const
inlineinherited

◆ GetLibModificationTime()

wxDateTime SCH_IO_LIB_CACHE::GetLibModificationTime ( )
inherited

◆ GetLogicalName()

wxString SCH_IO_LIB_CACHE::GetLogicalName ( ) const
inlineinherited

Definition at line 84 of file sch_io_lib_cache.h.

References SCH_IO_LIB_CACHE::m_libFileName.

◆ GetModifyHash()

int SCH_IO_LIB_CACHE::GetModifyHash ( )
inlineinherited

◆ GetRealFile()

◆ GetSymbol()

LIB_SYMBOL * SCH_IO_LIB_CACHE::GetSymbol ( const wxString &  aName)
virtualinherited

Definition at line 178 of file sch_io_lib_cache.cpp.

References SCH_IO_LIB_CACHE::m_symbols.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().

◆ GetSymbolMap()

const LIB_SYMBOL_MAP & SCH_IO_LIB_CACHE::GetSymbolMap ( ) const
inlineinherited

Definition at line 90 of file sch_io_lib_cache.h.

References SCH_IO_LIB_CACHE::m_symbols.

Referenced by EESCHEMA_JOBS_HANDLER::JobSymExportSvg().

◆ IncrementModifyHash()

◆ IsFile()

◆ IsFileChanged()

bool SCH_IO_LIB_CACHE::IsFileChanged ( ) const
inherited

◆ Load()

◆ loadAliases()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadAliases ( std::unique_ptr< LIB_SYMBOL > &  aSymbol,
LINE_READER aReader,
LIB_SYMBOL_MAP aMap = nullptr 
)
staticprivate

◆ loadArc()

SCH_SHAPE * SCH_IO_KICAD_LEGACY_LIB_CACHE::loadArc ( LINE_READER aReader)
staticprivate

This accounts for an oddity in the old library format, where the symbol is overdefined. The previous draw (based on wxwidgets) used start point and end point and always drew counter-clockwise. The new GAL draw takes center, radius and start/end angles. All of these points were stored in the file, so we need to mimic the swapping of start/end points rather than using the stored angles in order to properly map edge cases.

Definition at line 840 of file sch_io_kicad_legacy_lib_cache.cpp.

References SCH_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), LAYER_DEVICE, LINE_READER::Line(), MapAnglesV6(), EDA_IU_SCALE::MilsToIU(), NORMALIZE_ANGLE_POS(), parseFillMode(), parseInt(), RotatePoint(), schIUScale, SCH_ITEM::SetBodyStyle(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetFillMode(), SCH_SHAPE::SetPosition(), EDA_SHAPE::SetStart(), SCH_SHAPE::SetStroke(), SCH_ITEM::SetUnit(), strCompare(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by loadDrawEntries().

◆ loadBezier()

◆ loadCircle()

◆ loadDocs()

◆ loadDrawEntries()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadDrawEntries ( std::unique_ptr< LIB_SYMBOL > &  aSymbol,
LINE_READER aReader,
int  aMajorVersion,
int  aMinorVersion 
)
staticprivate

◆ loadField()

◆ loadFootprintFilters()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadFootprintFilters ( std::unique_ptr< LIB_SYMBOL > &  aSymbol,
LINE_READER aReader 
)
staticprivate

◆ loadHeader()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadHeader ( FILE_LINE_READER aReader)
private

◆ LoadPart()

◆ loadPin()

◆ loadPolyLine()

◆ loadRect()

◆ loadText()

◆ parseFillMode()

FILL_T SCH_IO_KICAD_LEGACY_LIB_CACHE::parseFillMode ( LINE_READER aReader,
const char *  aLine,
const char **  aOutput 
)
staticprivate

◆ removeSymbol()

◆ Save()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::Save ( const std::optional< bool > &  aOpt)
overridevirtual

◆ saveArc()

◆ saveBezier()

◆ saveCircle()

◆ saveDocFile()

void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveDocFile ( )
private

◆ saveField()

◆ savePin()

◆ savePolyLine()

◆ saveRectangle()

◆ SaveSymbol()

◆ saveText()

◆ SetFileName()

void SCH_IO_LIB_CACHE::SetFileName ( const wxString &  aFileName)
inlineinherited

◆ SetModified()

Member Data Documentation

◆ m_fileModTime

wxDateTime SCH_IO_LIB_CACHE::m_fileModTime
protectedinherited

◆ m_fileName

wxString SCH_IO_LIB_CACHE::m_fileName
protectedinherited

Definition at line 98 of file sch_io_lib_cache.h.

Referenced by SCH_IO_LIB_CACHE::IsFile().

◆ m_isModified

◆ m_isWritable

bool SCH_IO_LIB_CACHE::m_isWritable
protectedinherited

Definition at line 102 of file sch_io_lib_cache.h.

Referenced by SCH_IO_LIB_CACHE::GetLibModificationTime().

◆ m_libFileName

◆ m_libType

SCH_LIB_TYPE SCH_IO_LIB_CACHE::m_libType
protectedinherited

Definition at line 104 of file sch_io_lib_cache.h.

Referenced by Load(), and SCH_IO_LIB_CACHE::SCH_IO_LIB_CACHE().

◆ m_modHash

int SCH_IO_LIB_CACHE::m_modHash
protectedinherited

◆ m_modHashMutex

std::mutex SCH_IO_LIB_CACHE::m_modHashMutex
protectedinherited

◆ m_symbols

◆ m_versionMajor

int SCH_IO_KICAD_LEGACY_LIB_CACHE::m_versionMajor
private

Definition at line 97 of file sch_io_kicad_legacy_lib_cache.h.

Referenced by Load(), and SCH_IO_KICAD_LEGACY_LIB_CACHE().

◆ m_versionMinor

int SCH_IO_KICAD_LEGACY_LIB_CACHE::m_versionMinor
private

Definition at line 98 of file sch_io_kicad_legacy_lib_cache.h.

Referenced by Load(), and SCH_IO_KICAD_LEGACY_LIB_CACHE().

◆ SCH_IO_KICAD_LEGACY

friend SCH_IO_KICAD_LEGACY_LIB_CACHE::SCH_IO_KICAD_LEGACY
private

Definition at line 66 of file sch_io_kicad_legacy_lib_cache.h.


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