26#ifndef CATALOG_HANDLER_H__
27#define CATALOG_HANDLER_H__
54 enum class ServerStatus {
104 ServerStatus
ParseCatalog(
const std::string xml,
bool latest =
false);
140 void LoadCatalogData(
const std::string& path,
CatalogData& data);
142 const char*
const GET_BRANCHES_PATH =
"/repos/OpenCPN/plugins/branches";
143 const char*
const GITHUB_API =
"https://api.github.com";
145 const char*
const REPO_URL =
"https://raw.githubusercontent.com";
146 const char*
const REPO_PATH =
"/OpenCPN/plugins/@branch@/ocpn-plugins.xml";
148 const char*
const DEFAULT_CHANNEL =
"master";
151 std::vector<std::string> channels;
153 std::ostream* stream;
154 std::string error_msg;
158 ServerStatus m_catalog_status;
162typedef CatalogHandler::ServerStatus catalog_status;
Datatypes and methods to parse ocpn-plugins.xml XML data, either complete catalog or a single plugin.
Local proxy for the catalog server and other catalog sources.
std::vector< std::string > GetChannels()
Get the downloaded list of channels, empty on errors.
ServerStatus LoadChannels(std::ostream *json)
Download channel json data, possibly return error code.
CatalogHandler()
Initiate the handler.
CatalogData DefaultCatalogData()
Data for default version, installed with main opencpn.
std::string GetDefaultUrl()
Get the default URL, with actual channel included.
CatalogData LatestCatalogData()
Data for latest parsed data marked as latest.
CatalogCtx * GetActiveCatalogContext()
Return a pointer to the currently active plugin catalog context.
std::string LastErrorMsg()
Last error message, free format.
ServerStatus DoParseCatalog(const std::string xml, CatalogCtx *ctx)
Parse the catalog by merging data from imported metadata, meta-urls and the standard url.
CatalogData UserCatalogData()
Data for user catalog which overrides the default one.
bool AddMetadataToActiveContext(PluginMetadata metadata)
Add an abritrary stub metadata netry to the active catalog context.
ServerStatus ParseCatalog(const std::string xml, bool latest=false)
Parse XML contents, save as latest data if latest is true.
std::string GetActiveChannel()
Get the branch (a.
void SetCustomUrl(const char *url)
Set a custom url, overrides also channel settings.
ServerStatus DownloadCatalog(std::ostream *stream)
Download the latest catalog to given stream.
void ClearCatalogData()
Invalidate *CatalogData caches.
std::string GetCustomUrl()
Get the custom url set by SetCustomUrl.
ServerStatus GetCatalogStatus()
Retrieve status of currently active plugin catalog
bool SetActiveChannel(const char *channel)
Set the active channel used when downloading catalog.
The result from parsing the xml catalog i.
Overall metadata for the set of plugins used.