KFileMetaData 5.109.0
extractionresult.h
1/*
2 SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef _KFILEMETADATA_EXTRACTIONRESULT_H
8#define _KFILEMETADATA_EXTRACTIONRESULT_H
9
10#include <QString>
11#include <QVariant>
12
13#include <memory>
14
15#include "kfilemetadata_export.h"
16#include "embeddedimagedata.h"
17#include "properties.h"
18#include "types.h"
19
20namespace KFileMetaData {
21class ExtractionResultPrivate;
34class KFILEMETADATA_EXPORT ExtractionResult
35{
36public:
40 enum Flag {
41 ExtractNothing = 0,
42 ExtractMetaData = 1,
43 ExtractPlainText = 2,
44 ExtractImageData = 4,
45#if KFILEMETADATA_ENABLE_DEPRECATED_SINCE(5, 76)
47 ExtractEverything KFILEMETADATA_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 76, "Specify flags explicitly") = (ExtractMetaData | ExtractPlainText)
48#endif
49 };
53 Q_DECLARE_FLAGS(Flags, Flag)
54
55
61 ExtractionResult(const QString& url, const QString& mimetype = QString(), const Flags& flags = Flags{ExtractPlainText | ExtractMetaData});
63 virtual ~ExtractionResult();
64
68 QString inputUrl() const;
69
78 QString inputMimetype() const;
79
85
91 virtual void append(const QString& text) = 0;
92
103 virtual void add(Property::Property property, const QVariant& value) = 0;
104
113 virtual void addType(Type::Type type) = 0;
114
122 void addImageData(QMap<EmbeddedImageData::ImageType, QByteArray>&& images);
123
130 QMap<EmbeddedImageData::ImageType, QByteArray> imageData() const;
131
132private:
133 const std::unique_ptr<ExtractionResultPrivate> d;
134};
135
136Q_DECLARE_OPERATORS_FOR_FLAGS(ExtractionResult::Flags)
137
138}
139
140#endif // _KFILEMETADATA_EXTRACTIONRESULT_H
The ExtractionResult class is where all the data extracted by the indexer is saved.
Definition extractionresult.h:35
virtual void addType(Type::Type type)=0
This function is called by the plugins.
Flags inputFlags() const
The flags which the extraction plugin should considering following when extracting metadata from the ...
virtual void add(Property::Property property, const QVariant &value)=0
This function is called by the plugins when they wish to add a key value pair which should be indexed...
QString inputMimetype() const
The input mimetype.
QMap< EmbeddedImageData::ImageType, QByteArray > imageData() const
Return embedded image data.
void addImageData(QMap< EmbeddedImageData::ImageType, QByteArray > &&images)
This function is called by the plugins.
QString inputUrl() const
The input url which the plugins will use to locate the file.
virtual void append(const QString &text)=0
This function is called by plugins when they wish for some plain text to be indexed without any prope...
Flag
Definition extractionresult.h:40
QFlags< Flag > Flags
Stores a combination of Flag values.
Definition extractionresult.h:53
<KFileMetaData/Properties>
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition properties.h:25