KiCad PCB EDA Suite
LIB_TABLE_ROW Class Referenceabstract

Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE. More...

#include <lib_table_base.h>

Inheritance diagram for LIB_TABLE_ROW:
FP_LIB_TABLE_ROW SYMBOL_LIB_TABLE_ROW TEST_LIB_TABLE_ROW

Public Member Functions

 LIB_TABLE_ROW ()
 
virtual ~LIB_TABLE_ROW ()
 
 LIB_TABLE_ROW (const wxString &aNick, const wxString &aURI, const wxString &aOptions, const wxString &aDescr=wxEmptyString, LIB_TABLE *aParent=nullptr)
 
bool operator== (const LIB_TABLE_ROW &r) const
 
bool operator!= (const LIB_TABLE_ROW &r) const
 
const wxString & GetNickName () const
 
void SetNickName (const wxString &aNickName)
 Change the logical name of this library, useful for an editor. More...
 
bool GetIsLoaded () const
 
void SetLoaded (bool aLoaded)
 Mark the row as being a loaded library. More...
 
bool GetIsEnabled () const
 
void SetEnabled (bool aEnabled=true)
 Change the enabled status of this library. More...
 
bool GetIsVisible () const
 
void SetVisible (bool aVisible=true)
 
virtual const wxString GetType () const =0
 Return the type of library represented by this row. More...
 
virtual void SetType (const wxString &aType)=0
 Change the type of library represented by this row that must be implemented in the derived object to provide the library table row type. More...
 
const wxString GetFullURI (bool aSubstituted=false) const
 Return the full location specifying URI for the LIB, either in original UI form or in environment variable expanded form. More...
 
void SetFullURI (const wxString &aFullURI)
 Change the full URI for the library. More...
 
const wxString & GetOptions () const
 Return the options string, which may hold a password or anything else needed to instantiate the underlying library plugin. More...
 
void SetOptions (const wxString &aOptions)
 Change the library options strings. More...
 
const wxString & GetDescr () const
 Return the description of the library referenced by this row. More...
 
void SetDescr (const wxString &aDescr)
 Change the description of the library referenced by this row. More...
 
LIB_TABLEGetParent () const
 
void SetParent (LIB_TABLE *aParent)
 
std::mutex & GetMutex ()
 
const STRING_UTF8_MAPGetProperties () const
 Return the constant #PROPERTIES for this library (LIB_TABLE_ROW). More...
 
void Format (OUTPUTFORMATTER *out, int nestLevel) const
 Serialize this object as utf8 text to an OUTPUTFORMATTER, and tries to make it look good using multiple lines and indentation. More...
 
LIB_TABLE_ROWclone () const
 

Protected Member Functions

 LIB_TABLE_ROW (const LIB_TABLE_ROW &aRow)
 
void operator= (const LIB_TABLE_ROW &aRow)
 

Private Member Functions

virtual LIB_TABLE_ROWdo_clone () const =0
 
void setProperties (STRING_UTF8_MAP *aProperties)
 

Private Attributes

wxString nickName
 
wxString uri_user
 what user entered from UI or loaded from disk More...
 
wxString options
 
wxString description
 
bool enabled = true
 Whether the LIB_TABLE_ROW is enabled. More...
 
bool visible = true
 Whether the LIB_TABLE_ROW is visible in choosers. More...
 
bool m_loaded = false
 Whether the LIB_TABLE_ROW is loaded. More...
 
LIB_TABLEm_parent
 Pointer to the table this row lives in (maybe null) More...
 
std::unique_ptr< STRING_UTF8_MAPproperties
 
std::mutex m_loadMutex
 

Detailed Description

Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.

This is an abstract base class from which to derive library specific rows.

Definition at line 67 of file lib_table_base.h.

Constructor & Destructor Documentation

◆ LIB_TABLE_ROW() [1/3]

LIB_TABLE_ROW::LIB_TABLE_ROW ( )
inline

Definition at line 70 of file lib_table_base.h.

70 :
71 enabled( true ),
72 visible( true ),
73 m_loaded( false ),
74 m_parent( nullptr )
75 {
76 }
bool visible
Whether the LIB_TABLE_ROW is visible in choosers.
bool enabled
Whether the LIB_TABLE_ROW is enabled.
bool m_loaded
Whether the LIB_TABLE_ROW is loaded.
LIB_TABLE * m_parent
Pointer to the table this row lives in (maybe null)

