22#ifndef SYMBOL_LIBRARY_MANAGER_ADAPTER_H
23#define SYMBOL_LIBRARY_MANAGER_ADAPTER_H
65 std::optional<LIB_STATUS>
LoadOne(
const wxString& aNickname );
68 std::optional<LIB_STATUS>
GetLibraryStatus(
const wxString& aNickname )
const;
78 std::vector<SUB_LIBRARY>
GetSubLibraries(
const wxString& aNickname )
const;
90 std::vector<LIB_SYMBOL*>
GetSymbols(
const wxString& aNickname,
137 bool aOverwrite =
true );
146 void DeleteSymbol(
const wxString& aNickname,
const wxString& aSymbolName );
159 std::optional<LIBRARY_ERROR>
LibraryError(
const wxString& aNickname )
const;
164 static std::optional<SCH_IO_MGR::SCH_FILE_T>
ParseLibType(
const wxString& aType );
168 bool IsWritable(
const wxString& aNickname )
const override;
LIBRARY_MANAGER_ADAPTER(LIBRARY_MANAGER &aManager)
Constructs a type-specific adapter into the library manager.
A logical library item identifier and consists of various portions much like a URI.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Define a library symbol object.
Container for project specific data.
Base class that schematic file and library loading and saving plugins should derive from.
bool SupportsConfigurationDialog(const wxString &aNickname) const override
LIB_SYMBOL * LoadSymbol(const wxString &aNickname, const wxString &aName)
Load a LIB_SYMBOL having aName from the library given by aNickname.
LIB_SYMBOL * LoadSymbol(const LIB_ID &aLibId)
void DeleteSymbol(const wxString &aNickname, const wxString &aSymbolName)
Deletes the aSymbolName from the library given by aNickname.
bool CreateLibrary(const wxString &aNickname)
Creates the library (i.e. saves to disk) for the given row if it exists.
std::vector< wxString > GetSymbolNames(const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS)
bool SupportsSubLibraries(const wxString &aNickname) const
bool IsWritable(const wxString &aNickname) const override
Return true if the given nickname exists and is not a read-only library.
std::optional< LIB_STATUS > LoadOne(const wxString &aNickname)
Loads or reloads the given library, if it exists.
SAVE_T SaveSymbol(const wxString &aNickname, const LIB_SYMBOL *aSymbol, bool aOverwrite=true)
Write aSymbol to an existing library given by aNickname.
LIBRARY_RESULT< IO_BASE * > createPlugin(const LIBRARY_TABLE_ROW *row) override
Creates a concrete plugin for the given row.
std::vector< SUB_LIBRARY > GetSubLibraries(const wxString &aNickname) const
static SCH_IO * plugin(const LIB_DATA *aRow)
Helper to cast the ABC plugin in the LIB_DATA* to a concrete plugin.
SYMBOL_LIBRARY_ADAPTER(LIBRARY_MANAGER &aManager)
static wxString GlobalPathEnvVariableName()
int GetModifyHash() const
static const char * PropPowerSymsOnly
std::vector< std::pair< wxString, LIB_STATUS > > GetLibraryStatuses() const
Returns a list of all library nicknames and their status (even if they failed to load)
LIBRARY_TABLE_TYPE Type() const override
The type of library table this adapter works with.
static std::map< wxString, LIB_DATA > GlobalLibraries
static std::optional< SCH_IO_MGR::SCH_FILE_T > ParseLibType(const wxString &aType)
std::map< wxString, LIB_DATA > & globalLibs() const override
std::vector< LIB_SYMBOL * > GetSymbols(const wxString &aNickname, SYMBOL_TYPE aType=SYMBOL_TYPE::ALL_SYMBOLS)
std::map< wxString, LIB_DATA > & globalLibs() override
void AsyncLoad() override
Loads all available libraries for this adapter type in the background.
std::mutex & globalLibsMutex() override
std::vector< wxString > GetAvailableExtraFields(const wxString &aNickname)
Returns a list of additional (non-mandatory) symbol fields present in the given library.
void ShowConfigurationDialog(const wxString &aNickname, wxWindow *aParent) const override
SAVE_T
The set of return values from SaveSymbol() below.
static const char * PropNonPowerSymsOnly
std::optional< LIBRARY_ERROR > LibraryError(const wxString &aNickname) const
std::optional< LIB_STATUS > GetLibraryStatus(const wxString &aNickname) const
Returns the status of a loaded library, or nullopt if the library hasn't been loaded (yet)
bool IsSymbolLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
static std::mutex GlobalLibraryMutex
tl::expected< ResultType, LIBRARY_ERROR > LIBRARY_RESULT
Storage for an actual loaded library (including library content owned by the plugin)
A descriptor for a sub-library (supported by database and http libraries)