KFileMetaData

simpleextractionresult.cpp
1 /*
2  SPDX-FileCopyrightText: 2014 Vishesh Handa <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #include "simpleextractionresult.h"
8 
9 using namespace KFileMetaData;
10 
11 class KFileMetaData::SimpleExtractionResultPrivate
12 {
13 public:
14  PropertyMultiMap m_properties;
15  QString m_text;
16  QVector<Type::Type> m_types;
17 };
18 
19 SimpleExtractionResult::SimpleExtractionResult(const QString& url, const QString& mimetype, const Flags& flags)
20  : ExtractionResult(url, mimetype, flags)
21  , d(new SimpleExtractionResultPrivate)
22 {
23 }
24 
25 SimpleExtractionResult::SimpleExtractionResult(const SimpleExtractionResult& rhs)
26  : ExtractionResult(*this)
27  , d(new SimpleExtractionResultPrivate(*rhs.d))
28 {
29 }
30 
31 SimpleExtractionResult::~SimpleExtractionResult() = default;
32 
33 SimpleExtractionResult& SimpleExtractionResult::operator=(const SimpleExtractionResult& rhs)
34 {
35  *d = *rhs.d;
36  return *this;
37 }
38 
39 bool SimpleExtractionResult::operator==(const SimpleExtractionResult& rhs) const
40 {
41  return d->m_properties == rhs.d->m_properties && d->m_text == rhs.d->m_text
42  && d->m_types == rhs.d->m_types;
43 }
44 
46 {
47  d->m_properties.insert(property, value);
48 }
49 
50 void SimpleExtractionResult::addType(Type::Type type)
51 {
52  d->m_types << type;
53 }
54 
56 {
57  d->m_text.append(text);
58  d->m_text.append(QLatin1Char(' '));
59 }
60 
61 #if KFILEMETADATA_BUILD_DEPRECATED_SINCE(5, 89)
63 {
64  return d->m_properties;
65 }
66 #endif
67 
69 {
70  return d->m_properties;
71 }
72 
73 QString SimpleExtractionResult::text() const
74 {
75  return d->m_text;
76 }
77 
78 QVector<Type::Type> SimpleExtractionResult::types() const
79 {
80  return d->m_types;
81 }
The ExtractionResult class is where all the data extracted by the indexer is saved....
void addType(Type::Type type) override
This function is called by the plugins.
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition: properties.h:25
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...
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...
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri May 27 2022 03:47:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.