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

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 Remi Benoit
0013  *         <a href="mailto:r3m1 dot benoit at gmail dot com">r3m1 dot benoit 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 "usergroup.h"
0029 
0030 // C++ includes
0031 
0032 #include <algorithm>
0033 
0034 namespace mediawiki
0035 {
0036 
0037 class Q_DECL_HIDDEN UserGroup::UserGroupPrivate
0038 {
0039 public:
0040 
0041     unsigned int   number;
0042 
0043     QString        name;
0044 
0045     QList<QString> rights;
0046 };
0047 
0048 UserGroup::UserGroup()
0049     : d(new UserGroupPrivate())
0050 {
0051     d->number = -1;
0052 }
0053 
0054 UserGroup::UserGroup(const UserGroup& other)
0055     : d(new UserGroupPrivate(*(other.d)))
0056 {
0057 }
0058 
0059 UserGroup::~UserGroup()
0060 {
0061     delete d;
0062 }
0063 
0064 UserGroup& UserGroup::operator=(UserGroup other)
0065 {
0066     *d = *other.d;
0067     return *this;
0068 }
0069 
0070 bool UserGroup::operator==(const mediawiki::UserGroup& other) const
0071 {
0072     return number() == other.number() &&
0073            rights() == other.rights() &&
0074            name()   == other.name() ;
0075 }
0076 
0077 QString UserGroup::name() const
0078 {
0079     return d->name;
0080 }
0081 
0082 void UserGroup::setName(const QString& name)
0083 {
0084     d->name = name;
0085 }
0086 
0087 const QList<QString>& UserGroup::rights() const
0088 {
0089     return d->rights;
0090 }
0091 
0092 QList<QString>& UserGroup::rights()
0093 {
0094     return d->rights;
0095 }
0096 
0097 void UserGroup::setRights(const QList<QString>& rights)
0098 {
0099     d->rights = rights;
0100 }
0101 
0102 qint64 UserGroup::number() const
0103 {
0104     return d->number;
0105 }
0106 
0107 void UserGroup::setNumber(qint64 number)
0108 {
0109     d->number = number;
0110 }
0111 
0112 } // namespace mediawiki