Add foundation for membership ids

This commit is contained in:
Attila Molnar 2014-06-11 14:04:00 +02:00
parent 020f706bcb
commit 0205dd6548

View File

@ -20,6 +20,8 @@
#pragma once
uint64_t ConvToUInt64(const std::string& in);
/**
* Represents a member of a channel.
* A Membership object is created when a user joins a channel, and destroyed when a user leaves
@ -30,6 +32,10 @@
class CoreExport Membership : public Extensible, public intrusive_list_node<Membership>
{
public:
/** Type of the Membership id
*/
typedef uint64_t Id;
/** User on the channel
*/
User* const user;
@ -43,6 +49,20 @@ class CoreExport Membership : public Extensible, public intrusive_list_node<Memb
*/
std::string modes;
/** Id of this Membership, set by the protocol module, other components should never read or
* write this field.
*/
Id id;
/** Converts a string to a Membership::Id
* @param str The string to convert
* @return Raw value of type Membership::Id
*/
static Id IdFromString(const std::string& str)
{
return ConvToUInt64(str);
}
/** Constructor, sets the user and chan fields to the parameters, does NOT update any bookkeeping
* information in the User or the Channel.
* Call Channel::JoinUser() or ForceJoin() to make a user join a channel instead of constructing