◆ ~LIB_TABLE_ROW()

virtual LIB_TABLE_ROW::~LIB_TABLE_ROW ( )
inlinevirtual

Definition at line 78 of file lib_table_base.h.

79 {
80 }

◆ LIB_TABLE_ROW() [2/3]

LIB_TABLE_ROW::LIB_TABLE_ROW ( const wxString &  aNick,
const wxString &  aURI,
const wxString &  aOptions,
const wxString &  aDescr = wxEmptyString,
LIB_TABLE aParent = nullptr 
)
inline

Definition at line 82 of file lib_table_base.h.

83 :
84 nickName( aNick ),
85 description( aDescr ),
86 enabled( true ),
87 visible( true ),
88 m_loaded( false ),
89 m_parent( aParent )
90 {
91 properties.reset();
92 SetOptions( aOptions );
93 SetFullURI( aURI );
94 }
void SetFullURI(const wxString &aFullURI)
Change the full URI for the library.
wxString nickName
std::unique_ptr< STRING_UTF8_MAP > properties
wxString description
void SetOptions(const wxString &aOptions)
Change the library options strings.

References properties, SetFullURI(), and SetOptions().

◆ LIB_TABLE_ROW() [3/3]

LIB_TABLE_ROW::LIB_TABLE_ROW ( const LIB_TABLE_ROW aRow)
inlineprotected

Definition at line 207 of file lib_table_base.h.

207 :
208 nickName( aRow.nickName ),
209 uri_user( aRow.uri_user ),
210#if !FP_LATE_ENVVAR
211 uri_expanded( aRow.uri_expanded ),
212#endif
213 options( aRow.options ),
214 description( aRow.description ),
215 enabled( aRow.enabled ),
216 visible( aRow.visible ),
217 m_loaded( aRow.m_loaded ),
218 m_parent( aRow.m_parent )
219 {
220 if( aRow.properties )
221 properties = std::make_unique<STRING_UTF8_MAP>( *aRow.properties.get() );
222 else
223 properties.reset();
224 }
wxString options
wxString uri_user
what user entered from UI or loaded from disk

References properties.

Member Function Documentation

◆ clone()

LIB_TABLE_ROW * LIB_TABLE_ROW::clone ( ) const
inline

Definition at line 201 of file lib_table_base.h.

202 {
203 return do_clone();
204 }
virtual LIB_TABLE_ROW * do_clone() const =0

References do_clone().

Referenced by new_clone(), SYMBOL_GRID_TRICKS::paste_text(), and FP_GRID_TRICKS::paste_text().

◆ do_clone()

virtual LIB_TABLE_ROW * LIB_TABLE_ROW::do_clone ( ) const
privatepure virtual

Implemented in SYMBOL_LIB_TABLE_ROW, FP_LIB_TABLE_ROW, and TEST_LIB_TABLE_ROW.

Referenced by clone().

◆ Format()

void LIB_TABLE_ROW::Format ( OUTPUTFORMATTER out,
int  nestLevel 
) const

Serialize this object as utf8 text to an OUTPUTFORMATTER, and tries to make it look good using multiple lines and indentation.

Parameters
outis an OUTPUTFORMATTER
nestLevelis the indentation level to base all lines of the output. Actual indentation will be 2 spaces for each nestLevel.

Definition at line 80 of file lib_table_base.cpp.

81{
82 // In Kicad, we save path and file names using the Unix notation (separator = '/')
83 // So ensure separator is always '/' is saved URI string
84 wxString uri = GetFullURI();
85 uri.Replace( '\\', '/' );
86
87 wxString extraOptions;
88
89 if( !GetIsEnabled() )
90 extraOptions += "(disabled)";
91
92 if( !GetIsVisible() )
93 extraOptions += "(hidden)";
94
95 out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s)%s)\n",
96 out->Quotew( GetNickName() ).c_str(),
97 out->Quotew( GetType() ).c_str(),
98 out->Quotew( uri ).c_str(),
99 out->Quotew( GetOptions() ).c_str(),
100 out->Quotew( GetDescr() ).c_str(),
101 extraOptions.ToStdString().c_str() );
102}
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
const wxString & GetDescr() const
Return the description of the library referenced by this row.
virtual const wxString GetType() const =0
Return the type of library represented by this row.
const wxString & GetNickName() const
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
bool GetIsEnabled() const
bool GetIsVisible() const
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:499
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:431

