OpenCPN Partial API docs
|
Plugin catalog management: Check for available versions and branches, download as required. More...
#include <catalog_handler.h>
Public Types | |
enum class | ServerStatus { UNKNOWN , OK , OK_MSG , CURL_ERROR , JSON_ERROR , XML_ERROR , OS_ERROR } |
Public Member Functions | |
ServerStatus | LoadChannels (std::ostream *json) |
Download channel json data, possibly return error code. More... | |
ServerStatus | LoadChannels (const std::string &json) |
Parse and store json channel data, possibly return error code. More... | |
std::vector< std::string > | GetChannels () |
Get the downloaded list of channels, empty on errors. More... | |
bool | SetActiveChannel (const char *channel) |
Set the active channel used when downloading catalog. More... | |
std::string | GetActiveChannel () |
Get the branch (a. More... | |
void | SetCustomUrl (const char *url) |
Set a custom url, overrides also channel settings. More... | |
std::string | GetCustomUrl () |
Set a custom url, overrides also channel settings. More... | |
std::string | GetDefaultUrl () |
Get the default URL, with actual channel included. More... | |
ServerStatus | DownloadCatalog (std::ostream *stream) |
Download the latest catalog to given stream. More... | |
ServerStatus | DownloadCatalog (std::string &path) |
Download the latest catalog to local path. More... | |
ServerStatus | DownloadCatalog (std::ostream *stream, std::string url) |
Download the specified catalog to given stream. More... | |
ServerStatus | DownloadCatalog (std::string &filePath, std::string url) |
Download the specified catalog to local path. More... | |
ServerStatus | ParseCatalog (const std::string xml, bool latest=false) |
Parse XML contents, save as latest data if latest is true. More... | |
CatalogData | DefaultCatalogData () |
Data for default version, installed with main opencpn. More... | |
CatalogData | UserCatalogData () |
Data for user catalog which overrides the default one. More... | |
CatalogData | LatestCatalogData () |
Data for latest parsed data marked as latest. More... | |
void | ClearCatalogData () |
Invalidate *CatalogData caches. More... | |
std::string | LastErrorMsg () |
Last error message, free format. More... | |
ServerStatus | DoParseCatalog (const std::string xml, CatalogCtx *ctx) |
Static Public Member Functions | |
static CatalogHandler * | getInstance () |
Protected Member Functions | |
CatalogHandler () | |
Initiate the handler. More... | |
void | LoadCatalogData (const std::string &path, CatalogData &data) |
Protected Attributes | |
const char *const | GET_BRANCHES_PATH = "/repos/OpenCPN/plugins/branches" |
const char *const | GITHUB_API = "https://api.github.com" |
const char *const | REPO_URL = "https://raw.githubusercontent.com" |
const char *const | REPO_PATH = "/OpenCPN/plugins/@branch@/ocpn-plugins.xml" |
const char *const | DEFAULT_CHANNEL = "master" |
Plugin catalog management: Check for available versions and branches, download as required.
A local proxy for the catalog server. The server has a number of branches, some of which containing a plugin catalog.
Backend code for channel management (which catalog to get) and the important download function.
Also: CatalogData handling, basically version and date for various ocpn-plugins.xml.
Definition at line 50 of file catalog_handler.h.
|
strong |
Definition at line 52 of file catalog_handler.h.
|
protected |
Initiate the handler.
Definition at line 62 of file catalog_handler.cpp.
void CatalogHandler::ClearCatalogData | ( | ) |
Invalidate *CatalogData caches.
Definition at line 270 of file catalog_handler.cpp.
CatalogData CatalogHandler::DefaultCatalogData | ( | ) |
Data for default version, installed with main opencpn.
Definition at line 259 of file catalog_handler.cpp.
catalog_status CatalogHandler::DoParseCatalog | ( | const std::string | xml, |
CatalogCtx * | ctx | ||
) |
Definition at line 142 of file catalog_handler.cpp.
catalog_status CatalogHandler::DownloadCatalog | ( | std::ostream * | stream | ) |
Download the latest catalog to given stream.
Definition at line 82 of file catalog_handler.cpp.
catalog_status CatalogHandler::DownloadCatalog | ( | std::ostream * | stream, |
std::string | url | ||
) |
Download the specified catalog to given stream.
Definition at line 98 of file catalog_handler.cpp.
catalog_status CatalogHandler::DownloadCatalog | ( | std::string & | filePath, |
std::string | url | ||
) |
Download the specified catalog to local path.
Definition at line 125 of file catalog_handler.cpp.
catalog_status CatalogHandler::DownloadCatalog | ( | std::string & | path | ) |
Download the latest catalog to local path.
Definition at line 109 of file catalog_handler.cpp.
std::string CatalogHandler::GetActiveChannel | ( | ) |
Get the branch (a.
k. a. channel) used to download.
Definition at line 206 of file catalog_handler.cpp.
std::vector< std::string > CatalogHandler::GetChannels | ( | ) |
Get the downloaded list of channels, empty on errors.
Definition at line 192 of file catalog_handler.cpp.
std::string CatalogHandler::GetCustomUrl | ( | ) |
Set a custom url, overrides also channel settings.
Definition at line 276 of file catalog_handler.cpp.
std::string CatalogHandler::GetDefaultUrl | ( | ) |
Get the default URL, with actual channel included.
Definition at line 76 of file catalog_handler.cpp.
|
static |
Definition at line 68 of file catalog_handler.cpp.
std::string CatalogHandler::LastErrorMsg | ( | ) |
Last error message, free format.
Definition at line 280 of file catalog_handler.cpp.
CatalogData CatalogHandler::LatestCatalogData | ( | ) |
Data for latest parsed data marked as latest.
Definition at line 214 of file catalog_handler.cpp.
|
protected |
Definition at line 224 of file catalog_handler.cpp.
catalog_status CatalogHandler::LoadChannels | ( | const std::string & | json | ) |
Parse and store json channel data, possibly return error code.
Definition at line 292 of file catalog_handler.cpp.
catalog_status CatalogHandler::LoadChannels | ( | std::ostream * | json | ) |
Download channel json data, possibly return error code.
Definition at line 282 of file catalog_handler.cpp.
catalog_status CatalogHandler::ParseCatalog | ( | const std::string | xml, |
bool | latest = false |
||
) |
Parse XML contents, save as latest data if latest is true.
Definition at line 180 of file catalog_handler.cpp.
bool CatalogHandler::SetActiveChannel | ( | const char * | channel | ) |
Set the active channel used when downloading catalog.
Definition at line 194 of file catalog_handler.cpp.
void CatalogHandler::SetCustomUrl | ( | const char * | url | ) |
Set a custom url, overrides also channel settings.
Definition at line 210 of file catalog_handler.cpp.
CatalogData CatalogHandler::UserCatalogData | ( | ) |
Data for user catalog which overrides the default one.
Definition at line 248 of file catalog_handler.cpp.
|
protected |
Definition at line 132 of file catalog_handler.h.
|
protected |
Definition at line 126 of file catalog_handler.h.
|
protected |
Definition at line 127 of file catalog_handler.h.
|
protected |
Definition at line 130 of file catalog_handler.h.
|
protected |
Definition at line 129 of file catalog_handler.h.