38#include <condition_variable>
40#include <shared_mutex>
42#include <unordered_set>
67 const std::map<std::string, UTF8>* aProperties =
nullptr )
override;
69 void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
const wxString& aLibraryPath,
70 const std::map<std::string, UTF8>* aProperties =
nullptr )
override;
73 const std::map<std::string, UTF8>* aProperties =
nullptr )
override;
76 const std::map<std::string, UTF8>* aProperties =
nullptr )
override;
112 void SaveSymbol(
const wxString& aLibraryPath, std::unique_ptr<LIB_SYMBOL> aSymbol,
113 const std::map<std::string, UTF8>* aProperties =
nullptr )
override;
126 std::set<wxString>& aCustomFields );
128 void cacheLib(
const wxString& aLibraryPath );
130 size_t computeSignature(
const std::map<std::string, HTTP_LIB_CATEGORY>& aCategoryData )
const;
133 const std::map<std::string, HTTP_LIB_CATEGORY>& aCategoryData );
148 std::unique_ptr<HTTP_LIB_CONNECTION>
m_conn;
166 std::map<wxString, std::pair<std::string, std::string>>
m_partIdMap;
The interface used by the classes that actually can load IO plugins for the different parts of KiCad ...
Define a library symbol object.
void SetConnectionBuilder(CONNECTION_BUILDER aFactory)
std::thread m_refreshThread
LIB_SYMBOL * loadSymbolFromPart(const wxString &aLibraryPath, const wxString &aSymbolName, const HTTP_LIB_CATEGORY &aCategory, const HTTP_LIB_PART &aPart, std::set< wxString > &aCustomFields)
std::unique_ptr< HTTP_LIB_CONNECTION > m_conn
Generally will be null if no valid connection is established.
LIB_SYMBOL * LoadSymbol(const wxString &aLibraryPath, const wxString &aAliasName, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Load a LIB_SYMBOL object having aPartName from the aLibraryPath containing a library format that this...
void SetSourcePatcher(SOURCE_PATCHER aOverride)
Allows updating a source after initial load; used for QA testing.
HTTP_LIB_SETTINGS * Settings() const
std::map< wxString, std::unique_ptr< LIB_SYMBOL > > m_symbolCache
std::unique_ptr< HTTP_LIB_SETTINGS > m_settings
bool IsLibraryWritable(const wxString &aLibraryPath) override
Return true if the library at aLibraryPath is writable.
wxString GetSubLibraryDescription(const wxString &aName) override
Gets a description of a sublibrary.
std::function< std::unique_ptr< HTTP_LIB_CONNECTION >(const HTTP_LIB_SOURCE &)> CONNECTION_BUILDER
SYMBOL_LIBRARY_ADAPTER * m_adapter
void startBackgroundRefresh()
std::function< void(HTTP_LIB_SOURCE &)> SOURCE_PATCHER
bool SupportsSubLibraries() const override
void ensureSettings(const wxString &aSettingsPath)
int GetModifyHash() const override
Return the modification hash from the library cache.
~SCH_IO_HTTP_LIB() override
std::set< wxString > m_customFields
void GetDefaultSymbolFields(std::vector< wxString > &aNames) override
Retrieves a list of (custom) field names that should be shown by default for this library in the symb...
void GetAvailableSymbolFields(std::vector< wxString > &aNames) override
Retrieves a list of (custom) field names that are present on symbols in this library.
std::map< wxString, std::pair< std::string, std::string > > m_partIdMap
Symbol name -> (part id, category id); used for the SelectOne fallback in LoadSymbol.
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
Get the descriptor for the library container that this IO plugin operates on.
std::set< wxString > m_defaultShownFields
void SaveSymbol(const wxString &aLibraryPath, std::unique_ptr< LIB_SYMBOL > aSymbol, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aSymbol to an existing library located at aLibraryPath.
SOURCE_PATCHER m_sourcePatcher
std::unordered_set< wxString > m_inProgressLoads
void backgroundRefreshWorker()
void SetLibraryManagerAdapter(SYMBOL_LIBRARY_ADAPTER *aAdapter) override
Some library plugins need to interface with other loaded libraries.
std::mutex m_refreshMutex
std::mutex m_symbolLoadMutex
Serializes loadSymbolFromPart calls.
CONNECTION_BUILDER m_connectionFactory
Allows replacing actual HTTP connection for QA tests.
wxString description_field
std::atomic< bool > m_refreshRunning
void materializeCache(const wxString &aLibraryPath, const std::map< std::string, HTTP_LIB_CATEGORY > &aCategoryData)
size_t computeSignature(const std::map< std::string, HTTP_LIB_CATEGORY > &aCategoryData) const
void stopBackgroundRefresh()
std::atomic< bool > m_cachePopulated
void CheckLibrary(const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Validate that the library at aLibraryPath is reachable and well-formed, without necessarily loading s...
const wxString & GetError() const override
Return an error string to the caller.
std::condition_variable m_refreshCV
void cacheLib(const wxString &aLibraryPath)
void EnumerateSymbolLib(wxArrayString &aSymbolNameList, const wxString &aLibraryPath, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Populate a list of LIB_SYMBOL alias names contained within the library aLibraryPath.
std::shared_mutex m_cacheMutex
Protects m_symbolCache, m_partIdMap, and m_customFields.
void GetSubLibraryNames(std::vector< wxString > &aNames) override
Retrieves a list of sub-libraries in this library.
SCH_IO(const wxString &aName)
An interface to the global shared library manager that is schematic-specific and linked to one projec...
static const std::string HTTPLibraryFileExtension
Connection parameters for one HTTP library.
Container that describes file type info.
Definition of file extensions used in Kicad.