File indexing completed on 2024-04-21 15:32:07

0001 /** ===========================================================
0002  * @file
0003  *
0004  * This file is a part of KDE project
0005  * <a href="https://commits.kde.org/libmediawiki">libmediawiki</a>
0006  *
0007  * @date   2011-03-22
0008  * @brief  a MediaWiki C++ interface for KDE
0009  *
0010  * @author Copyright (C) 2011 by Gilles Caulier
0011  *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
0012  * @author Copyright (C) 2010 by Joris Munoz
0013  *         <a href="mailto:munozjoris at gmail dot com">munozjoris at gmail dot com</a>
0014  *
0015  * This program is free software; you can redistribute it
0016  * and/or modify it under the terms of the GNU General
0017  * Public License as published by the Free Software Foundation;
0018  * either version 2, or (at your option)
0019  * any later version.
0020  *
0021  * This program is distributed in the hope that it will be useful,
0022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0024  * GNU General Public License for more details.
0025  *
0026  * ============================================================ */
0027 
0028 #include "page.h"
0029 
0030 // C++ includes
0031 
0032 #include <algorithm>
0033 
0034 // Qt includes
0035 
0036 #include <QUrl>
0037 
0038 namespace mediawiki
0039 {
0040 
0041 class Q_DECL_HIDDEN Page::PagePrivate
0042 {
0043 public:
0044 
0045     unsigned int m_pageid;
0046     unsigned int m_ns;
0047     unsigned int m_lastrevid;
0048     unsigned int m_counter;
0049     unsigned int m_length;
0050     unsigned int m_talkid;
0051     QString      m_edittoken;
0052     QString      m_title;
0053     QString      m_readable;
0054     QString      m_preload;
0055     QUrl         m_fullurl;
0056     QUrl         m_editurl;
0057     QDateTime    m_touched;
0058     QDateTime    m_starttimestamp;
0059 };
0060 
0061 Page::Page()
0062     :d(new PagePrivate())
0063 {
0064 }
0065 
0066 Page::~Page()
0067 {
0068     delete d;
0069 }
0070 
0071 Page::Page( const Page& other)
0072         : d(new PagePrivate(*(other.d)))
0073 {
0074 }
0075 
0076 Page& Page::operator=(Page other)
0077 {
0078     *d = *other.d;
0079     return *this;
0080 }
0081 
0082 bool Page::operator==(const Page& other) const
0083 {
0084     return pageId()             == other.pageId()        &&
0085            pageTitle()          == other.pageTitle()     &&
0086            pageNs()             == other.pageNs()        &&
0087            pageLastRevId()      == other.pageLastRevId() &&
0088            pageCounter()        == other.pageCounter()   &&
0089            pageLength()         == other.pageLength()    &&
0090            pageEditToken()      == other.pageEditToken() &&
0091            pageTalkid()         == other.pageTalkid()    &&
0092            pageFullurl()        == other.pageFullurl()   &&
0093            pageEditurl()        == other.pageEditurl()   &&
0094            pageReadable()       == other.pageReadable()  &&
0095            pagePreload()        == other.pagePreload()   &&
0096            pageTouched()        == other.pageTouched()   &&
0097            pageStarttimestamp() == other.pageStarttimestamp();
0098 }
0099 
0100 void Page::setPageId(unsigned int id)
0101 {
0102     d->m_pageid=id;
0103 }
0104 
0105 unsigned int Page::pageId() const
0106 {
0107     return d->m_pageid;
0108 }
0109 
0110 void Page::setTitle(const QString& title)
0111 {
0112     d->m_title=title;
0113 }
0114 
0115 QString Page::pageTitle() const
0116 {
0117     return d->m_title;
0118 }
0119 
0120 void Page::setNs(unsigned int ns) const
0121 {
0122     d->m_ns=ns;
0123 }
0124 
0125 unsigned int Page::pageNs() const
0126 {
0127     return d->m_ns;
0128 }
0129 
0130 void Page::setLastRevId(unsigned int lastRevId) const
0131 {
0132     d->m_lastrevid=lastRevId;
0133 }
0134 
0135 unsigned int Page::pageLastRevId() const
0136 {
0137     return d->m_lastrevid;
0138 }
0139 
0140 void Page::setCounter(unsigned int counter) const
0141 {
0142     d->m_counter=counter;
0143 }
0144 
0145 unsigned int Page::pageCounter() const
0146 {
0147     return d->m_counter;
0148 }
0149 
0150 void Page::setLength(unsigned int length) const
0151 {
0152      d->m_length=length;
0153 }
0154 
0155 unsigned int Page::pageLength() const
0156 {
0157      return d->m_length;
0158 }
0159 
0160 void Page::setEditToken(const QString& editToken)
0161 {
0162     d->m_edittoken=editToken;
0163 }
0164 
0165 QString Page::pageEditToken() const
0166 {
0167     return d->m_edittoken;
0168 }
0169 
0170 void Page::setTalkid(unsigned int talkid) const
0171 {
0172      d->m_talkid=talkid;
0173 }
0174 
0175 unsigned int Page::pageTalkid() const
0176 {
0177      return d->m_talkid;
0178 }
0179 
0180 void Page::setFullurl(const QUrl& fullurl)
0181 {
0182     d->m_fullurl=fullurl;
0183 }
0184 
0185 QUrl Page::pageFullurl() const
0186 {
0187     return d->m_fullurl;
0188 }
0189 
0190 void Page::setEditurl(const QUrl& editurl)
0191 {
0192     d->m_editurl=editurl;
0193 }
0194 
0195 QUrl Page::pageEditurl() const
0196 {
0197     return d->m_editurl;
0198 }
0199 
0200 void Page::setReadable(const QString& readable)
0201 {
0202     d->m_readable=readable;
0203 }
0204 
0205 QString Page::pageReadable() const
0206 {
0207     return d->m_readable;
0208 }
0209 
0210 void Page::setPreload(const QString& preload)
0211 {
0212     d->m_preload=preload;
0213 }
0214 
0215 QString Page::pagePreload() const
0216 {
0217     return d->m_preload;
0218 }
0219 
0220 void Page::setTouched(const QDateTime& touched)
0221 {
0222     d->m_touched=touched;
0223 }
0224 
0225 QDateTime Page::pageTouched() const
0226 {
0227     return d->m_touched;
0228 }
0229 
0230 void Page::setStarttimestamp(const QDateTime& starttimestamp)
0231 {
0232     d->m_starttimestamp=starttimestamp;
0233 }
0234 
0235 QDateTime Page::pageStarttimestamp() const
0236 {
0237     return d->m_starttimestamp;
0238 }
0239 
0240 } // namespace mediawiki;