29 #include <nlohmann/json-schema.hpp> 31 #include <unordered_map> 32 #include <unordered_set> 119 const nlohmann::json_uri& aUri = nlohmann::json_uri(
"#" ) )
const;
128 bool VerifyHash( std::istream& aStream,
const wxString& aHash )
const;
156 const wxString& aRepositoryId );
258 std::unordered_map<wxString, wxBitmap>
284 bool fetchPackages(
const wxString& aUrl,
const boost::optional<wxString>& aHash,
std::unordered_map< wxString, wxBitmap > GetRepositoryPackageBitmaps(const wxString &aRepositoryId)
Get the icon bitmaps for repository packages.
const wxString & GetInstalledPackageVersion(const wxString &aPackageId) const
Get the current version of an installed package.
PLUGIN_CONTENT_MANAGER(wxWindow *aParent)
std::map< wxString, PCM_INSTALLATION_ENTRY > m_installed
int GetPackageSearchRank(const PCM_PACKAGE &aPackage, const wxString &aSearchTerm)
Get the approximate measure of how much given package matches the search term.
void DiscardRepositoryCache(const wxString &aRepositoryId)
Discard in-memory and on-disk cache of a repository.
void MarkUninstalled(const PCM_PACKAGE &aPackage)
Mark package as uninstalled.
STRING_TUPLE_LIST m_repository_list
bool fetchPackages(const wxString &aUrl, const boost::optional< wxString > &aHash, std::vector< PCM_PACKAGE > &aPackages, WX_PROGRESS_REPORTER *aReporter)
Downloads packages metadata to in memory stream, verifies hash and attempts to parse it.
static const std::tuple< int, int > m_kicad_version
bool FetchRepository(const wxString &aUrl, PCM_REPOSITORY &aRepository, WX_PROGRESS_REPORTER *aReporter)
Fetches repository metadata from given url.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void MarkInstalled(const PCM_PACKAGE &aPackage, const wxString &aVersion, const wxString &aRepositoryId)
Mark package as installed.
bool VerifyHash(std::istream &aStream, const wxString &aHash) const
Verifies SHA256 hash of a binary stream.
static constexpr size_t DEFAULT_DOWNLOAD_MEM_LIMIT
< Default download limit of 10 Mb to not use too much memory
Repository reference to a resource.
const std::vector< PCM_PACKAGE > & GetRepositoryPackages(const wxString &aRepositoryId) const
Get the packages metadata from a previously cached repository.
const PCM_REPOSITORY & getCachedRepository(const wxString &aRepositoryId) const
Get the cached repository metadata.
const bool CacheRepository(const wxString &aRepositoryId)
Cache specified repository packages and other metadata.
std::unordered_map< wxString, wxBitmap > GetInstalledPackageBitmaps()
Get the icon bitmaps for installed packages.
const wxString & Get3rdPartyPath() const
~PLUGIN_CONTENT_MANAGER()
static void preparePackage(PCM_PACKAGE &aPackage)
Parses version strings and calculates compatibility.
std::vector< std::pair< wxString, wxString > > STRING_PAIR_LIST
const std::vector< PCM_INSTALLATION_ENTRY > GetInstalledPackages() const
Get list of installed packages.
const STRING_TUPLE_LIST & GetRepositoryList() const
Get list of repositories.
void ValidateJson(const nlohmann::json &aJson, const nlohmann::json_uri &aUri=nlohmann::json_uri("#")) const
Validates json against a specific definition in the PCM schema.
PCM_PACKAGE_STATE GetPackageState(const wxString &aRepositoryId, const wxString &aPackageId)
Get current state of the package.
nlohmann::json_schema::json_validator m_schema_validator
std::vector< std::tuple< wxString, wxString, wxString > > STRING_TUPLE_LIST
void SetRepositoryList(const STRING_PAIR_LIST &aRepositories)
Set list of repositories.
Main class of Plugin and Content Manager subsystem.
const std::unordered_set< wxString > PCM_PACKAGE_DIRECTORIES({ wxT("plugins"), wxT("footprints"), wxT("3dmodels"), wxT("symbols"), wxT("resources"), wxT("colors"), })
< Contains list of all valid directories that get extracted from a package archive
Package installation entry.
bool DownloadToStream(const wxString &aUrl, std::ostream *aOutput, WX_PROGRESS_REPORTER *aReporter, const size_t aSizeLimit=DEFAULT_DOWNLOAD_MEM_LIMIT)
Downloads url to an output stream.
time_t getCurrentTimestamp() const
std::unordered_map< wxString, PCM_REPOSITORY > m_repository_cache