OpenCPN Partial API docs
Loading...
Searching...
No Matches
PluginHandler Class Reference

Public Member Functions

bool isPluginWritable (std::string name)
 Check if given plugin can be installed/updated.
 
const std::vector< PluginMetadatagetInstalled ()
 Return list of all installed and loaded plugins.
 
std::vector< std::string > GetInstalldataPlugins ()
 Return list of installed plugins lower case names, not necessarily loaded.
 
void SetInstalledMetadata (const PluginMetadata &pm)
 Set metadata for an installed plugin.
 
const std::vector< PluginMetadatagetAvailable ()
 Update catalog and return list of available, not installed plugins.
 
std::vector< PluginMetadatagetCompatiblePlugins ()
 Return list of available, unique and compatible plugins from configured XML catalog.
 
const std::map< std::string, int > getCountByTarget ()
 Map of available plugin targets -> number of occurences.
 
std::string getPluginByLibrary (const std::string &filename)
 Return plugin containing given filename or "" if not found.
 
std::string getMetadataPath ()
 Return path to metadata XML file.
 
void setMetadata (std::string path)
 Set path to metadata XML file.
 
bool installPlugin (PluginMetadata plugin)
 Download and install a new, not installed plugin.
 
bool installPlugin (PluginMetadata plugin, std::string path)
 Install a new, downloaded but not installed plugin tarball.
 
bool ExtractMetadata (const std::string &path, PluginMetadata &metadata)
 Extract metadata in given tarball path.
 
bool installPlugin (const std::string &path)
 
bool uninstall (const std::string plugin)
 Uninstall an installed and loaded plugin.
 
bool ClearInstallData (const std::string plugin_name)
 Remove installation data for not loaded plugin.
 
bool installPluginFromCache (PluginMetadata plugin)
 Install plugin tarball from local cache.
 
std::string getLastErrorMsg ()
 
CatalogDataGetCatalogData ()
 

Static Public Member Functions

static PluginHandlergetInstance ()
 
static void cleanup (const std::string &filelist, const std::string &plugname)
 Cleanup failed installation attempt using filelist for plugin.
 
static void cleanupFiles (const std::string &manifestFile, const std::string &plugname)
 
static std::string pluginsInstallDataPath ()
 Return base directory for installation data.
 
static std::string fileListPath (std::string name)
 Return path to installation manifest for given plugin.
 
static std::string versionPath (std::string name)
 Return path to file containing version for given plugin.
 
static std::string ImportedMetadataPath (std::string name)
 Return path to imported metadata for given plugin.
 
static std::vector< std::string > GetImportPaths ()
 List of paths for imported plugins metadata.
 
static bool isCompatible (const PluginMetadata &metadata, const char *os=PKG_TARGET, const char *os_version=PKG_TARGET_VERSION)
 Return true if given plugin is loadable on given os/version.
 

Public Attributes

EventVar evt_download_ok
 
EventVar evt_download_failed
 

Detailed Description

Definition at line 88 of file plugin_handler.h.

Constructor & Destructor Documentation

◆ PluginHandler()

PluginHandler::PluginHandler ( )
protected

Definition at line 373 of file plugin_handler.cpp.

Member Function Documentation

◆ cleanup()

void PluginHandler::cleanup ( const std::string &  filelist,
const std::string &  plugname 
)
static

Cleanup failed installation attempt using filelist for plugin.

Definition at line 1061 of file plugin_handler.cpp.

◆ cleanupFiles()

void PluginHandler::cleanupFiles ( const std::string &  manifestFile,
const std::string &  plugname 
)
static

Definition at line 1032 of file plugin_handler.cpp.

◆ ClearInstallData()

bool PluginHandler::ClearInstallData ( const std::string  plugin_name)

Remove installation data for not loaded plugin.

Definition at line 1251 of file plugin_handler.cpp.

◆ ExtractMetadata()

bool PluginHandler::ExtractMetadata ( const std::string &  path,
PluginMetadata metadata 
)

Extract metadata in given tarball path.

Definition at line 1216 of file plugin_handler.cpp.

◆ fileListPath()

std::string PluginHandler::fileListPath ( std::string  name)
static

Return path to installation manifest for given plugin.

Definition at line 428 of file plugin_handler.cpp.

◆ getAvailable()

const std::vector< PluginMetadata > PluginHandler::getAvailable ( )

Update catalog and return list of available, not installed plugins.

Definition at line 1111 of file plugin_handler.cpp.

◆ GetCatalogData()

CatalogData * PluginHandler::GetCatalogData ( )
inline

Definition at line 179 of file plugin_handler.h.

