KiCad PCB EDA Suite
|
#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_ROW & | InsertRow () |
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_ROW > | m_rows |
Definition at line 117 of file library_table.h.
LIBRARY_TABLE::LIBRARY_TABLE | ( | const wxFileName & | aPath, |
LIBRARY_TABLE_SCOPE | aScope ) |
Creates a library table from a file on disk.
aPath | is the path to a library table file to parse |
aScope | is 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::LIBRARY_TABLE | ( | const wxString & | aBuffer, |
LIBRARY_TABLE_SCOPE | aScope ) |
Creates a library table from parsed text.
aBuffer | is a string containing data to parse |
aScope | is 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().
|
default |
References InsertRow(), LIBRARY_TABLE(), and MakeRow().
|
private |
Definition at line 137 of file library_table.cpp.
References LIBRARY_TABLE_ROW_IR::description, LIBRARY_TABLE_ROW_IR::disabled, LIBRARY_TABLE_ROW_IR::hidden, LIBRARY_TABLE_ROW::m_description, LIBRARY_TABLE_ROW::m_disabled, LIBRARY_TABLE_ROW::m_hidden, LIBRARY_TABLE_ROW::m_nickname, LIBRARY_TABLE_ROW::m_ok, LIBRARY_TABLE_ROW::m_options, m_rows, m_scope, LIBRARY_TABLE_ROW::m_scope, LIBRARY_TABLE_ROW::m_type, LIBRARY_TABLE_ROW::m_uri, LIBRARY_TABLE_ROW_IR::nickname, LIBRARY_TABLE_ROW_IR::options, LIBRARY_TABLE_ROW_IR::type, and LIBRARY_TABLE_ROW_IR::uri.
Referenced by initFromIR().
|
inline |
Definition at line 157 of file library_table.h.
References m_errorDescription.
void LIBRARY_TABLE::Format | ( | OUTPUTFORMATTER * | aOutput | ) | const |
Definition at line 156 of file library_table.cpp.
References XNODE::AddAttribute(), DESIGN_BLOCK, FOOTPRINT, XNODE::Format(), Rows(), SYMBOL, and Type().
Referenced by LIBRARY_MANAGER::Save().
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().
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.
aSubstituted | is 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().
|
private |
Definition at line 117 of file library_table.cpp.
References addRowFromIR(), m_type, m_version, LIBRARY_TABLE_IR::rows, LIBRARY_TABLE_IR::type, and LIBRARY_TABLE_IR::version.
Referenced by LIBRARY_TABLE().
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().
|
inline |
Definition at line 156 of file library_table.h.
References m_ok.
Referenced by LIBRARY_MANAGER::IsTableValid(), DESIGN_BLOCK_GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), and SYMBOL_GRID_TRICKS::paste_text().
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().
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.
|
inline |
Definition at line 144 of file library_table.h.
References m_path.
Referenced by LIBRARY_MANAGER::Save().
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().
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.
|
inline |
Definition at line 160 of file library_table.h.
References m_rows.
|
inline |
Definition at line 159 of file library_table.h.
References m_rows.
Referenced by DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), Format(), InsertRow(), PANEL_DESIGN_BLOCK_LIB_TABLE::moveDownHandler(), PANEL_FP_LIB_TABLE::moveDownHandler(), PANEL_SYM_LIB_TABLE::moveDownHandler(), PANEL_DESIGN_BLOCK_LIB_TABLE::moveUpHandler(), PANEL_FP_LIB_TABLE::moveUpHandler(), PANEL_SYM_LIB_TABLE::moveUpHandler(), FP_GRID_TRICKS::paste_text(), and SYMBOL_GRID_TRICKS::paste_text().
|
inline |
Definition at line 151 of file library_table.h.
References m_scope.
Referenced by LIBRARY_MANAGER::loadNestedTables(), FP_GRID_TRICKS::paste_text(), and SYMBOL_GRID_TRICKS::paste_text().
|
inline |
Definition at line 145 of file library_table.h.
References m_path.
|
inline |
Definition at line 150 of file library_table.h.
References m_scope.
|
inline |
Definition at line 148 of file library_table.h.
References m_type.
|
inline |
Definition at line 154 of file library_table.h.
References m_version.
|
inline |
|
inline |
Definition at line 153 of file library_table.h.
References m_version.
|
private |
Definition at line 193 of file library_table.h.
Referenced by ErrorDescription(), and LIBRARY_TABLE().
|
private |
Definition at line 192 of file library_table.h.
Referenced by IsOk(), and LIBRARY_TABLE().
|
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().
|
private |
Definition at line 195 of file library_table.h.
Referenced by addRowFromIR(), HasRow(), HasRowWithURI(), operator==(), Row(), Row(), Rows(), and Rows().
|
private |
Definition at line 184 of file library_table.h.
Referenced by addRowFromIR(), LIBRARY_TABLE(), LIBRARY_TABLE(), MakeRow(), operator==(), Scope(), and SetScope().
|
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().
|
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().