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)
 
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...
 
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...
 
const PROPERTIESGetProperties () 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 (PROPERTIES *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 m_loaded = false
 Whether the LIB_TABLE_ROW is loaded. More...
 
std::unique_ptr< PROPERTIESproperties
 

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 65 of file lib_table_base.h.

Constructor & Destructor Documentation

◆ LIB_TABLE_ROW() [1/3]

LIB_TABLE_ROW::LIB_TABLE_ROW ( )
inline

Definition at line 68 of file lib_table_base.h.

68  :
69  enabled( true ),
70  m_loaded( false )
71  {
72  }
bool enabled
Whether the LIB_TABLE_ROW is enabled.
bool m_loaded
Whether the LIB_TABLE_ROW is loaded.

◆ ~LIB_TABLE_ROW()

virtual LIB_TABLE_ROW::~LIB_TABLE_ROW ( )
inlinevirtual

Definition at line 74 of file lib_table_base.h.

75  {
76  }

◆ LIB_TABLE_ROW() [2/3]

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

Definition at line 78 of file lib_table_base.h.

79  :
80  nickName( aNick ),
81  description( aDescr ),
82  enabled( true ),
83  m_loaded( false )
84  {
85  properties.reset();
86  SetOptions( aOptions );
87  SetFullURI( aURI );
88  }
bool enabled
Whether the LIB_TABLE_ROW is enabled.
std::unique_ptr< PROPERTIES > properties
wxString description
void SetFullURI(const wxString &aFullURI)
Change the full URI for the library.
void SetOptions(const wxString &aOptions)
Change the library options strings.
wxString nickName
bool m_loaded
Whether the LIB_TABLE_ROW is loaded.

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 191 of file lib_table_base.h.

191  :
192  nickName( aRow.nickName ),
193  uri_user( aRow.uri_user ),
194 #if !FP_LATE_ENVVAR
195  uri_expanded( aRow.uri_expanded ),
196 #endif
197  options( aRow.options ),
198  description( aRow.description ),
199  enabled( aRow.enabled ),
200  m_loaded( aRow.m_loaded )
201  {
202  if( aRow.properties )
203  properties = std::make_unique<PROPERTIES>( *aRow.properties.get() );
204  else
205  properties.reset();
206  }
bool enabled
Whether the LIB_TABLE_ROW is enabled.
std::unique_ptr< PROPERTIES > properties
wxString description
wxString options
wxString nickName
wxString uri_user
what user entered from UI or loaded from disk
bool m_loaded
Whether the LIB_TABLE_ROW is loaded.

References properties.

Member Function Documentation

◆ clone()

LIB_TABLE_ROW* LIB_TABLE_ROW::clone ( ) const
inline

Definition at line 185 of file lib_table_base.h.

186  {
187  return do_clone();
188  }
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 84 of file lib_table_base.cpp.

85 {
86  // In Kicad, we save path and file names using the Unix notation (separator = '/')
87  // So ensure separator is always '/' is saved URI string
88  wxString uri = GetFullURI();
89  uri.Replace( '\\', '/' );
90 
91  wxString extraOptions;
92 
93  if( !GetIsEnabled() )
94  {
95  extraOptions += "(disabled)";
96  }
97 
98  out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s)%s)\n",
99  out->Quotew( GetNickName() ).c_str(),
100  out->Quotew( GetType() ).c_str(),
101  out->Quotew( uri ).c_str(),
102  out->Quotew( GetOptions() ).c_str(),
103  out->Quotew( GetDescr() ).c_str(),
104  extraOptions.ToStdString().c_str()
105  );
106 }
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
virtual const wxString GetType() const =0
Return the type of library represented by this row.
const wxString & GetDescr() const
Return the description of the library referenced by this row.
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...
const wxString & GetNickName() const
bool GetIsEnabled() const
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:476
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408

References OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

◆ GetDescr()

const wxString& LIB_TABLE_ROW::GetDescr ( ) const
inline

◆ 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 68 of file lib_table_base.cpp.

69 {
70  if( aSubstituted )
71  {
72 #if !FP_LATE_ENVVAR // early expansion
73  return uri_expanded;
74 
75 #else // late expansion
76  return ExpandEnvVarSubstitutions( uri_user, nullptr );
77 #endif
78  }
79 
80  return uri_user;
81 }
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:255
wxString uri_user
what user entered from UI or loaded from disk

References ExpandEnvVarSubstitutions().