◆ getCompatiblePlugins()

std::vector< PluginMetadata > PluginHandler::getCompatiblePlugins ( )

Return list of available, unique and compatible plugins from configured XML catalog.

Compare two PluginMetadata objects, a named c++ requirement.

Definition at line 1088 of file plugin_handler.cpp.

◆ getCountByTarget()

const std::map< std::string, int > PluginHandler::getCountByTarget ( )

Map of available plugin targets -> number of occurences.

Definition at line 1009 of file plugin_handler.cpp.

◆ GetImportPaths()

std::vector< std::string > PluginHandler::GetImportPaths ( )
static

List of paths for imported plugins metadata.

Definition at line 1028 of file plugin_handler.cpp.

◆ GetInstalldataPlugins()

std::vector< std::string > PluginHandler::GetInstalldataPlugins ( )

Return list of installed plugins lower case names, not necessarily loaded.

Definition at line 1128 of file plugin_handler.cpp.

◆ getInstalled()

const std::vector< PluginMetadata > PluginHandler::getInstalled ( )

Return list of all installed and loaded plugins.

Definition at line 1139 of file plugin_handler.cpp.

◆ getInstance()

PluginHandler * PluginHandler::getInstance ( )
static

Definition at line 911 of file plugin_handler.cpp.

◆ getLastErrorMsg()

std::string PluginHandler::getLastErrorMsg ( )
inline

Definition at line 177 of file plugin_handler.h.

◆ getMetadataPath()

std::string PluginHandler::getMetadataPath ( )

Return path to metadata XML file.

Definition at line 1000 of file plugin_handler.cpp.

◆ getPluginByLibrary()

std::string PluginHandler::getPluginByLibrary ( const std::string &  filename)

Return plugin containing given filename or "" if not found.

Definition at line 1432 of file plugin_handler.cpp.

◆ ImportedMetadataPath()

std::string PluginHandler::ImportedMetadataPath ( std::string  name)
static

Return path to imported metadata for given plugin.

Definition at line 438 of file plugin_handler.cpp.

◆ installPlugin() [1/3]

bool PluginHandler::installPlugin ( const std::string &  path)

Definition at line 1207 of file plugin_handler.cpp.

◆ installPlugin() [2/3]

bool PluginHandler::installPlugin ( PluginMetadata  plugin)

Download and install a new, not installed plugin.

Definition at line 1191 of file plugin_handler.cpp.

◆ installPlugin() [3/3]

bool PluginHandler::installPlugin ( PluginMetadata  plugin,
std::string  path 
)

Install a new, downloaded but not installed plugin tarball.

Definition at line 1174 of file plugin_handler.cpp.

◆ installPluginFromCache()

bool PluginHandler::installPluginFromCache ( PluginMetadata  plugin)

Install plugin tarball from local cache.

Definition at line 1442 of file plugin_handler.cpp.

◆ isCompatible()

bool PluginHandler::isCompatible ( const PluginMetadata metadata,
const char *  os = PKG_TARGET,
const char *  os_version = PKG_TARGET_VERSION 
)
static

Return true if given plugin is loadable on given os/version.

Definition at line 375 of file plugin_handler.cpp.

◆ isPluginWritable()

bool PluginHandler::isPluginWritable ( std::string  name)

Check if given plugin can be installed/updated.

Definition at line 919 of file plugin_handler.cpp.

◆ pluginsInstallDataPath()

std::string PluginHandler::pluginsInstallDataPath ( )
static

Return base directory for installation data.

Definition at line 186 of file plugin_handler.cpp.

◆ SetInstalledMetadata()

void PluginHandler::SetInstalledMetadata ( const PluginMetadata pm)

Set metadata for an installed plugin.

Definition at line 1165 of file plugin_handler.cpp.

◆ setMetadata()

void PluginHandler::setMetadata ( std::string  path)
inline

Set path to metadata XML file.

Definition at line 154 of file plugin_handler.h.

◆ uninstall()

bool PluginHandler::uninstall ( const std::string  plugin)

Uninstall an installed and loaded plugin.

Definition at line 1289 of file plugin_handler.cpp.

◆ versionPath()

std::string PluginHandler::versionPath ( std::string  name)
static

Return path to file containing version for given plugin.

Definition at line 433 of file plugin_handler.cpp.

Member Data Documentation

◆ evt_download_failed

EventVar PluginHandler::evt_download_failed

Definition at line 91 of file plugin_handler.h.

◆ evt_download_ok

EventVar PluginHandler::evt_download_ok

Definition at line 90 of file plugin_handler.h.


The documentation for this class was generated from the following files: