KFileMetaData::ExtractionResult Class
class KFileMetaData::ExtractionResultThe ExtractionResult class is where all the data extracted by the indexer is saved. More...
Header: | #include <KFileMetaData/ExtractionResult> |
CMake: | find_package(KF6 REQUIRED COMPONENTS FileMetaData) target_link_libraries(mytarget PRIVATE KF6::FileMetaData) |
Inherited By: |
Public Types
Public Functions
ExtractionResult(const QString &url, const QString &mimetype = QString(), const KFileMetaData::ExtractionResult::Flags &flags = Flags{ExtractPlainText | ExtractMetaData}) | |
virtual void | add(KFileMetaData::Property::Property property, const QVariant &value) = 0 |
(since 5.76) void | addImageData(QMap<KFileMetaData::EmbeddedImageData::ImageType, QByteArray> &&images) |
virtual void | addType(KFileMetaData::Type::Type type) = 0 |
virtual void | append(const QString &text) = 0 |
(since 5.76) QMap<KFileMetaData::EmbeddedImageData::ImageType, QByteArray> | imageData() const |
KFileMetaData::ExtractionResult::Flags | inputFlags() const |
QString | inputMimetype() const |
QString | inputUrl() const |
Detailed Description
This class acts as a base class which should be derived from and then passed to the relevant plugins.
The derived class needs to implement 3 pure virtual functions through which it receives the extracted data.
Member Type Documentation
enum ExtractionResult::Flag
flags ExtractionResult::Flags
Constant | Value |
---|---|
KFileMetaData::ExtractionResult::ExtractNothing | 0 |
KFileMetaData::ExtractionResult::ExtractMetaData | 1 |
KFileMetaData::ExtractionResult::ExtractPlainText | 2 |
KFileMetaData::ExtractionResult::ExtractImageData (since 5.76) | 4 |
The Flags type is a typedef for QFlags<Flag>. It stores an OR combination of Flag values.
Member Function Documentation
ExtractionResult::ExtractionResult(const QString &url, const QString &mimetype = QString(), const KFileMetaData::ExtractionResult::Flags &flags = Flags{ExtractPlainText | ExtractMetaData})
Create an ExtractionResult which can be passed be to Extractors. The extractors use the url, mimetype and flags in order to determine which file the data should be extracted from and which data should be extracted.
[pure virtual]
void ExtractionResult::add(KFileMetaData::Property::Property property, const QVariant &value)
This function is called by the plugins when they wish to add a key value pair which should be indexed. This function may be called multiple times for the same key.
property This specifies a property name. It should be one of the properties from the global list of properties.
value The value of the property
[since 5.76]
void ExtractionResult::addImageData(QMap<KFileMetaData::EmbeddedImageData::ImageType, QByteArray> &&images)
This function is called by the plugins.
images The images to add
This function was introduced in 5.76.
See also EmbeddedImageData.
[pure virtual]
void ExtractionResult::addType(KFileMetaData::Type::Type type)
This function is called by the plugins.
A type is a higher level classification of the file. A file can have multiple types, but mostly when it does, those types are related. Eg - Document and Presentation.
Please choose one type from the list of available types
[pure virtual]
void ExtractionResult::append(const QString &text)
This function is called by plugins when they wish for some plain text to be indexed without any property. This generally corresponds to the text content in a file
[since 5.76]
QMap<KFileMetaData::EmbeddedImageData::ImageType, QByteArray> ExtractionResult::imageData() const
Return embedded image data
This function was introduced in 5.76.
KFileMetaData::ExtractionResult::Flags ExtractionResult::inputFlags() const
The flags which the extraction plugin should considering following when extracting metadata from the file
QString ExtractionResult::inputMimetype() const
The input MIME type. This MIME type should correspond with the MIME types supported with the relevant plugin when it is being passed to the Extractor, or be a subtype thereof.
See also ExtractorCollection::fetchExtractors and ExtractorPlugin::supportedMimeType.
QString ExtractionResult::inputUrl() const
The input URL which the plugins will use to locate the file