References GetDescr(), GetFullURI(), GetIsEnabled(), GetIsVisible(), GetNickName(), GetOptions(), GetType(), OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

◆ GetDescr()

const wxString & LIB_TABLE_ROW::GetDescr ( ) const
inline

Return the description of the library referenced by this row.

Definition at line 172 of file lib_table_base.h.

172{ return description; }

References description.

Referenced by Format(), LIB_TABLE::GetDescription(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), and SCH_EDIT_FRAME::LoadSheetFromFile().

◆ GetFullURI()

const wxString LIB_TABLE_ROW::GetFullURI ( bool  aSubstituted = false) const

Return the full location specifying URI for the LIB, either in original UI form or in environment variable expanded form.

Parameters
aSubstitutedTells if caller wanted the substituted form, else not.

Definition at line 64 of file lib_table_base.cpp.

65{
66 if( aSubstituted )
67 {
68#if !FP_LATE_ENVVAR // early expansion
69 return uri_expanded;
70
71#else // late expansion
72 return ExpandEnvVarSubstitutions( uri_user, nullptr );
73#endif
74 }
75
76 return uri_user;
77}
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:267

References ExpandEnvVarSubstitutions(), and uri_user.

Referenced by EXPORTER_STEP::composePCB(), SYMBOL_LIB_TABLE::CreateSymbolLib(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), SYMBOL_LIB_TABLE::DeleteSymbol(), SYMBOL_LIB_TABLE::DeleteSymbolLib(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), FOOTPRINT_EDIT_FRAME::DuplicateFootprint(), SYMBOL_LIB_TABLE::EnumerateSymbolLib(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), FP_LIB_TABLE::FootprintDelete(), FP_LIB_TABLE::FootprintEnumerate(), FP_LIB_TABLE::FootprintExists(), FP_LIB_TABLE::FootprintLibCreate(), FP_LIB_TABLE::FootprintLibDelete(), FP_LIB_TABLE::FootprintLoad(), FP_LIB_TABLE::FootprintSave(), Format(), FP_LIB_TABLE::GenerateTimestamp(), FP_LIB_TABLE::GetEnumeratedFootprint(), LIB_TABLE::GetFullURI(), SYMBOL_LIBRARY_MANAGER::GetLibraryHash(), idf_export_footprint(), FP_LIB_TABLE::IsFootprintLibWritable(), SYMBOL_LIB_TABLE::IsSymbolLibWritable(), RENDER_3D_RAYTRACE::load3DModels(), RENDER_3D_OPENGL::load3dModels(), FP_LIB_TABLE::LoadGlobalTable(), SYMBOL_LIB_TABLE::LoadGlobalTable(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_LIB_TABLE::LoadSymbol(), SYMBOL_LIB_TABLE::LoadSymbolLib(), FP_LIB_TABLE::PrefetchLib(), SYMBOL_LIB_TABLE_ROW::Refresh(), PCB::IFACE::SaveFileAs(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), SYMBOL_LIBRARY_MANAGER::SaveLibrary(), SYMBOL_LIB_TABLE::SaveSymbol(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), and PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists().

◆ GetIsEnabled()

bool LIB_TABLE_ROW::GetIsEnabled ( ) const
inline
Returns
the enabled status of this library row

Definition at line 123 of file lib_table_base.h.

123{ return enabled; }

References enabled.

Referenced by LIB_TABLE::findRow(), Format(), LIB_TABLE_GRID::GetValueAsBool(), SYMBOL_LIB_TABLE_ROW::SYMBOL_LIB_TABLE_ROW(), and PANEL_SYM_LIB_TABLE::verifyTables().

◆ GetIsLoaded()

bool LIB_TABLE_ROW::GetIsLoaded ( ) const
inline
Returns
true if the library was loaded without error

Definition at line 113 of file lib_table_base.h.

113{ return m_loaded; }

References m_loaded.

Referenced by SYMBOL_LIB_TABLE::IsSymbolLibLoaded().

◆ GetIsVisible()

bool LIB_TABLE_ROW::GetIsVisible ( ) const
inline

◆ GetMutex()

std::mutex & LIB_TABLE_ROW::GetMutex ( )
inline

Definition at line 183 of file lib_table_base.h.

183{ return m_loadMutex; }
std::mutex m_loadMutex

References m_loadMutex.

Referenced by SYMBOL_LIB_TABLE::LoadSymbol(), and SYMBOL_LIB_TABLE::LoadSymbolLib().

◆ GetNickName()

◆ GetOptions()

const wxString & LIB_TABLE_ROW::GetOptions ( ) const
inline

Return the options string, which may hold a password or anything else needed to instantiate the underlying library plugin.

Definition at line 162 of file lib_table_base.h.

162{ return options; }

References options.

Referenced by SYMBOL_LIB_TABLE::EnumerateSymbolLib(), Format(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_LIB_TABLE::LoadSymbolLib(), and FP_GRID_TRICKS::optionsEditor().

◆ GetParent()

LIB_TABLE * LIB_TABLE_ROW::GetParent ( void  ) const
inline

Definition at line 179 of file lib_table_base.h.

179{ return m_parent; }

References m_parent.

Referenced by SYMBOL_LIB_TABLE_ROW::Refresh(), and PANEL_SYM_LIB_TABLE::verifyTables().

◆ GetProperties()

◆ GetType()

virtual const wxString LIB_TABLE_ROW::GetType ( ) const
pure virtual

Return the type of library represented by this row.

Implemented in SYMBOL_LIB_TABLE_ROW, FP_LIB_TABLE_ROW, and TEST_LIB_TABLE_ROW.

Referenced by Format(), and FP_GRID_TRICKS::optionsEditor().

◆ operator!=()

bool LIB_TABLE_ROW::operator!= ( const LIB_TABLE_ROW r) const
inline

Definition at line 98 of file lib_table_base.h.

98{ return !( *this == r ); }
E_SERIE r
Definition: eserie.cpp:41

References r.

◆ operator=()

void LIB_TABLE_ROW::operator= ( const LIB_TABLE_ROW aRow)
protected

◆ operator==()

bool LIB_TABLE_ROW::operator== ( const LIB_TABLE_ROW r) const

Definition at line 105 of file lib_table_base.cpp.

106{
107 return nickName == r.nickName
108 && uri_user == r.uri_user
109 && options == r.options
110 && description == r.description
111 && enabled == r.enabled
112 && visible == r.visible;
113}

References description, enabled, nickName, options, r, uri_user, and visible.

Referenced by FP_LIB_TABLE_ROW::operator==(), and SYMBOL_LIB_TABLE_ROW::operator==().

◆ SetDescr()

void LIB_TABLE_ROW::SetDescr ( const wxString &  aDescr)
inline

Change the description of the library referenced by this row.

Definition at line 177 of file lib_table_base.h.

177{ description = aDescr; }

References description.

◆ SetEnabled()

void LIB_TABLE_ROW::SetEnabled ( bool  aEnabled = true)
inline

Change the enabled status of this library.

Definition at line 128 of file lib_table_base.h.

128{ enabled = aEnabled; }

References enabled.

Referenced by LIB_TABLE_GRID::SetValueAsBool(), and SYMBOL_LIB_TABLE_ROW::SYMBOL_LIB_TABLE_ROW().

◆ SetFullURI()

void LIB_TABLE_ROW::SetFullURI ( const wxString &  aFullURI)

Change the full URI for the library.

Definition at line 54 of file lib_table_base.cpp.

55{
56 uri_user = aFullURI;
57
58#if !FP_LATE_ENVVAR
59 uri_expanded = FP_LIB_TABLE::ExpandSubstitutions( aFullURI );
60#endif
61}

References uri_user.

Referenced by SYMBOL_EDIT_FRAME::addLibTableEntry(), LIB_TABLE_ROW(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), and PCB::IFACE::SaveFileAs().

◆ SetLoaded()

void LIB_TABLE_ROW::SetLoaded ( bool  aLoaded)
inline

Mark the row as being a loaded library.

Definition at line 118 of file lib_table_base.h.

118{ m_loaded = aLoaded; };

References m_loaded.

Referenced by SYMBOL_LIB_TABLE::EnumerateSymbolLib(), SYMBOL_LIB_TABLE::LoadSymbolLib(), and SYMBOL_LIB_TABLE_ROW::Refresh().

◆ SetNickName()

void LIB_TABLE_ROW::SetNickName ( const wxString &  aNickName)
inline

Change the logical name of this library, useful for an editor.

Definition at line 108 of file lib_table_base.h.

108{ nickName = aNickName; }

References nickName.

Referenced by SYMBOL_EDIT_FRAME::addLibTableEntry().

◆ SetOptions()

void LIB_TABLE_ROW::SetOptions ( const wxString &  aOptions)

Change the library options strings.

Definition at line 116 of file lib_table_base.cpp.

117{
118 options = aOptions;
119
120 // set PROPERTIES* from options
122}
void setProperties(STRING_UTF8_MAP *aProperties)
static STRING_UTF8_MAP * ParseOptions(const std::string &aOptionsList)
Parses aOptionsList and places the result into a #PROPERTIES object which is returned.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

References options, LIB_TABLE::ParseOptions(), setProperties(), and TO_UTF8.

Referenced by SYMBOL_LIB_TABLE::EnumerateSymbolLib(), LIB_TABLE_ROW(), SYMBOL_LIB_TABLE::LoadSymbolLib(), and FP_GRID_TRICKS::optionsEditor().

◆ SetParent()

void LIB_TABLE_ROW::SetParent ( LIB_TABLE aParent)
inline

Definition at line 181 of file lib_table_base.h.

181{ m_parent = aParent; }

References m_parent.

Referenced by LIB_TABLE::InsertRow(), and PANEL_SYM_LIB_TABLE::verifyTables().

◆ setProperties()

void LIB_TABLE_ROW::setProperties ( STRING_UTF8_MAP aProperties)
private

Definition at line 48 of file lib_table_base.cpp.

49{
50 properties.reset( aProperties );
51}

References properties.

Referenced by SetOptions().

◆ SetType()

virtual void LIB_TABLE_ROW::SetType ( const wxString &  aType)
pure virtual

Change the type of library represented by this row that must be implemented in the derived object to provide the library table row type.

Implemented in SYMBOL_LIB_TABLE_ROW, FP_LIB_TABLE_ROW, and TEST_LIB_TABLE_ROW.

◆ SetVisible()

void LIB_TABLE_ROW::SetVisible ( bool  aVisible = true)
inline

Definition at line 132 of file lib_table_base.h.

132{ visible = aVisible; }

References visible.

Referenced by LIB_TABLE_GRID::SetValueAsBool().

Member Data Documentation

◆ description

wxString LIB_TABLE_ROW::description
private

Definition at line 241 of file lib_table_base.h.

Referenced by GetDescr(), operator==(), and SetDescr().

◆ enabled

bool LIB_TABLE_ROW::enabled = true
private

Whether the LIB_TABLE_ROW is enabled.

Definition at line 243 of file lib_table_base.h.

Referenced by GetIsEnabled(), operator==(), and SetEnabled().

◆ m_loaded

bool LIB_TABLE_ROW::m_loaded = false
private

Whether the LIB_TABLE_ROW is loaded.

Definition at line 245 of file lib_table_base.h.

Referenced by GetIsLoaded(), and SetLoaded().

◆ m_loadMutex

std::mutex LIB_TABLE_ROW::m_loadMutex
private

Definition at line 250 of file lib_table_base.h.

Referenced by GetMutex().

◆ m_parent

LIB_TABLE* LIB_TABLE_ROW::m_parent
private

Pointer to the table this row lives in (maybe null)

Definition at line 246 of file lib_table_base.h.

Referenced by GetParent(), and SetParent().

◆ nickName

wxString LIB_TABLE_ROW::nickName
private

Definition at line 233 of file lib_table_base.h.

Referenced by GetNickName(), operator==(), and SetNickName().

◆ options

wxString LIB_TABLE_ROW::options
private

Definition at line 240 of file lib_table_base.h.

Referenced by GetOptions(), operator==(), and SetOptions().

◆ properties

std::unique_ptr<STRING_UTF8_MAP> LIB_TABLE_ROW::properties
private

Definition at line 248 of file lib_table_base.h.

Referenced by GetProperties(), LIB_TABLE_ROW(), and setProperties().

◆ uri_user

wxString LIB_TABLE_ROW::uri_user
private

what user entered from UI or loaded from disk

Definition at line 234 of file lib_table_base.h.

Referenced by GetFullURI(), operator==(), and SetFullURI().

◆ visible

bool LIB_TABLE_ROW::visible = true
private

Whether the LIB_TABLE_ROW is visible in choosers.

Definition at line 244 of file lib_table_base.h.

Referenced by GetIsVisible(), operator==(), and SetVisible().


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