KFileMetaData

simpleextractionresult.h
1/*
2 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef KFILEMETADATA_SimpleExtractionResult_H
8#define KFILEMETADATA_SimpleExtractionResult_H
9
10#include "extractionresult.h"
11#include <QList>
12#include <QString>
13
14#include <memory>
15
16namespace KFileMetaData {
17
18class SimpleExtractionResultPrivate;
19
20/**
21 * \class SimpleExtractionResult simpleextractionresult.h <KFileMetaData/SimpleExtractionResult>
22 *
23 * A simple ExtractionResult implementation which stores
24 * all the data in memory.
25 *
26 * This should ideally not be used in production applications as
27 * it holds all of the plain text in memory, and that can get quite large
28 * when extracting certain documents.
29 */
30class KFILEMETADATA_EXPORT SimpleExtractionResult : public ExtractionResult
31{
32public:
33 SimpleExtractionResult(const QString& url, const QString& mimetype = QString(), const Flags& flags = Flags{ExtractPlainText | ExtractMetaData});
34 SimpleExtractionResult(const SimpleExtractionResult& rhs);
35 ~SimpleExtractionResult() override;
36
37 SimpleExtractionResult& operator=(const SimpleExtractionResult& rhs);
38 bool operator==(const SimpleExtractionResult& rhs) const;
39
40 void add(Property::Property property, const QVariant& value) override;
41 void addType(Type::Type type) override;
42 void append(const QString& text) override;
43
44 /**
45 * Returns the properties of the extraction result.
46 */
47 PropertyMultiMap properties() const;
48
49 QString text() const;
50 QList<Type::Type> types() const;
51
52private:
53 const std::unique_ptr<SimpleExtractionResultPrivate> d;
54};
55
56}
57
58#endif // KFILEMETADATA_SimpleExtractionResult_H
ExtractionResult(const QString &url, const QString &mimetype=QString(), const Flags &flags=Flags{ExtractPlainText|ExtractMetaData})
Create an ExtractionResult which can be passed be to Extractors.
QFlags< Flag > Flags
Stores a combination of Flag values.
void add(Property::Property property, const QVariant &value) override
This function is called by the plugins when they wish to add a key value pair which should be indexed...
void addType(Type::Type type) override
This function is called by the plugins.
PropertyMultiMap properties() const
Returns the properties of the extraction result.
void append(const QString &text) override
This function is called by plugins when they wish for some plain text to be indexed without any prope...
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition properties.h:26
Type
A Type represents a way to represent a way to group files based on a higher level view,...
Definition types.h:29
The KFileMetaData namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:47:59 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.