KFileMetaData

simpleextractionresult.cpp
1 /*
2  * Copyright (C) 2014 Vishesh Handa <[email protected]>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  */
19 
20 #include "simpleextractionresult.h"
21 
22 using namespace KFileMetaData;
23 
24 class Q_DECL_HIDDEN SimpleExtractionResult::Private
25 {
26 public:
27  PropertyMap m_properties;
28  QString m_text;
29  QVector<Type::Type> m_types;
30 };
31 
32 SimpleExtractionResult::SimpleExtractionResult(const QString& url, const QString& mimetype, const Flags& flags)
33  : ExtractionResult(url, mimetype, flags)
34  , d(new Private)
35 {
36 }
37 
38 SimpleExtractionResult::SimpleExtractionResult(const SimpleExtractionResult& rhs)
39  : ExtractionResult(*this)
40  , d(new Private(*rhs.d))
41 {
42 }
43 
44 SimpleExtractionResult::~SimpleExtractionResult()
45 {
46  delete d;
47 }
48 
49 SimpleExtractionResult& SimpleExtractionResult::operator=(const SimpleExtractionResult& rhs)
50 {
51  *d = *rhs.d;
52  return *this;
53 }
54 
55 bool SimpleExtractionResult::operator==(const SimpleExtractionResult& rhs) const
56 {
57  return d->m_properties == rhs.d->m_properties && d->m_text == rhs.d->m_text
58  && d->m_types == rhs.d->m_types;
59 }
60 
62 {
63  d->m_properties.insertMulti(property, value);
64 }
65 
66 void SimpleExtractionResult::addType(Type::Type type)
67 {
68  d->m_types << type;
69 }
70 
72 {
73  d->m_text.append(text);
74  d->m_text.append(QLatin1Char(' '));
75 }
76 
77 PropertyMap SimpleExtractionResult::properties() const
78 {
79  return d->m_properties;
80 }
81 
82 QString SimpleExtractionResult::text() const
83 {
84  return d->m_text;
85 }
86 
87 QVector<Type::Type> SimpleExtractionResult::types() const
88 {
89  return d->m_types;
90 }
A simple ExtractionResult implementation which stores all the data in memory.
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...
void addType(Type::Type type) override
This function is called by the plugins.
Property
The Property enum contains all files property types that KFileMetaData manipulates.
Definition: properties.h:38
Property::Property property() const
The enumeration which represents this property.
The ExtractionResult class is where all the data extracted by the indexer is saved.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 22:55:38 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.