Referenced by SYMBOL_LIB_TABLE::CreateSymbolLib(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), SYMBOL_LIB_TABLE::DeleteSymbol(), SYMBOL_LIB_TABLE::DeleteSymbolLib(), LIB_VIEW_FRAME::DisplayLibInfos(), SYMBOL_LIB_TABLE::EnumerateSymbolLib(), 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(), FP_LIB_TABLE::GenerateTimestamp(), FP_LIB_TABLE::GetEnumeratedFootprint(), LIB_TABLE::GetFullURI(), LIB_TABLE_GRID::GetValue(), FP_LIB_TABLE::IsFootprintLibWritable(), SYMBOL_LIB_TABLE::IsSymbolLibWritable(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_LIB_TABLE::LoadSymbol(), SYMBOL_LIB_TABLE::LoadSymbolLib(), FP_LIB_TABLE::PrefetchLib(), SCH::IFACE::SaveFileAs(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), SYMBOL_LIB_TABLE::SaveSymbol(), and FOOTPRINT_VIEWER_FRAME::UpdateTitle().

◆ GetIsEnabled()

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

Definition at line 117 of file lib_table_base.h.

117 { return enabled; }
bool enabled
Whether the LIB_TABLE_ROW is enabled.

References enabled.

Referenced by LIB_TABLE_GRID::GetValue(), LIB_TABLE_GRID::GetValueAsBool(), LIB_TABLE::HasLibrary(), 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 107 of file lib_table_base.h.

107 { return m_loaded; }
bool m_loaded
Whether the LIB_TABLE_ROW is loaded.

References m_loaded.

Referenced by SYMBOL_LIB_TABLE::IsSymbolLibLoaded().

◆ 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 152 of file lib_table_base.h.

152 { return options; }
wxString options

References options.

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

◆ 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 LIB_TABLE_GRID::GetValue(), and FP_GRID_TRICKS::optionsEditor().

◆ operator!=()

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

Definition at line 92 of file lib_table_base.h.

92 { return !( *this == 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 109 of file lib_table_base.cpp.

110 {
111  return nickName == r.nickName
112  && uri_user == r.uri_user
113  && options == r.options
114  && description == r.description
115  && enabled == r.enabled;
116 }
bool enabled
Whether the LIB_TABLE_ROW is enabled.
wxString description
wxString options
wxString nickName
wxString uri_user
what user entered from UI or loaded from disk

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

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 167 of file lib_table_base.h.

167 { description = aDescr; }
wxString description

References description.

Referenced by LIB_TABLE_GRID::SetValue().

◆ SetEnabled()

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

Change the enabled status of this library.

Definition at line 122 of file lib_table_base.h.

122 { enabled = aEnabled; }
bool enabled
Whether the LIB_TABLE_ROW is enabled.

References enabled.

Referenced by LIB_TABLE_GRID::SetValue(), 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 58 of file lib_table_base.cpp.

59 {
60  uri_user = aFullURI;
61 
62 #if !FP_LATE_ENVVAR
63  uri_expanded = FP_LIB_TABLE::ExpandSubstitutions( aFullURI );
64 #endif
65 }
wxString uri_user
what user entered from UI or loaded from disk

Referenced by LIB_TABLE_ROW(), SCH::IFACE::SaveFileAs(), and LIB_TABLE_GRID::SetValue().

◆ SetLoaded()

void LIB_TABLE_ROW::SetLoaded ( bool  aLoaded)
inline

Mark the row as being a loaded library.

Definition at line 112 of file lib_table_base.h.

112 { m_loaded = aLoaded; };
bool m_loaded
Whether the LIB_TABLE_ROW is loaded.

References m_loaded.

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

◆ SetNickName()

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

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

Definition at line 102 of file lib_table_base.h.

102 { nickName = aNickName; }
wxString nickName

References nickName.

Referenced by LIB_TABLE_GRID::SetValue().

◆ SetOptions()

void LIB_TABLE_ROW::SetOptions ( const wxString &  aOptions)

Change the library options strings.

Definition at line 119 of file lib_table_base.cpp.

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

References LIB_TABLE::ParseOptions(), and TO_UTF8.

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

◆ setProperties()

void LIB_TABLE_ROW::setProperties ( PROPERTIES aProperties)
private

Definition at line 52 of file lib_table_base.cpp.

53 {
54  properties.reset( aProperties );
55 }
std::unique_ptr< PROPERTIES > properties

◆ 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 FP_LIB_TABLE_ROW, SYMBOL_LIB_TABLE_ROW, and TEST_LIB_TABLE_ROW.

Referenced by LIB_TABLE_GRID::SetValue().

Member Data Documentation

◆ description

wxString LIB_TABLE_ROW::description
private

Definition at line 223 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 225 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 226 of file lib_table_base.h.

Referenced by GetIsLoaded(), and SetLoaded().

◆ nickName

wxString LIB_TABLE_ROW::nickName
private

Definition at line 215 of file lib_table_base.h.

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

◆ options

wxString LIB_TABLE_ROW::options
private

Definition at line 222 of file lib_table_base.h.

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

◆ properties

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

Definition at line 228 of file lib_table_base.h.

Referenced by GetProperties(), and LIB_TABLE_ROW().

◆ uri_user

wxString LIB_TABLE_ROW::uri_user
private

what user entered from UI or loaded from disk

Definition at line 216 of file lib_table_base.h.

Referenced by operator==().


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