KFileMetaData

simpleextractionresult.h
1 /*
2  SPDX-FileCopyrightText: 2014 Vishesh Handa <[email protected]>
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 <QVector>
12 #include <QString>
13 
14 #include <memory>
15 
16 namespace KFileMetaData {
17 enum PropertiesMapType { MultiMap };
18 
19 class SimpleExtractionResultPrivate;
20 
21 /**
22  * \class SimpleExtractionResult simpleextractionresult.h <KFileMetaData/SimpleExtractionResult>
23  *
24  * A simple ExtractionResult implementation which stores
25  * all the data in memory.
26  *
27  * This should ideally not be used in production applications as
28  * it holds all of the plain text in memory, and that can get quite large
29  * when extracting certain documents.
30  */
31 class KFILEMETADATA_EXPORT SimpleExtractionResult : public ExtractionResult
32 {
33 public:
34  SimpleExtractionResult(const QString& url, const QString& mimetype = QString(), const Flags& flags = Flags{ExtractPlainText | ExtractMetaData});
36  ~SimpleExtractionResult() override;
37 
38  SimpleExtractionResult& operator=(const SimpleExtractionResult& rhs);
39  bool operator==(const SimpleExtractionResult& rhs) const;
40 
41  void add(Property::Property property, const QVariant& value) override;
42  void addType(Type::Type type) override;
43  void append(const QString& text) override;
44 
45 #if KFILEMETADATA_ENABLE_DEPRECATED_SINCE(5, 89)
46  /// @deprecated Since 5.89, use properties(PropertiesMapType) overload instead
47  KFILEMETADATA_DEPRECATED_VERSION(5, 89, "Use properties(PropertiesMapType) overload instead")
48  PropertyMap properties() const;
49 #endif
50 
51  /**
52  * Returns the properties of the extraction result.
53  * Because QMap::insertMulti is deprecated, this overload returns a QMultiMap.
54  * To automaticalls use the overload with the default value, define the KFILEMETADATA_DISABLE_DEPRECATED_BEFORE_AND_AT
55  * in the cmake code to the deprecating version of this method or greater.
56  * For example:
57  * @code
58  * add_definitions(-DKFILEMETADATA_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055900)
59  * @endcode
60  * @since 5.89
61  */
62 #if KFILEMETADATA_ENABLE_DEPRECATED_SINCE(5, 89)
63  PropertyMultiMap properties(PropertiesMapType) const;
64 #else
65  PropertyMultiMap properties(PropertiesMapType = PropertiesMapType::MultiMap) const;
66 #endif
67 
68  QString text() const;
69  QVector<Type::Type> types() const;
70 
71 private:
72  const std::unique_ptr<SimpleExtractionResultPrivate> d;
73 };
74 
75 }
76 
77 #endif // KFILEMETADATA_SimpleExtractionResult_H
The ExtractionResult class is where all the data extracted by the indexer is saved....
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition: properties.h:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu May 26 2022 03:46:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.