1 /** =========================================================== 2 * @file 3 * 4 * This file is a part of KDE project 5 * <a href="https://projects.kde.org/projects/extragear/libs/libmediawiki">libmediawiki</a> 6 * 7 * @date 2011-03-22 8 * @brief a MediaWiki C++ interface for KDE 9 * 10 * @author Copyright (C) 2011-2012 by Gilles Caulier 11 * <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a> 12 * @author Copyright (C) 2010 by Robin Bussenot 13 * <a href="mailto:bussenot dot robin at gmail dot com">bussenot dot robin at gmail dot com</a> 14 * 15 * This program is free software; you can redistribute it 16 * and/or modify it under the terms of the GNU General 17 * Public License as published by the Free Software Foundation; 18 * either version 2, or (at your option) 19 * any later version. 20 * 21 * This program is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * GNU General Public License for more details. 25 * 26 * ============================================================ */ 27 28 #include "revision.h" 29 30 // C++ includes 31 32 #include <algorithm> 33 34 namespace mediawiki 35 { 36 37 class Q_DECL_HIDDEN Revision::RevisionPrivate 38 { 39 public: 40 41 int revId; 42 int parentId; 43 int size; 44 bool minorRevision; 45 QString user; 46 QDateTime timestamp; 47 QString comment; 48 QString content; 49 QString parseTree; 50 QString rollback; 51 }; 52 Revision()53Revision::Revision() 54 : d(new RevisionPrivate()) 55 { 56 d->minorRevision = false; 57 d->revId = -1; 58 d->parentId = -1; 59 d->size = -1; 60 } 61 ~Revision()62Revision::~Revision() 63 { 64 delete d; 65 } 66 Revision(const Revision & other)67Revision::Revision( const Revision& other) 68 : d(new RevisionPrivate(*(other.d))) 69 { 70 } 71 operator =(Revision other)72Revision& Revision::operator=(Revision other) 73 { 74 *d = *other.d; 75 return *this; 76 } 77 operator ==(const Revision & other) const78bool Revision::operator==(const Revision& other) const 79 { 80 return timestamp() == other.timestamp() && 81 user() == other.user() && 82 comment() == other.comment() && 83 content() == other.content() && 84 size() == other.size() && 85 minorRevision() == other.minorRevision() && 86 parseTree() == other.parseTree() && 87 parentId() == other.parentId() && 88 rollback() == other.rollback() && 89 revisionId() == other.revisionId(); 90 } 91 setRevisionId(int revisionId)92void Revision::setRevisionId(int revisionId) 93 { 94 d->revId=revisionId; 95 } 96 revisionId() const97int Revision::revisionId() const 98 { 99 return d->revId; 100 } 101 setParentId(int parentId)102void Revision::setParentId(int parentId) 103 { 104 d->parentId=parentId; 105 } 106 parentId() const107int Revision::parentId() const 108 { 109 return d->parentId; 110 } 111 setSize(int size)112void Revision::setSize(int size) 113 { 114 d->size=size; 115 } 116 size() const117int Revision::size() const 118 { 119 return d->size; 120 } 121 setMinorRevision(bool minorRevision)122void Revision::setMinorRevision(bool minorRevision) 123 { 124 d->minorRevision=minorRevision; 125 } minorRevision() const126bool Revision::minorRevision() const 127 { 128 return d->minorRevision; 129 } 130 timestamp() const131QDateTime Revision::timestamp() const 132 { 133 return d->timestamp; 134 } 135 setTimestamp(const QDateTime & timestamp)136void Revision::setTimestamp(const QDateTime& timestamp) 137 { 138 d->timestamp = timestamp; 139 } 140 user() const141QString Revision::user() const 142 { 143 return d->user; 144 } 145 setUser(const QString & user)146void Revision::setUser(const QString& user) 147 { 148 d->user = user; 149 } 150 setComment(const QString & com)151void Revision::setComment(const QString& com) 152 { 153 d->comment = com; 154 } 155 comment() const156QString Revision::comment() const 157 { 158 return d->comment; 159 } 160 content() const161QString Revision::content() const 162 { 163 return d->content; 164 } 165 setContent(const QString & content)166void Revision::setContent(const QString& content) 167 { 168 d->content=content; 169 } 170 setParseTree(const QString & parseTree)171void Revision::setParseTree(const QString& parseTree) 172 { 173 d->parseTree=parseTree; 174 } 175 parseTree() const176QString Revision::parseTree() const 177 { 178 return d->parseTree; 179 } 180 setRollback(const QString & rollback)181void Revision::setRollback(const QString& rollback) 182 { 183 d->parseTree=rollback; 184 } 185 rollback() const186QString Revision::rollback() const 187 { 188 return d->rollback; 189 } 190 191 } // namespace mediawiki 192