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

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 Robin Bussenot <bussenot dot robin at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "mediawiki_revision.h"
0017 
0018 // C++ includes
0019 
0020 #include <algorithm>
0021 
0022 namespace MediaWiki
0023 {
0024 
0025 class Q_DECL_HIDDEN Revision::Private
0026 {
0027 public:
0028 
0029     int       revId;
0030     int       parentId;
0031     int       size;
0032     bool      minorRevision;
0033     QString   user;
0034     QDateTime timestamp;
0035     QString   comment;
0036     QString   content;
0037     QString   parseTree;
0038     QString   rollback;
0039 };
0040 
0041 Revision::Revision()
0042     : d(new Private())
0043 {
0044     d->minorRevision = false;
0045     d->revId         = -1;
0046     d->parentId      = -1;
0047     d->size          = -1;
0048 }
0049 
0050 Revision::~Revision()
0051 {
0052     delete d;
0053 }
0054 
0055 Revision::Revision( const Revision& other)
0056     : d(new Private(*(other.d)))
0057 {
0058 }
0059 
0060 Revision& Revision::operator=(const Revision& other)
0061 {
0062     *d = *other.d;
0063 
0064     return *this;
0065 }
0066 
0067 bool Revision::operator==(const Revision& other) const
0068 {
0069     return (
0070             (timestamp()     == other.timestamp())     &&
0071             (user()          == other.user())          &&
0072             (comment()       == other.comment())       &&
0073             (content()       == other.content())       &&
0074             (size()          == other.size())          &&
0075             (minorRevision() == other.minorRevision()) &&
0076             (parseTree()     == other.parseTree())     &&
0077             (parentId()      == other.parentId())      &&
0078             (rollback()      == other.rollback())      &&
0079             (revisionId()    == other.revisionId())
0080            );
0081 }
0082 
0083 void Revision::setRevisionId(int revisionId)
0084 {
0085     d->revId = revisionId;
0086 }
0087 
0088 int Revision::revisionId() const
0089 {
0090     return d->revId;
0091 }
0092 
0093 void Revision::setParentId(int parentId)
0094 {
0095     d->parentId = parentId;
0096 }
0097 
0098 int Revision::parentId() const
0099 {
0100     return d->parentId;
0101 }
0102 
0103 void Revision::setSize(int size)
0104 {
0105     d->size = size;
0106 }
0107 
0108 int Revision::size() const
0109 {
0110     return d->size;
0111 }
0112 
0113 void Revision::setMinorRevision(bool minorRevision)
0114 {
0115     d->minorRevision = minorRevision;
0116 }
0117 bool Revision::minorRevision() const
0118 {
0119     return d->minorRevision;
0120 }
0121 
0122 QDateTime Revision::timestamp() const
0123 {
0124     return d->timestamp;
0125 }
0126 
0127 void Revision::setTimestamp(const QDateTime& timestamp)
0128 {
0129     d->timestamp = timestamp;
0130 }
0131 
0132 QString Revision::user() const
0133 {
0134     return d->user;
0135 }
0136 
0137 void Revision::setUser(const QString& user)
0138 {
0139     d->user = user;
0140 }
0141 
0142 void Revision::setComment(const QString& com)
0143 {
0144     d->comment = com;
0145 }
0146 
0147 QString Revision::comment() const
0148 {
0149     return d->comment;
0150 }
0151 
0152 QString Revision::content() const
0153 {
0154     return d->content;
0155 }
0156 
0157 void Revision::setContent(const QString& content)
0158 {
0159     d->content = content;
0160 }
0161 
0162 void Revision::setParseTree(const QString& parseTree)
0163 {
0164     d->parseTree = parseTree;
0165 }
0166 
0167 QString Revision::parseTree() const
0168 {
0169     return d->parseTree;
0170 }
0171 
0172 void Revision::setRollback(const QString& rollback)
0173 {
0174     d->parseTree = rollback;
0175 }
0176 
0177 QString Revision::rollback() const
0178 {
0179     return d->rollback;
0180 }
0181 
0182 } // namespace MediaWiki