KPackage::PackageLoader

Search for usage in LXR

KPackage::PackageLoader Class Reference

#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< PackagelistKPackages (const QString &packageFormat, const QString &packageRoot=QString())
 
QList< KPluginMetaDatalistPackages (const QString &packageFormat, const QString &packageRoot=QString())
 
QList< KPluginMetaDatalistPackagesMetadata (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 ()
 

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 ry@n..nosp@m.rix..nosp@m.si

Definition at line 30 of file packageloader.h.

Constructor & Destructor Documentation

◆ PackageLoader()

KPackage::PackageLoader::PackageLoader ( )
protected

Definition at line 32 of file packageloader.cpp.

◆ ~PackageLoader()

KPackage::PackageLoader::~PackageLoader ( )
protectedvirtual

Definition at line 37 of file packageloader.cpp.

Member Function Documentation

◆ addKnownPackageStructure()

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 281 of file packageloader.cpp.

◆ findPackages()

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 233 of file packageloader.cpp.

◆ listKPackages()

QList< Package > KPackage::PackageLoader::listKPackages ( const QString & packageFormat,
const QString & packageRoot = QString() )

List all available packages of a certain type.

This should be used in case the package structure modifies the metadata or you need to access the contained files of the package.

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.
Since
6.0

Definition at line 68 of file packageloader.cpp.

◆ listPackages()

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 132 of file packageloader.cpp.

◆ listPackagesMetadata()

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
6.0

Definition at line 227 of file packageloader.cpp.

◆ loadPackage()

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 51 of file packageloader.cpp.

◆ loadPackageStructure()

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

Note
The returned pointer is managed by KPackage, and should never be deleted
Parameters
packageFormatthe package format, such as "KPackage/GenericQML"
Returns
the structure instance (ownership retained by KPackage)

Definition at line 245 of file packageloader.cpp.

◆ self()

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

Return the active plugin loader.

Definition at line 45 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-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:54:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.