1
/*
2
 *  The Mana World
3
 *  Copyright (C) 2004  The Mana World Development Team
4
 *
5
 *  This file is part of The Mana World.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 */
21
22
#ifndef GUILD_H
23
#define GUILD_H
24
25
#include <guichan/listmodel.hpp>
26
27
#include <string>
28
#include <vector>
29
30
class Guild : public gcn::ListModel
31
{
32
public:
33
    /**
34
     * Constructor with guild id passed to it.
35
     */
36
    Guild(short id, short rights);
37
38
    /**
39
     * Set the guild's name.
40
     */
41
    void setName(const std::string &name)
42
    {
43
        mName = name;
44
    }
45
46
    /**
47
     * Adds member to the list.
48
     */
49
    void addMember(const std::string &name);
50
51
    /**
52
     * Get the name of the guild.
53
     * @return returns name of the guild
54
     */
55
    const std::string &getName() const
56
    {
57
        return mName;
58
    }
59
60
    /**
61
     * Get the id of the guild.
62
     * @return Returns the id of the guild
63
     */
64
    short getId() const
65
    {
66
        return mId;
67
    }
68
69
    /**
70
     * Removes a member from the guild.
71
     */
72
    void removeMember(const std::string &name);
73
74
    /**
75
     * Get size of members list.
76
     * @return Returns the number of members in the guild.
77
     */
78
    int getNumberOfElements() {
79
        return mMembers.size();
80
    }
81
82
    /**
83
     * Get member at \a index.
84
     * @return Returns the name of member.
85
     */
86
    std::string getElementAt(int index) {
87
        return mMembers[index];
88
    }
89
90
    /**
91
     * Get whether user can invite users to this guild.
92
     * @return Returns true if user can invite users
93
     */
94
    bool getInviteRights() const
95
    {
96
        return mCanInviteUsers;
97
    }
98
99
    bool isMember(const std::string &name) const;
100
101
private:
102
    std::string mName;
103
    short mId;
104
    std::vector<std::string> mMembers;
105
    bool mCanInviteUsers;
106
};
107
108
#endif // GUILD_H