/*! \file user.cpp
This is the User class implementation.
\author Jon A. Lambert
\date 05/02/2003
\version 0.30
*/
#include "sysconfig.h"
#include "user.h"
/*!
Constructor for User. There is no default constructor as
all Users must be constructed with a socket id.
*/
User::User(unsigned int id)
: mClientId(id), mState(0), mName("") {
}
/*!
Destructor for User
*/
User::~User() {
}
/*!
Copy Constructor for User
*/
User::User(const User& r_user)
: mClientId(r_user.mClientId), mState(r_user.mState), mName(r_user.mName) {
}
/*!
Assignment operator for User
\param r_user The user this user is being assigned to
*/
User& User::operator=(const User& r_user) {
if (this == &r_user)
return *this;
mClientId = r_user.mClientId;
mState = r_user.mState;
mName = r_user.mName;
return *this;
}
/*!
Equality operator for User
\param r_user The user this user is being compared to
*/
bool User::operator==(const User& r_user) const {
return (this->mClientId == r_user.mClientId);
}
/*!
Equality operator for User
\param id The user id this user is being compared to
*/
bool User::operator==(unsigned int id) const {
return (this->mClientId == id);
}
/*!
Inequality operator for User
\param id The user id this user is being compared to
*/
bool User::operator!=(unsigned int id) const {
return !(this->mClientId == id);
}
/*!
Return the ClientID
\return the client ID or socket number
*/
unsigned int User::Id() {
return mClientId;
}