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

#include <library_table.h>

Public Member Functions

 LIBRARY_TABLE (const wxFileName &aPath, LIBRARY_TABLE_SCOPE aScope)
 Creates a library table from a file on disk.
 
 LIBRARY_TABLE (const wxString &aBuffer, LIBRARY_TABLE_SCOPE aScope)
 Creates a library table from parsed text.
 
 ~LIBRARY_TABLE ()=default
 
bool operator== (const LIBRARY_TABLE &aOther) const
 
LIBRARY_TABLE_ROW MakeRow () const
 Builds a new row that is suitable for this table (does not insert it)
 
LIBRARY_TABLE_ROWInsertRow ()
 Builds a new row and inserts it at the end of the table; returning a reference to the row.
 
const wxString & Path () const
 
void SetPath (const wxString &aPath)
 
LIBRARY_TABLE_TYPE Type () const
 
void SetType (const LIBRARY_TABLE_TYPE aType)
 
void SetScope (LIBRARY_TABLE_SCOPE aScope)
 
LIBRARY_TABLE_SCOPE Scope () const
 
std::optional< int > Version () const
 
void SetVersion (const std::optional< int > &aVersion)
 
bool IsOk () const
 
const wxString & ErrorDescription () const
 
const std::vector< LIBRARY_TABLE_ROW > & Rows () const
 
std::vector< LIBRARY_TABLE_ROW > & Rows ()
 
void Format (OUTPUTFORMATTER *aOutput) const
 
bool HasRow (const wxString &aNickname) const
 
bool HasRowWithURI (const wxString &aUri, const PROJECT &aProject, bool aSubstituted=false) const
 Returns true if the given (fully-expanded) URI exists as a library in this table.
 
std::optional< LIBRARY_TABLE_ROW * > Row (const wxString &aNickname)
 
std::optional< const LIBRARY_TABLE_ROW * > Row (const wxString &aNickname) const
 

Private Member Functions

bool initFromIR (const LIBRARY_TABLE_IR &aIR)
 
bool addRowFromIR (const LIBRARY_TABLE_ROW_IR &aIR)
 

Private Attributes

wxString m_path
 The full path to the file this table was parsed from, if any.
 
LIBRARY_TABLE_SCOPE m_scope = LIBRARY_TABLE_SCOPE::UNINITIALIZED
 
LIBRARY_TABLE_TYPE m_type = LIBRARY_TABLE_TYPE::UNINITIALIZED
 What type of content this table contains (footprint, symbol, design block, etc)
 
std::optional< int > m_version
 The format version, if present in the parsed file.
 
bool m_ok = false
 
wxString m_errorDescription
 
std::vector< LIBRARY_TABLE_ROWm_rows
 

Detailed Description

Definition at line 117 of file library_table.h.

Constructor & Destructor Documentation

◆ LIBRARY_TABLE() [1/2]

LIBRARY_TABLE::LIBRARY_TABLE ( const wxFileName & aPath,
LIBRARY_TABLE_SCOPE aScope )

Creates a library table from a file on disk.

Parameters
aPathis the path to a library table file to parse
aScopeis the scope of this table (is it global or part of a project)

Definition at line 55 of file library_table.cpp.

References _, initFromIR(), m_errorDescription, m_ok, m_path, m_scope, LIBRARY_TABLE_PARSER::Parse(), and WX_FILENAME::ResolvePossibleSymlinks().

Referenced by operator==(), and ~LIBRARY_TABLE().

◆ LIBRARY_TABLE() [2/2]

LIBRARY_TABLE::LIBRARY_TABLE ( const wxString & aBuffer,
LIBRARY_TABLE_SCOPE aScope )

Creates a library table from parsed text.

Parameters
aBufferis a string containing data to parse
aScopeis the scope of this table (is it global or part of a project)

Definition at line 86 of file library_table.cpp.

References m_path, m_scope, and LIBRARY_TABLE_PARSER::ParseBuffer().

◆ ~LIBRARY_TABLE()

LIBRARY_TABLE::~LIBRARY_TABLE ( )
default

Member Function Documentation

◆ addRowFromIR()

◆ ErrorDescription()

const wxString & LIBRARY_TABLE::ErrorDescription ( ) const
inline

Definition at line 157 of file library_table.h.

References m_errorDescription.

◆ Format()

void LIBRARY_TABLE::Format ( OUTPUTFORMATTER * aOutput) const

◆ HasRow()

bool LIBRARY_TABLE::HasRow ( const wxString & aNickname) const

Definition at line 213 of file library_table.cpp.

References m_rows.

Referenced by PCM_LIB_TRAVERSER::ensureUnique().

◆ HasRowWithURI()

bool LIBRARY_TABLE::HasRowWithURI ( const wxString & aUri,
const PROJECT & aProject,
bool aSubstituted = false ) const

Returns true if the given (fully-expanded) URI exists as a library in this table.

Parameters
aSubstitutedis true if the URI should be compared with full (expanded/substituted) versions of the row URIs

Definition at line 225 of file library_table.cpp.

References LIBRARY_MANAGER::ExpandURI(), m_rows, and PROJECT.

