KPackage::PackageLoader

#include <KPackage/PackageLoader>

Public Member Functions

void addKnownPackageStructure (const QString &packageFormat, KPackage::PackageStructure *structure)
 
QList< KPluginMetaDatafindPackages (const QString &packageFormat, const QString &packageRoot=QString(), std::function< bool(const KPluginMetaData &)> filter=std::function< bool(const KPluginMetaData &)>())
 
QList< KPluginMetaDatalistPackages (const QString &packageFormat, const QString &packageRoot=QString())
 
Package loadPackage (const QString &packageFormat, const QString &packagePath=QString())
 
KPackage::PackageStructureloadPackageStructure (const QString &packageFormat)
 

Static Public Member Functions

static PackageLoaderself ()
 
static void setPackageLoader (PackageLoader *loader)
 

Protected Member Functions

virtual Package internalLoadPackage (const QString &packageFormat)
 

Detailed Description

This is an abstract base class which defines an interface to which the package loading logic can communicate with a parent application.

The plugin loader must be set before any plugins are loaded, otherwise (for safety reasons), the default PackageLoader implementation will be used. The reimplemented version should not do more than simply returning a loaded plugin. It should not init() it, and it should not hang on to it.

Author
Ryan Rix [email protected][email protected]rix.[email protected]si

Definition at line 31 of file packageloader.h.

Member Function Documentation

void KPackage::PackageLoader::addKnownPackageStructure ( const QString packageFormat,
KPackage::PackageStructure structure 
)

Adds a new known package structure that can be used by the functions to load packages such as loadPackage, findPackages etc.

Parameters
packageFormatthe package format, such as "KPackage/GenericQML"
structurethe package structure we want to be able to load packages from
Since
5.10

Definition at line 373 of file packageloader.cpp.

QList< KPluginMetaData > KPackage::PackageLoader::findPackages ( const QString packageFormat,
const QString packageRoot = QString(),
std::function< bool(const KPluginMetaData &)>  filter = std::function<bool(const KPluginMetaData &)>() 
)

List package of a certain type that match a certain filter function.

Parameters
packageFormatthe format of the packages to list
packageRootthe root folder where the packages are installed. If not specified the default from the packageformat will be taken.
filtera filter function that will be called on each package: will return true for the matching ones
Returns
metadata for all the matching packages
Since
5.10

Definition at line 274 of file packageloader.cpp.

Package KPackage::PackageLoader::internalLoadPackage ( const QString packageFormat)
protectedvirtual

A re-implementable method that allows subclasses to override the default behaviour of loadPackage.

If the service requested is not recognized, then the implementation should return an empty and invalid Package(). This method is called by loadPackage prior to attempting to load a Package using the standard plugin mechanisms.

Parameters
packageFormatthe format of the package to load
Returns
a Package instance with the proper PackageStructure

Definition at line 378 of file packageloader.cpp.

QList< KPluginMetaData > KPackage::PackageLoader::listPackages ( const QString packageFormat,
const QString packageRoot = QString() 
)

List all available packages of a certain type.

Parameters
packageFormatthe format of the packages to list
packageRootthe root folder where the packages are installed. If not specified the default from the packageformat will be taken.
Returns
metadata for all the matching packages

Definition at line 151 of file packageloader.cpp.

Package KPackage::PackageLoader::loadPackage ( const QString packageFormat,
const QString packagePath = QString() 
)

Load a Package plugin.

Parameters
packageFormatthe format of the package to load
packagePaththe package name: the path of the package relative to the packageFormat root path. If not specified it will have to be set manually with Package::setPath() by the caller.
Returns
a Package object matching name, or an invalid package on failure

Definition at line 118 of file packageloader.cpp.

KPackage::PackageStructure * KPackage::PackageLoader::loadPackageStructure ( const QString packageFormat)

Loads a PackageStructure for a given format.

The structure can then be used as paramenter for a Package instance constructor

Parameters
packageFormatthe package format, such as "KPackage/GenericQML"
Returns
the structure instance

Definition at line 286 of file packageloader.cpp.

PackageLoader * KPackage::PackageLoader::self ( )
static

Return the active plugin loader.

Definition at line 105 of file packageloader.cpp.

void KPackage::PackageLoader::setPackageLoader ( PackageLoader loader)
static

Set the plugin loader which will be queried for all loads.

Parameters
loaderA subclass of PackageLoader which will be supplied by the application

Definition at line 94 of file packageloader.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Sep 21 2020 22:51:59 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.