KFileMetaData 5.109.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KFileMetaData::ExtractorPluginabstract

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

#include <KFileMetaData/ExtractorPlugin>

Public Member Functions

 ExtractorPlugin (QObject *parent)
 
virtual void extract (ExtractionResult *result)=0
 The main function of the plugin that is responsible for extracting the data and filling up the ExtractionResult.
 
virtual QStringList mimetypes () const =0
 Provide a list of mimetypes which are supported by this plugin.
 

Static Public Member Functions

static QStringList contactsFromString (const QString &string)
 Tries to split the string into names.
 
static QDateTime dateTimeFromString (const QString &dateString)
 Tries to extract a valid date time from the string provided.
 

Protected Member Functions

QString getSupportedMimeType (const QString &mimetype) const
 Return the inherited mimetype which the extractor directly supports.
 

Detailed Description

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

It is responsible for extracting the metadata in a file.

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

All Plugins should be synchronous and blocking.

Author
Vishesh Handa me@vh.nosp@m.anda.nosp@m..in

Member Function Documentation

◆ contactsFromString()

static QStringList KFileMetaData::ExtractorPlugin::contactsFromString ( const QString &  string)
static

Tries to split the string into names.

It cleans up any superfluous words and removes extra junk such as curly braces

◆ dateTimeFromString()

static QDateTime KFileMetaData::ExtractorPlugin::dateTimeFromString ( const QString &  dateString)
static

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

◆ extract()

virtual void KFileMetaData::ExtractorPlugin::extract ( ExtractionResult result)
pure virtual

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 mimetype which can be used to identify the file.

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

◆ getSupportedMimeType()

QString KFileMetaData::ExtractorPlugin::getSupportedMimeType ( const QString &  mimetype) const
protected

Return the inherited mimetype 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 mimetype is not a subtype of the supported types, an empty QString() is returned.

See also
ExtractorCollection::fetchExtractors
QMimeType::allAncestors
Since
5.57

◆ mimetypes()

virtual QStringList KFileMetaData::ExtractorPlugin::mimetypes ( ) const
pure virtual

Provide a list of mimetypes which are supported by this plugin.

Only files with those mimetypes will be provided to the plugin via the extract function.

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

Returns
A StringList containing the mimetypes.
See also
extract