File indexing completed on 2025-01-05 03:53:35

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2011-03-22
0007  * Description : a Iface C++ interface
0008  *
0009  * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2011      by Ludovic Delfau <ludovicdelfau at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "mediawiki_imageinfo.h"
0017 
0018 // C++ includes
0019 
0020 #include <algorithm>
0021 
0022 namespace MediaWiki
0023 {
0024 
0025 class Q_DECL_HIDDEN Imageinfo::Private
0026 {
0027 public:
0028 
0029     QDateTime                timestamp;
0030     QString                  user;
0031     QString                  comment;
0032     QUrl                     url;
0033     QUrl                     descriptionUrl;
0034     QUrl                     thumbUrl;
0035     qint64                   thumbWidth;
0036     qint64                   thumbHeight;
0037     qint64                   size;
0038     qint64                   width;
0039     qint64                   height;
0040     QString                  sha1;
0041     QString                  mime;
0042     QHash<QString, QVariant> metadata;
0043 };
0044 
0045 Imageinfo::Imageinfo()
0046     : d(new Private())
0047 {
0048     d->thumbWidth  = -1;
0049     d->thumbHeight = -1;
0050     d->size        = -1;
0051     d->width       = -1;
0052     d->height      = -1;
0053 }
0054 
0055 Imageinfo::Imageinfo(const Imageinfo& other)
0056     : d(new Private(*(other.d)))
0057 {
0058 }
0059 
0060 Imageinfo::~Imageinfo()
0061 {
0062     delete d;
0063 }
0064 
0065 Imageinfo& Imageinfo::operator=(const Imageinfo& other)
0066 {
0067     *d = *other.d;
0068 
0069     return *this;
0070 }
0071 
0072 bool Imageinfo::operator==(const Imageinfo& other) const
0073 {
0074     return (
0075             (timestamp()      == other.timestamp())      &&
0076             (user()           == other.user())           &&
0077             (comment()        == other.comment())        &&
0078             (url()            == other.url())            &&
0079             (descriptionUrl() == other.descriptionUrl()) &&
0080             (thumbUrl()       == other.thumbUrl())       &&
0081             (thumbWidth()     == other.thumbWidth())     &&
0082             (thumbHeight()    == other.thumbHeight())    &&
0083             (size()           == other.size())           &&
0084             (width()          == other.width())          &&
0085             (height()         == other.height())         &&
0086             (sha1()           == other.sha1())           &&
0087             (mime()           == other.mime())           &&
0088             (metadata()       == other.metadata())
0089            );
0090 }
0091 
0092 QDateTime Imageinfo::timestamp() const
0093 {
0094     return d->timestamp;
0095 }
0096 
0097 void Imageinfo::setTimestamp(const QDateTime& timestamp)
0098 {
0099     d->timestamp = timestamp;
0100 }
0101 
0102 QString Imageinfo::user() const
0103 {
0104     return d->user;
0105 }
0106 
0107 void Imageinfo::setUser(const QString& user)
0108 {
0109     d->user = user;
0110 }
0111 
0112 QString Imageinfo::comment() const
0113 {
0114     return d->comment;
0115 }
0116 
0117 void Imageinfo::setComment(const QString& comment)
0118 {
0119     d->comment = comment;
0120 }
0121 
0122 QUrl Imageinfo::url() const
0123 {
0124     return d->url;
0125 }
0126 
0127 void Imageinfo::setUrl(const QUrl& url)
0128 {
0129     d->url = url;
0130 }
0131 
0132 QUrl Imageinfo::descriptionUrl() const
0133 {
0134     return d->url;
0135 }
0136 
0137 void Imageinfo::setDescriptionUrl(const QUrl& descriptionUrl)
0138 {
0139     d->descriptionUrl = descriptionUrl;
0140 }
0141 
0142 QUrl Imageinfo::thumbUrl() const
0143 {
0144     return d->thumbUrl;
0145 }
0146 
0147 void Imageinfo::setThumbUrl(const QUrl& thumbUrl)
0148 {
0149     d->thumbUrl = thumbUrl;
0150 }
0151 
0152 qint64 Imageinfo::thumbWidth() const
0153 {
0154     return d->thumbWidth;
0155 }
0156 
0157 void Imageinfo::setThumbWidth(qint64 thumbWidth)
0158 {
0159     d->thumbWidth = thumbWidth;
0160 }
0161 
0162 qint64 Imageinfo::thumbHeight() const
0163 {
0164     return d->thumbHeight;
0165 }
0166 
0167 void Imageinfo::setThumbHeight(qint64 thumbHeight)
0168 {
0169     d->thumbHeight = thumbHeight;
0170 }
0171 
0172 qint64 Imageinfo::size() const
0173 {
0174     return d->size;
0175 }
0176 
0177 void Imageinfo::setSize(qint64 size)
0178 {
0179     d->size = size;
0180 }
0181 
0182 qint64 Imageinfo::width() const
0183 {
0184     return d->width;
0185 }
0186 
0187 void Imageinfo::setWidth(qint64 width)
0188 {
0189     d->width = width;
0190 }
0191 
0192 qint64 Imageinfo::height() const
0193 {
0194     return d->height;
0195 }
0196 
0197 void Imageinfo::setHeight(qint64 height)
0198 {
0199     d->height = height;
0200 }
0201 
0202 QString Imageinfo::sha1() const
0203 {
0204     return d->sha1;
0205 }
0206 
0207 void Imageinfo::setSha1(const QString& sha1)
0208 {
0209     d->sha1 = sha1;
0210 }
0211 
0212 QString Imageinfo::mime() const
0213 {
0214     return d->mime;
0215 }
0216 
0217 void Imageinfo::setMime(const QString& mime)
0218 {
0219     d->mime = mime;
0220 }
0221 
0222 const QHash<QString, QVariant>& Imageinfo::metadata() const
0223 {
0224     return d->metadata;
0225 }
0226 
0227 QHash<QString, QVariant>& Imageinfo::metadata()
0228 {
0229     return d->metadata;
0230 }
0231 
0232 void Imageinfo::setMetadata(const QHash<QString, QVariant>& metadata)
0233 {
0234      d->metadata = metadata;
0235 }
0236 
0237 } // namespace MediaWiki