KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_library_adapter.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 * @author Jon Evans <[email protected]>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <magic_enum.hpp>
22#include <chrono>
23#include <memory>
24
25#include <common.h>
26#include <dialog_shim.h>
27#include <ki_exception.h>
28#include <wx/log.h>
29
30#include <lib_symbol.h>
32#include <sch_io/sch_io_mgr.h>
33
34#include <env_vars.h>
35#include <pgm_base.h>
36#include <project.h>
37#include <thread_pool.h>
38#include <trace_helpers.h>
40
41using namespace std::chrono_literals;
42
43
44const char* SYMBOL_LIBRARY_ADAPTER::PropPowerSymsOnly = "pwr_sym_only";
45const char* SYMBOL_LIBRARY_ADAPTER::PropNonPowerSymsOnly = "non_pwr_sym_only";
46
48
50
51
56
57
62
63
68
69
71{
72 SCH_IO* ret = dynamic_cast<SCH_IO*>( aRow->plugin.get() );
73 wxCHECK( aRow->plugin && ret, nullptr );
74 return ret;
75}
76
77
78void SYMBOL_LIBRARY_ADAPTER::enumerateLibrary( LIB_DATA* aLib, const wxString& aUri )
79{
80 wxArrayString dummyList;
81
82 std::lock_guard pluginGuard( pluginMutex( aLib->row->Nickname() ) );
83
84 std::map<std::string, UTF8> options = aLib->row->GetOptionsMap();
85 schplugin( aLib )->EnumerateSymbolLib( dummyList, aUri, &options );
86}
87
88
89std::optional<LIB_STATUS> SYMBOL_LIBRARY_ADAPTER::LoadOne( LIB_DATA* aLib )
90{
92
93 std::lock_guard pluginGuard( pluginMutex( aLib->row->Nickname() ) );
94
95 std::map<std::string, UTF8> options = aLib->row->GetOptionsMap();
96
97 // Generation before flag, so both a cancel already running and one that starts later are seen
98 const unsigned abortGeneration = m_abortGeneration.load();
99 const bool cancelling = m_cancelling.load();
100
101 try
102 {
103 wxArrayString dummyList;
104 schplugin( aLib )->EnumerateSymbolLib( dummyList, getUri( aLib->row ), &options );
105 wxLogTrace( traceLibraries, "Sym: %s: library enumerated %zu items", aLib->row->Nickname(), dummyList.size() );
107 aLib->status.error.reset();
108 }
109 catch( IO_ERROR& e )
110 {
111 // A load the abort cut short is not a failure of the library
112 if( cancelling || m_cancelling.load() || m_abortGeneration.load() != abortGeneration )
113 {
115 aLib->status.error.reset();
116 return aLib->status;
117 }
118
120 aLib->status.error = LIBRARY_ERROR( e.Problem(), e.Where() );
121 wxLogTrace( traceLibraries, "Sym: %s: plugin threw exception: %s", aLib->row->Nickname(), e.What() );
122 }
123
124 return aLib->status;
125}
126
127
128std::optional<LIB_STATUS> SYMBOL_LIBRARY_ADAPTER::CheckLibrary( LIB_DATA* aLib )
129{
131
132 std::lock_guard pluginGuard( pluginMutex( aLib->row->Nickname() ) );
133
134 std::map<std::string, UTF8> options = aLib->row->GetOptionsMap();
135
136 try
137 {
138 schplugin( aLib )->CheckLibrary( getUri( aLib->row ), &options );
140 aLib->status.error.reset();
141 }
142 catch( IO_ERROR& e )
143 {
145 aLib->status.error = LIBRARY_ERROR( e.Problem(), e.Where() );
146 wxLogTrace( traceLibraries, "Sym: %s: library check failed: %s", aLib->row->Nickname(), e.What() );
147 }
148
149 return aLib->status;
150}
151
152
153std::optional<LIB_STATUS> SYMBOL_LIBRARY_ADAPTER::LoadOne( const wxString& nickname )
154{
156
157 if( result.has_value() )
158 return LoadOne( *result );
159
160 return LIB_STATUS { .load_status = LOAD_STATUS::LOAD_ERROR,
161 .error = LIBRARY_ERROR( { result.error() } ) };
162}
163
164
166{
167 SCH_IO_MGR::SCH_FILE_T type = SCH_IO_MGR::EnumFromStr( row->Type() );
168
169 if( type == SCH_IO_MGR::SCH_NESTED_TABLE )
170 {
171 wxString msg;
172 wxFileName fileName( m_manager.GetFullURI( row, true, &m_manager.Project() ) );
173
174 if( fileName.FileExists() )
175 return tl::unexpected( LIBRARY_TABLE_OK() );
176 else
177 msg = wxString::Format( _( "Nested table '%s' not found." ), row->URI() );
178
179 return tl::unexpected( LIBRARY_ERROR( msg ) );
180 }
181 else if( type == SCH_IO_MGR::SCH_FILE_UNKNOWN )
182 {
183 wxLogTrace( traceLibraries, "Sym: Plugin type %s is unknown!", row->Type() );
184 wxString msg = wxString::Format( _( "Unknown library type %s " ), row->Type() );
185 return tl::unexpected( LIBRARY_ERROR( msg ) );
186 }
187
188 SCH_IO* plugin = SCH_IO_MGR::FindPlugin( type );
189 wxCHECK( plugin, tl::unexpected( LIBRARY_ERROR( _( "Internal error" ) ) ) );
190
191 plugin->SetLibraryManagerAdapter( this );
192
193 wxLogTrace( traceLibraries, "Sym: Library %s (%s) plugin created", row->Nickname(),
194 magic_enum::enum_name( row->Scope() ) );
195
196 return plugin;
197}
198
199
200std::vector<LIB_SYMBOL*> SYMBOL_LIBRARY_ADAPTER::GetSymbols( const wxString& aNickname, SYMBOL_TYPE aType )
201{
202 std::vector<LIB_SYMBOL*> symbols;
203
204 std::optional<const LIB_DATA*> maybeLib = fetchIfLoaded( aNickname );
205
206 if( !maybeLib )
207 return symbols;
208
209 const LIB_DATA* lib = *maybeLib;
210
211 std::lock_guard pluginGuard( pluginMutex( aNickname ) );
212
213 std::map<std::string, UTF8> options = lib->row->GetOptionsMap();
214
215 if( aType == SYMBOL_TYPE::POWER_ONLY )
216 options[PropPowerSymsOnly] = "";
217
218 try
219 {
220 schplugin( lib )->EnumerateSymbolLib( symbols, getUri( lib->row ), &options );
221 }
222 catch( IO_ERROR& e )
223 {
224 wxLogTrace( traceLibraries, "Sym: Exception enumerating library %s: %s", lib->row->Nickname(), e.What() );
225 }
226
227 for( LIB_SYMBOL* symbol : symbols )
228 {
229 LIB_ID id = symbol->GetLibId();
230 id.SetLibNickname( lib->row->Nickname() );
231 symbol->SetLibId( id );
232 }
233
234 return symbols;
235}
236
237
238std::vector<wxString> SYMBOL_LIBRARY_ADAPTER::GetSymbolNames( const wxString& aNickname, SYMBOL_TYPE aType )
239{
240 wxArrayString namesAS;
241 std::vector<wxString> names;
242
243 if( std::optional<const LIB_DATA*> maybeLib = fetchIfLoaded( aNickname ) )
244 {
245 const LIB_DATA* lib = *maybeLib;
246
247 std::lock_guard pluginGuard( pluginMutex( aNickname ) );
248
249 std::map<std::string, UTF8> options = lib->row->GetOptionsMap();
250
251 if( aType == SYMBOL_TYPE::POWER_ONLY )
252 options[PropPowerSymsOnly] = "";
253
254 try
255 {
256 schplugin( lib )->EnumerateSymbolLib( namesAS, getUri( lib->row ), &options );
257 }
258 catch( const IO_ERROR& e )
259 {
260 wxLogTrace( traceLibraries, "Sym: Exception enumerating library %s: %s",
261 lib->row->Nickname(), e.What() );
262 }
263 }
264
265 for( const wxString& name : namesAS )
266 names.emplace_back( name );
267
268 return names;
269}
270
271
272LIB_SYMBOL* SYMBOL_LIBRARY_ADAPTER::LoadSymbol( const wxString& aNickname, const wxString& aName )
273{
274 if( std::optional<const LIB_DATA*> lib = fetchIfLoaded( aNickname ) )
275 {
276 std::lock_guard pluginGuard( pluginMutex( aNickname ) );
277
278 std::map<std::string, UTF8> options = ( *lib )->row->GetOptionsMap();
279
280 if( LIB_SYMBOL* symbol = schplugin( *lib )->LoadSymbol( getUri( ( *lib )->row ), aName, &options ) )
281 {
282 LIB_ID id = symbol->GetLibId();
283 id.SetLibNickname( ( *lib )->row->Nickname() );
284 symbol->SetLibId( id );
285 return symbol;
286 }
287 }
288 else
289 {
290 wxLogTrace( traceLibraries, "LoadSymbol: requested library %s not loaded", aNickname );
291 }
292
293 return nullptr;
294}
295
296
298 std::unique_ptr<LIB_SYMBOL> aSymbol, bool aOverwrite )
299{
300 wxCHECK( aSymbol, SAVE_SKIPPED );
301
302 LIBRARY_RESULT<LIB_DATA*> libResult = loadIfNeeded( aNickname );
303
304 if( !libResult.has_value() )
305 {
306 wxLogTrace( traceLibraries, "SaveSymbol: unable to load library %s: %s", aNickname,
307 libResult.error().message );
308 return SAVE_SKIPPED;
309 }
310
311 LIB_DATA* lib = *libResult;
312
313 if( !lib )
314 {
315 wxLogTrace( traceLibraries, "SaveSymbol: library %s not found", aNickname );
316 return SAVE_SKIPPED;
317 }
318
319 SCH_IO* plugin = schplugin( lib );
320 wxCHECK( plugin, SAVE_SKIPPED );
321
322 std::lock_guard pluginGuard( pluginMutex( aNickname ) );
323
324 const wxString symbolName = aSymbol->GetName();
325
326 std::map<std::string, UTF8> options = lib->row->GetOptionsMap();
327
328 if( !aOverwrite )
329 {
330 try
331 {
332 LIB_SYMBOL* existing = plugin->LoadSymbol( getUri( lib->row ), symbolName, &options );
333
334 if( existing )
335 return SAVE_SKIPPED;
336 }
337 catch( const IO_ERROR& e )
338 {
339 wxLogTrace( traceLibraries, "SaveSymbol: error checking for existing symbol %s:%s: %s", aNickname,
340 symbolName, e.What() );
341 return SAVE_SKIPPED;
342 }
343 }
344
345 try
346 {
347 plugin->SaveSymbol( getUri( lib->row ), std::move( aSymbol ), &options );
348 }
349 catch( const IO_ERROR& e )
350 {
351 wxLogTrace( traceLibraries, "SaveSymbol: error saving %s:%s: %s", aNickname, symbolName, e.What() );
352 return SAVE_SKIPPED;
353 }
354
355 return SAVE_OK;
356}
357
358
359void SYMBOL_LIBRARY_ADAPTER::DeleteSymbol( const wxString& aNickname, const wxString& aSymbolName )
360{
361 LIBRARY_RESULT<LIB_DATA*> libResult = loadIfNeeded( aNickname );
362
363 if( !libResult.has_value() || !*libResult )
364 {
365 wxLogTrace( traceLibraries, "DeleteSymbol: unable to load library %s", aNickname );
366 return;
367 }
368
369 LIB_DATA* lib = *libResult;
370
371 std::lock_guard lock( pluginMutex( aNickname ) );
372
373 std::map<std::string, UTF8> options = lib->row->GetOptionsMap();
374 schplugin( lib )->DeleteSymbol( getUri( lib->row ), aSymbolName, &options );
375}
376
377
379{
380 // Route through fetchIfLoaded() so LOAD_ERROR sentinel entries, which carry a null
381 // plugin, are filtered out instead of dereferenced.
382 if( std::optional<const LIB_DATA*> lib = fetchIfLoaded( aLib ) )
383 return ( *lib )->plugin->IsLibraryWritable( getUri( ( *lib )->row ) );
384
385 return false;
386}
387
388
389std::vector<wxString> SYMBOL_LIBRARY_ADAPTER::GetAvailableExtraFields( const wxString& aNickname )
390{
391 std::vector<wxString> fields;
392
393 if( std::optional<LIB_DATA*> result = fetchIfLoaded( aNickname ) )
394 {
395 LIB_DATA* rowData = *result;
396
397 int hash = schplugin( rowData )->GetModifyHash();
398
399 if( hash != rowData->modify_hash )
400 {
401 rowData->modify_hash = hash;
403 }
404
405 return rowData->available_fields_cache;
406 }
407
408 return fields;
409}
410
411
412bool SYMBOL_LIBRARY_ADAPTER::SupportsSubLibraries( const wxString& aNickname ) const
413{
414 if( std::optional<const LIB_DATA*> result = fetchIfLoaded( aNickname ) )
415 {
416 const LIB_DATA* rowData = *result;
417 return schplugin( rowData )->SupportsSubLibraries();
418 }
419
420 return false;
421}
422
423
424std::vector<SUB_LIBRARY> SYMBOL_LIBRARY_ADAPTER::GetSubLibraries( const wxString& aNickname ) const
425{
426 std::vector<SUB_LIBRARY> ret;
427
428 if( std::optional<const LIB_DATA*> result = fetchIfLoaded( aNickname ) )
429 {
430 const LIB_DATA* rowData = *result;
431
432 try
433 {
434 std::vector<wxString> names;
435 schplugin( rowData )->GetSubLibraryNames( names );
436
437 for( const wxString& name : names )
438 {
439 ret.emplace_back( SUB_LIBRARY {
440 .nickname = name,
441 .description = schplugin( rowData )->GetSubLibraryDescription( name ) } );
442 }
443 }
444 catch( const IO_ERROR& e )
445 {
446 wxLogTrace( traceLibraries, "Sym: Exception getting sub-libraries for %s: %s",
447 aNickname, e.What() );
448 }
449 }
450
451 return ret;
452}
453
454
456{
457 // Queried on every library table repaint, so ask each plugin type only once (UI thread only)
458 static std::map<SCH_IO_MGR::SCH_FILE_T, bool> s_supported;
459
460 SCH_IO_MGR::SCH_FILE_T type = SCH_IO_MGR::EnumFromStr( aRow.Type() );
461 auto it = s_supported.find( type );
462
463 if( it == s_supported.end() )
464 {
465 IO_RELEASER<SCH_IO> plugin( SCH_IO_MGR::FindPlugin( type ) );
466 it = s_supported.emplace( type, plugin && plugin->SupportsConfigurationDialog() ).first;
467 }
468
469 return it->second;
470}
471
472
474 wxWindow* aParent )
475{
476 IO_RELEASER<SCH_IO> plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::EnumFromStr( aRow.Type() ) ) );
477
478 if( !plugin || !plugin->SupportsConfigurationDialog() )
479 return wxID_CANCEL;
480
481 plugin->SetLibraryManagerAdapter( this );
482
483 // Resolved like a normal load so a relative URI and ${CWD} in the connection string agree
484 wxString path = getUri( &aRow );
485 std::unique_ptr<DIALOG_SHIM> dialog( plugin->CreateConfigurationDialog( aParent, path ) );
486
487 if( !dialog )
488 return wxID_CANCEL;
489
490 int ret = dialog->ShowModal();
491
492 if( ret == wxID_OK )
493 {
494 // An edited or new grid row is reloaded when the outer table is applied instead
495 std::optional<LIBRARY_TABLE_ROW*> committed = m_manager.GetRow( Type(), aRow.Nickname(), aScope );
496
497 if( committed && ( *committed )->URI() == aRow.URI() && ( *committed )->Type() == aRow.Type() )
498 ReloadLibraryEntry( aRow.Nickname(), aScope );
499 }
500
501 return ret;
502}
503
504
506{
507 int hash = 0;
508
509 for( const LIBRARY_TABLE_ROW* row : m_manager.Rows( Type() ) )
510 {
511 if( std::optional<const LIB_DATA*> result = fetchIfLoaded( row->Nickname() ) )
512 {
513 const LIB_DATA* rowData = *result;
514 wxCHECK2( rowData->row, continue );
515 hash += schplugin( rowData )->GetModifyHash();
516 }
517 }
518
519 return hash;
520}
521
522
523std::optional<int> SYMBOL_LIBRARY_ADAPTER::GetLibraryModifyHash( const wxString& aNickname ) const
524{
525 if( std::optional<const LIB_DATA*> result = fetchIfLoaded( aNickname ) )
526 {
527 const LIB_DATA* rowData = *result;
528 wxCHECK( rowData->row, std::nullopt );
529 return schplugin( rowData )->GetModifyHash();
530 }
531
532 return std::nullopt;
533}
const char * name
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
virtual const wxString Problem() const
what was the problem?
virtual const wxString Where() const
where did the Problem() occur?
A wrapper for static data that should not be destroyed at program exit.
std::atomic_bool m_cancelling
Set with m_abort by an abort that cancels, so only such an abort turns a failed load into INVALID.
void ReloadLibraryEntry(const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH)
Synchronously recreates the plugin for and reloads the given library.
std::atomic< unsigned > m_abortGeneration
Counts cancelling aborts, so a load can tell one that began after it started from one that already en...
LIBRARY_MANAGER_ADAPTER(LIBRARY_MANAGER &aManager)
Constructs a type-specific adapter into the library manager.
wxString getUri(const LIBRARY_TABLE_ROW *aRow) const
void retireAllLibraries()
For derived destructors, while globalLibs() is still resolvable and plugin worker threads can still c...
LIBRARY_RESULT< LIB_DATA * > loadIfNeeded(const wxString &aNickname)
Fetches a loaded library, triggering a load of that library if it isn't loaded yet.
static std::recursive_mutex & pluginMutex(const wxString &aNickname)
Serializes access to a library's shared plugin instance so its single mutable cache is not raced by c...
LIBRARY_MANAGER & m_manager
std::optional< const LIB_DATA * > fetchIfLoaded(const wxString &aNickname) const
LIBRARY_TABLE_SCOPE Scope() const
std::map< std::string, UTF8 > GetOptionsMap() const
const wxString & Type() const
const wxString & URI() const
const wxString & Nickname() const
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition lib_id.cpp:113
Define a library symbol object.
Definition lib_symbol.h:114
static SCH_FILE_T EnumFromStr(const wxString &aFileType)
Return the file type from the corresponding plugin type name: "kicad", "legacy", etc.
Base class that schematic file and library loading and saving plugins should derive from.
Definition sch_io.h:60
virtual void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
Definition sch_io.cpp:90
virtual bool SupportsSubLibraries() const
Definition sch_io.h:321
virtual int GetModifyHash() const =0
Return the modification hash from the library cache.
virtual void GetAvailableSymbolFields(std::vector< wxString > &aNames)
Retrieves a list of (custom) field names that are present on symbols in this library.
Definition sch_io.h:357
virtual void DeleteSymbol(const wxString &aLibraryPath, const wxString &aSymbolName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Delete the entire LIB_SYMBOL associated with aAliasName from the library aLibraryPath.
Definition sch_io.cpp:132
virtual void CheckLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr)
Validate that the library at aLibraryPath is reachable and well-formed, without necessarily loading s...
Definition sch_io.cpp:108
virtual LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aPartName, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
Definition sch_io.cpp:116
virtual wxString GetSubLibraryDescription(const wxString &aName)
Gets a description of a sublibrary.
Definition sch_io.h:346
virtual void GetSubLibraryNames(std::vector< wxString > &aNames)
Retrieves a list of sub-libraries in this library.
Definition sch_io.h:335
std::optional< LIB_STATUS > LoadOne(LIB_DATA *aLib) override
Loads or reloads the given library, if it exists.
static SCH_IO * schplugin(const LIB_DATA *aRow)
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
void DeleteSymbol(const wxString &aNickname, const wxString &aSymbolName)
Deletes the aSymbolName from the library given by aNickname.
std::optional< LIB_STATUS > CheckLibrary(LIB_DATA *aLib) override
Validates that a library is loadable. May not necessarily load the library!
SAVE_T SaveSymbol(const wxString &aNickname, std::unique_ptr< LIB_SYMBOL > aSymbol, bool aOverwrite=true)
Write aSymbol to an existing library given by aNickname.
void enumerateLibrary(LIB_DATA *aLib, const wxString &aUri) override
Override in derived class to perform library-specific enumeration.
std::vector< wxString > GetSymbolNames(const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS)
bool SupportsSubLibraries(const wxString &aNickname) const
LIBRARY_RESULT< IO_BASE * > createPlugin(const LIBRARY_TABLE_ROW *row) override
Creates a concrete plugin for the given row.
int ShowConfigurationDialog(const LIBRARY_TABLE_ROW &aRow, LIBRARY_TABLE_SCOPE aScope, wxWindow *aParent) override
Shows the plugin's configuration dialog for a library table row.
std::vector< SUB_LIBRARY > GetSubLibraries(const wxString &aNickname) const
SYMBOL_LIBRARY_ADAPTER(LIBRARY_MANAGER &aManager)
static wxString GlobalPathEnvVariableName()
static const char * PropPowerSymsOnly
LIBRARY_TABLE_TYPE Type() const override
The type of library table this adapter works with.
IO_BASE * plugin(const LIB_DATA *aRow) override
std::vector< LIB_SYMBOL * > GetSymbols(const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS)
static LEAK_AT_EXIT< std::shared_mutex > GlobalLibraryMutex
static LEAK_AT_EXIT< std::map< wxString, LIB_DATA > > GlobalLibraries
bool SupportsConfigurationDialog(const LIBRARY_TABLE_ROW &aRow) const override
Configuration works from the row itself, so libraries that failed to load or are not yet committed to...
std::vector< wxString > GetAvailableExtraFields(const wxString &aNickname)
Returns a list of additional (non-mandatory) symbol fields present in the given library.
SAVE_T
The set of return values from SaveSymbol() below.
static const char * PropNonPowerSymsOnly
bool IsSymbolLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
std::optional< int > GetLibraryModifyHash(const wxString &aNickname) const
Return the modify hash of a single library if it is currently loaded.
#define _(s)
Functions related to environment variables, including help functions.
const wxChar *const traceLibraries
Flag to enable library table and library manager tracing.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
Definition io_mgr.h:33
tl::expected< ResultType, LIBRARY_ERROR > LIBRARY_RESULT
LIBRARY_TABLE_SCOPE
KICOMMON_API wxString GetVersionedEnvVarName(const wxString &aBaseName)
Construct a versioned environment variable based on this KiCad major version.
Definition env_vars.cpp:79
see class PGM_BASE
Storage for an actual loaded library (including library content owned by the plugin)
std::vector< wxString > available_fields_cache
LIB_STATUS status
std::unique_ptr< IO_BASE > plugin
Never destroyed while holding the map's mutex; a plugin's worker thread may be blocked on it.
const LIBRARY_TABLE_ROW * row
The overall status of a loaded or loading library.
std::optional< LIBRARY_ERROR > error
LOAD_STATUS load_status
A descriptor for a sub-library (supported by database and http libraries)
std::string path
wxString result
Test unit parsing edge cases and error handling.
wxLogTrace helper definitions.