KFileMetaData

writedata.cpp
1/*
2 This file is part of the KFileMetaData project
3 SPDX-FileCopyrightText: 2016 Varun Joshi <varunj.1011@gmail.com>
4 SPDX-FileCopyrightText: 2016 Vishesh Handa <me@vhanda.in>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include "writedata.h"
10
11#include <QMimeDatabase>
12
13using namespace KFileMetaData;
14
15class KFileMetaData::WriteDataPrivate
16{
17public:
18 QString url;
19 QString mimetype;
20 PropertyMultiMap properties;
22};
23
24WriteData::WriteData(const QString& url, const QString& mimetype)
25 : d_ptr(new WriteDataPrivate)
26{
27 Q_D(WriteData);
28
29 d->url = url;
30 d->mimetype = mimetype;
31 if (mimetype.isEmpty()) {
33 }
34}
35
36WriteData::WriteData(const WriteData& rhs)
37 : d_ptr(new WriteDataPrivate(*rhs.d_ptr))
38{
39}
40
41WriteData& WriteData::operator=(const WriteData& rhs)
42{
43 *d_ptr = *rhs.d_ptr;
44 return *this;
45}
46
47bool WriteData::operator==(const WriteData& rhs) const
48{
49 Q_D(const WriteData);
50 return d->properties == rhs.d_ptr->properties;
51}
52
53void WriteData::add(Property::Property property, const QVariant& value)
54{
55 Q_D(WriteData);
56 d->properties.insert(property, value);
57}
58
59void WriteData::addImageData(const QMap<EmbeddedImageData::ImageType, QByteArray>& images)
60{
61 Q_D(WriteData);
62 d->images = images;
63}
64
65QMap<EmbeddedImageData::ImageType, QByteArray> WriteData::imageData() const
66{
67 Q_D(const WriteData);
68 return d->images;
69}
70
71WriteData::~WriteData() = default;
72
73QString WriteData::inputUrl() const
74{
75 Q_D(const WriteData);
76 return d->url;
77}
78
79QString WriteData::inputMimetype() const
80{
81 Q_D(const WriteData);
82 return d->mimetype;
83}
84
85PropertyMultiMap WriteData::properties() const
86{
87 Q_D(const WriteData);
88 return d->properties;
89}
QString mimetype() const
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:23
QMimeType mimeTypeForFile(const QString &fileName, QMimeDatabase::MatchMode mode) const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:44:24 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.