30#ifndef CATALOG_HANDLER_H__
31#define CATALOG_HANDLER_H__
38#include "catalog_parser.h"
52 enum class ServerStatus {
101 ServerStatus
ParseCatalog(
const std::string xml,
bool latest =
false);
118 ServerStatus DoParseCatalog(
const std::string xml,
CatalogCtx* ctx);
124 void LoadCatalogData(
const std::string& path,
CatalogData& data);
126 const char*
const GET_BRANCHES_PATH =
"/repos/OpenCPN/plugins/branches";
127 const char*
const GITHUB_API =
"https://api.github.com";
129 const char*
const REPO_URL =
"https://raw.githubusercontent.com";
130 const char*
const REPO_PATH =
"/OpenCPN/plugins/@branch@/ocpn-plugins.xml";
132 const char*
const DEFAULT_CHANNEL =
"master";
135 std::vector<std::string> channels;
137 std::ostream* stream;
138 std::string error_msg;
144typedef CatalogHandler::ServerStatus catalog_status;
Plugin catalog management: Check for available versions and branches, download as required.
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.
std::string LastErrorMsg()
Last error message, free format.
CatalogData UserCatalogData()
Data for user catalog which overrides the default one.
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()
Set a custom url, overrides also channel settings.
bool SetActiveChannel(const char *channel)
Set the active channel used when downloading catalog.
The result from parsing the xml catalog i.
Datatypes and a single method to parse ocpn-plugins.xml XML data.