Referenced by PCM_LIB_TRAVERSER::addRowIfNecessary().

◆ initFromIR()

bool LIBRARY_TABLE::initFromIR ( const LIBRARY_TABLE_IR & aIR)
private

◆ InsertRow()

LIBRARY_TABLE_ROW & LIBRARY_TABLE::InsertRow ( )

Builds a new row and inserts it at the end of the table; returning a reference to the row.

Definition at line 207 of file library_table.cpp.

References MakeRow(), and Rows().

Referenced by PCM_LIB_TRAVERSER::addRowIfNecessary(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary(), and ~LIBRARY_TABLE().

◆ IsOk()

bool LIBRARY_TABLE::IsOk ( ) const
inline

◆ MakeRow()

LIBRARY_TABLE_ROW LIBRARY_TABLE::MakeRow ( ) const

Builds a new row that is suitable for this table (does not insert it)

Definition at line 196 of file library_table.cpp.

References m_scope, LIBRARY_TABLE_ROW::SetOk(), and LIBRARY_TABLE_ROW::SetScope().

Referenced by InsertRow(), and ~LIBRARY_TABLE().

◆ operator==()

bool LIBRARY_TABLE::operator== ( const LIBRARY_TABLE & aOther) const

Definition at line 107 of file library_table.cpp.

References LIBRARY_TABLE(), m_path, m_rows, m_scope, m_type, and m_version.

◆ Path()

const wxString & LIBRARY_TABLE::Path ( ) const
inline

Definition at line 144 of file library_table.h.

References m_path.

Referenced by LIBRARY_MANAGER::Save().

◆ Row() [1/2]

std::optional< LIBRARY_TABLE_ROW * > LIBRARY_TABLE::Row ( const wxString & aNickname)

Definition at line 241 of file library_table.cpp.

References m_rows.

Referenced by SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary().

◆ Row() [2/2]

std::optional< const LIBRARY_TABLE_ROW * > LIBRARY_TABLE::Row ( const wxString & aNickname) const

Definition at line 253 of file library_table.cpp.

References m_rows.

◆ Rows() [1/2]

std::vector< LIBRARY_TABLE_ROW > & LIBRARY_TABLE::Rows ( )
inline

Definition at line 160 of file library_table.h.

References m_rows.

◆ Rows() [2/2]

◆ Scope()

LIBRARY_TABLE_SCOPE LIBRARY_TABLE::Scope ( ) const
inline

◆ SetPath()

void LIBRARY_TABLE::SetPath ( const wxString & aPath)
inline

Definition at line 145 of file library_table.h.

References m_path.

◆ SetScope()

void LIBRARY_TABLE::SetScope ( LIBRARY_TABLE_SCOPE aScope)
inline

Definition at line 150 of file library_table.h.

References m_scope.

◆ SetType()

void LIBRARY_TABLE::SetType ( const LIBRARY_TABLE_TYPE aType)
inline

Definition at line 148 of file library_table.h.

References m_type.

◆ SetVersion()

void LIBRARY_TABLE::SetVersion ( const std::optional< int > & aVersion)
inline

Definition at line 154 of file library_table.h.

References m_version.

◆ Type()

LIBRARY_TABLE_TYPE LIBRARY_TABLE::Type ( ) const
inline

Definition at line 147 of file library_table.h.

References m_type.

Referenced by Format().

◆ Version()

std::optional< int > LIBRARY_TABLE::Version ( ) const
inline

Definition at line 153 of file library_table.h.

References m_version.

Member Data Documentation

◆ m_errorDescription

wxString LIBRARY_TABLE::m_errorDescription
private

Definition at line 193 of file library_table.h.

Referenced by ErrorDescription(), and LIBRARY_TABLE().

◆ m_ok

bool LIBRARY_TABLE::m_ok = false
private

Definition at line 192 of file library_table.h.

Referenced by IsOk(), and LIBRARY_TABLE().

◆ m_path

wxString LIBRARY_TABLE::m_path
private

The full path to the file this table was parsed from, if any.

Definition at line 182 of file library_table.h.

Referenced by LIBRARY_TABLE(), LIBRARY_TABLE(), operator==(), Path(), and SetPath().

◆ m_rows

std::vector<LIBRARY_TABLE_ROW> LIBRARY_TABLE::m_rows
private

Definition at line 195 of file library_table.h.

Referenced by addRowFromIR(), HasRow(), HasRowWithURI(), operator==(), Row(), Row(), Rows(), and Rows().

◆ m_scope

◆ m_type

LIBRARY_TABLE_TYPE LIBRARY_TABLE::m_type = LIBRARY_TABLE_TYPE::UNINITIALIZED
private

What type of content this table contains (footprint, symbol, design block, etc)

Definition at line 187 of file library_table.h.

Referenced by initFromIR(), operator==(), SetType(), and Type().

◆ m_version

std::optional<int> LIBRARY_TABLE::m_version
private

The format version, if present in the parsed file.

Definition at line 190 of file library_table.h.

Referenced by initFromIR(), operator==(), SetVersion(), and Version().


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