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-2012 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 Vincent Garcia
0013  *         <a href="mailto:xavier dot vincent dot garcia at gmail dot com">xavier dot vincent dot garcia 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 "protection.h"
0029 #include <algorithm>
0030 
0031 namespace mediawiki
0032 {
0033 
0034 class Q_DECL_HIDDEN Protection::ProtectionPrivate
0035 {
0036 public:
0037 
0038     QString type;
0039     QString level;
0040     QString expiry;
0041     QString source;
0042 };
0043 
0044 Protection::Protection()
0045     : d(new ProtectionPrivate())
0046 {
0047 }
0048 
0049 Protection::~Protection()
0050 {
0051     delete d;
0052 }
0053 
0054 Protection::Protection(const Protection& other)
0055     : d(new ProtectionPrivate(*(other.d)))
0056 {
0057 }
0058 
0059 Protection& Protection::operator=(Protection other)
0060 {
0061     *d = *other.d;
0062     return *this;
0063 }
0064 
0065 bool Protection::operator==(const Protection& other) const
0066 {
0067     return type()   == other.type()   &&
0068            level()  == other.level()  &&
0069            expiry() == other.expiry() &&
0070            source() == other.source();
0071 }
0072 
0073 void Protection::setType(const QString& type)
0074 {
0075     d->type = type;
0076 }
0077 
0078 QString Protection::type() const
0079 {
0080     return d->type;
0081 }
0082 
0083 void Protection::setLevel(const QString& level)
0084 {
0085     d->level = level;
0086 }
0087 
0088 QString Protection::level() const
0089 {
0090     return d->level;
0091 }
0092 
0093 void Protection::setExpiry(const QString& expiry)
0094 {
0095     d->expiry = expiry;
0096 }
0097 
0098 QString Protection::expiry() const
0099 {
0100     return d->expiry;
0101 }
0102 
0103 void Protection::setSource(const QString& source)
0104 {
0105     d->source = source;
0106 }
0107 
0108 QString Protection::source() const
0109 {
0110     return d->source;
0111 }
0112 
0113 } // namespace mediawiki