KFileMetaData

simpleextractionresult.cpp
1/*
2 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#include "simpleextractionresult.h"
8
9using namespace KFileMetaData;
10
11class KFileMetaData::SimpleExtractionResultPrivate
12{
13public:
14 PropertyMultiMap m_properties;
15 QString m_text;
16 QList<Type::Type> m_types;
17};
18
19SimpleExtractionResult::SimpleExtractionResult(const QString& url, const QString& mimetype, const Flags& flags)
20 : ExtractionResult(url, mimetype, flags)
21 , d(new SimpleExtractionResultPrivate)
22{
23}
24
25SimpleExtractionResult::SimpleExtractionResult(const SimpleExtractionResult& rhs)
26 : ExtractionResult(*this)
27 , d(new SimpleExtractionResultPrivate(*rhs.d))
28{
29}
30
31SimpleExtractionResult::~SimpleExtractionResult() = default;
32
33SimpleExtractionResult& SimpleExtractionResult::operator=(const SimpleExtractionResult& rhs)
34{
35 *d = *rhs.d;
36 return *this;
37}
38
39bool 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
51{
52 d->m_types << type;
53}
54
56{
57 d->m_text.append(text);
58 d->m_text.append(QLatin1Char(' '));
59}
60
62{
63 return d->m_properties;
64}
65
66QString SimpleExtractionResult::text() const
67{
68 return d->m_text;
69}
70
71QList<Type::Type> SimpleExtractionResult::types() const
72{
73 return d->m_types;
74}
The ExtractionResult class is where all the data extracted by the indexer is saved.
A simple ExtractionResult implementation which stores all the data in memory.
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.
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.