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 | |
9 | using namespace KFileMetaData; |
10 | |
11 | class KFileMetaData::SimpleExtractionResultPrivate |
12 | { |
13 | public: |
14 | PropertyMultiMap m_properties; |
15 | QString m_text; |
16 | QList<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 | |
45 | void SimpleExtractionResult::add(Property::Property property, const QVariant& value) |
46 | { |
47 | d->m_properties.insert(key: property, value); |
48 | } |
49 | |
50 | void SimpleExtractionResult::addType(Type::Type type) |
51 | { |
52 | d->m_types << type; |
53 | } |
54 | |
55 | void SimpleExtractionResult::append(const QString& text) |
56 | { |
57 | d->m_text.append(s: text); |
58 | d->m_text.append(c: QLatin1Char(' ')); |
59 | } |
60 | |
61 | PropertyMultiMap SimpleExtractionResult::properties() const |
62 | { |
63 | return d->m_properties; |
64 | } |
65 | |
66 | QString SimpleExtractionResult::text() const |
67 | { |
68 | return d->m_text; |
69 | } |
70 | |
71 | QList<Type::Type> SimpleExtractionResult::types() const |
72 | { |
73 | return d->m_types; |
74 | } |
75 |