KFileMetaData::ExtractorPlugin Class

class KFileMetaData::ExtractorPlugin

The ExtractorPlugin is the base class for all file metadata extractors. More...

Header: #include <KFileMetaData/ExtractorPlugin>
CMake: find_package(KF6 REQUIRED COMPONENTS FileMetaData)
target_link_libraries(mytarget PRIVATE KF6::FileMetaData)
Inherits: QObject

Public Functions

ExtractorPlugin(QObject *parent)
virtual void extract(KFileMetaData::ExtractionResult *result) = 0
virtual QStringList mimetypes() const = 0

Static Public Members

QStringList contactsFromString(const QString &string)
QDateTime dateTimeFromString(const QString &dateString)

Protected Functions

(since 5.57) QString getSupportedMimeType(const QString &mimetype) const

Detailed Description

It is responsible for extracting the metadata in a file.

Plugins should derive from this class and implement the MIME types and extract method.

All Plugins should be synchronous and blocking.

Member Function Documentation

[explicit] ExtractorPlugin::ExtractorPlugin(QObject *parent)

[static] QStringList ExtractorPlugin::contactsFromString(const QString &string)

Tries to split the string into names. It cleans up any superfluous words and removes extra junk such as curly braces

[static] QDateTime ExtractorPlugin::dateTimeFromString(const QString &dateString)

Tries to extract a valid date time from the string provided.

[pure virtual] void ExtractorPlugin::extract(KFileMetaData::ExtractionResult *result)

The main function of the plugin that is responsible for extracting the data and filling up the ExtractionResult

The result provides the input URL and MIME type which can be used to identify the file.

This function is synchronous and should be reentrant as it can be called by multiple threads.

[protected, since 5.57] QString ExtractorPlugin::getSupportedMimeType(const QString &mimetype) const

Return the inherited MIME type which the extractor directly supports.

The returned type is one of the types from mimetypes(), and is one of the ancestors of the input mimetype (including mimetype itself).

In case the MIME type is not a subtype of the supported types, an empty QString() is returned.

This function was introduced in 5.57.

See also ExtractorCollection::fetchExtractors and QMimeType::allAncestors.

[pure virtual] QStringList ExtractorPlugin::mimetypes() const

Provide a list of MIME types which are supported by this plugin. Only files with those MIME types will be provided to the plugin via the extract function.

This can also contains partial MIME types like "text/", in that case this plugin will be chosen only if a better plugin does not exist.

Returns a QStringList containing the MIME types.

See also extract.