Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Guild Class Reference

#include <guild.h>

Inheritance diagram for Guild:
AvatarListModel

Public Member Functions

void setName (const std::string &name)
 Set the guild's name.
 
GuildMemberaddMember (int id, const std::string &name)
 Adds member to the list.
 
GuildMemberaddMember (const std::string &name)
 Adds member to the list.
 
GuildMembergetMember (int id) const
 Find a member by ID.
 
GuildMembergetMember (const std::string &name) const
 Find a member by name.
 
const std::string & getName () const
 Get the name of the guild.
 
short getId () const
 Get the id of the guild.
 
void removeMember (GuildMember *member)
 Removes a member from the guild.
 
void removeMember (int id)
 Removes a member from the guild.
 
void removeMember (const std::string &name)
 Removes a member from the guild.
 
void removeFromMembers ()
 
void clearMembers ()
 
int getNumberOfElements () override
 Get size of members list.
 
AvatargetAvatarAt (int i) override
 
bool getInviteRights () const
 Get whether user can invite users to this guild.
 
void setRights (short rights)
 
bool isMember (GuildMember *member) const
 
bool isMember (int id) const
 
bool isMember (const std::string &name) const
 
void getNames (std::vector< std::string > &names) const
 
- Public Member Functions inherited from AvatarListModel
std::string getElementAt (int i) override
 

Static Public Member Functions

static GuildgetGuild (int id)
 

Private Types

using GuildMap = std::map< int, Guild * >
 

Private Member Functions

 Guild (short id)
 Constructor with guild id passed to it.
 

Private Attributes

std::vector< GuildMember * > mMembers
 
std::string mName
 
short mId
 
bool mCanInviteUsers = false
 

Static Private Attributes

static GuildMap guilds
 

Detailed Description

Definition at line 54 of file guild.h.

Member Typedef Documentation

◆ GuildMap

using Guild::GuildMap = std::map<int, Guild *>
private

Definition at line 159 of file guild.h.

Constructor & Destructor Documentation

◆ Guild()

Guild::Guild ( short  id)
private

Constructor with guild id passed to it.

Definition at line 38 of file guild.cpp.

Member Function Documentation

◆ addMember() [1/2]

GuildMember * Guild::addMember ( const std::string &  name)

Adds member to the list.

Definition at line 59 of file guild.cpp.

◆ addMember() [2/2]

GuildMember * Guild::addMember ( int  id,
const std::string &  name 
)

Adds member to the list.

Definition at line 44 of file guild.cpp.

◆ clearMembers()

void Guild::clearMembers ( )
inline

Definition at line 125 of file guild.h.

◆ getAvatarAt()

Avatar * Guild::getAvatarAt ( int  i)
overridevirtual

Implements AvatarListModel.

Definition at line 136 of file guild.cpp.

◆ getGuild()

Guild * Guild::getGuild ( int  id)
static

Definition at line 183 of file guild.cpp.

◆ getId()

short Guild::getId ( ) const
inline

Get the id of the guild.

Returns
Returns the id of the guild

Definition at line 103 of file guild.h.

◆ getInviteRights()

bool Guild::getInviteRights ( ) const
inline

Get whether user can invite users to this guild.

Returns
Returns true if user can invite users

Definition at line 141 of file guild.h.

◆ getMember() [1/2]

GuildMember * Guild::getMember ( const std::string &  name) const

Find a member by name.

Returns
the member with the given name, or NULL if they don't exist.

Definition at line 83 of file guild.cpp.

◆ getMember() [2/2]

GuildMember * Guild::getMember ( int  id) const

Find a member by ID.

Returns
the member with the given ID, or NULL if they don't exist.

Definition at line 74 of file guild.cpp.

◆ getName()

const std::string & Guild::getName ( ) const
inline

Get the name of the guild.

Returns
returns name of the guild

Definition at line 94 of file guild.h.

◆ getNames()

void Guild::getNames ( std::vector< std::string > &  names) const

Definition at line 175 of file guild.cpp.

◆ getNumberOfElements()

int Guild::getNumberOfElements ( )
inlineoverride

Get size of members list.

Returns
Returns the number of members in the guild.

Definition at line 131 of file guild.h.

◆ isMember() [1/3]

bool Guild::isMember ( const std::string &  name) const

Definition at line 170 of file guild.cpp.

◆ isMember() [2/3]

bool Guild::isMember ( GuildMember member) const

Definition at line 148 of file guild.cpp.

◆ isMember() [3/3]

bool Guild::isMember ( int  id) const

Definition at line 165 of file guild.cpp.

◆ removeFromMembers()

void Guild::removeFromMembers ( )

Definition at line 127 of file guild.cpp.

◆ removeMember() [1/3]

void Guild::removeMember ( const std::string &  name)

Removes a member from the guild.

Definition at line 115 of file guild.cpp.

◆ removeMember() [2/3]

void Guild::removeMember ( GuildMember member)

Removes a member from the guild.

Definition at line 92 of file guild.cpp.

◆ removeMember() [3/3]

void Guild::removeMember ( int  id)

Removes a member from the guild.

Definition at line 105 of file guild.cpp.

◆ setName()

void Guild::setName ( const std::string &  name)
inline

Set the guild's name.

Definition at line 61 of file guild.h.

◆ setRights()

void Guild::setRights ( short  rights)

Definition at line 141 of file guild.cpp.

Member Data Documentation

◆ guilds

Guild::GuildMap Guild::guilds
staticprivate

Definition at line 160 of file guild.h.

◆ mCanInviteUsers

bool Guild::mCanInviteUsers = false
private

Definition at line 170 of file guild.h.

◆ mId

short Guild::mId
private

Definition at line 169 of file guild.h.

◆ mMembers

std::vector<GuildMember *> Guild::mMembers
private

Definition at line 167 of file guild.h.

◆ mName

std::string Guild::mName
private

Definition at line 168 of file guild.h.


The documentation for this class was generated from the following files: