Account Class Reference

A player's account. More...

#include <account.hpp>

List of all members.

Public Member Functions

 Account (int id=-1)
 Constructor.
 ~Account ()
 Destructor.
void setName (const std::string &name)
 Set the user name.
const std::string & getName () const
 Get the user name.
void setPassword (const std::string &password)
 Set the user password.
const std::string & getPassword () const
 Get the user password (hashed with salt).
void setEmail (const std::string &email)
 Set the user email address.
const std::string & getEmail () const
 Get the user email address (hashed).
void setLevel (int level)
 Set the account level.
int getLevel () const
 Get the account level.
void setCharacters (const Characters &characters)
 Set the characters.
void addCharacter (Character *character)
 Add a new character.
void delCharacter (int i)
 Removes a character from the account.
Characters & getCharacters ()
 Get all the characters.
const Characters & getCharacters () const
 Get all the characters.
int getID () const
 Get account ID.
void setID (int)
 Set account ID.
time_t getRegistrationDate () const
 Get the time of the account registration.
void setRegistrationDate (time_t time)
 Sets the time of the account registration.
time_t getLastLogin () const
 Get the time of the last login.
void setLastLogin (time_t time)
 Sets the time of the last login.


Detailed Description

A player's account.

Stores the account information as well as the player characters available under this account.

Definition at line 34 of file account.hpp.


Member Function Documentation

void Account::setName ( const std::string &  name  )  [inline]

Set the user name.

Parameters:
name the user name.

Definition at line 54 of file account.hpp.

const std::string& Account::getName (  )  const [inline]

Get the user name.

Returns:
the user name.

Definition at line 63 of file account.hpp.

Referenced by DALStorage::addAccount(), and DALStorage::flush().

void Account::setPassword ( const std::string &  password  )  [inline]

Set the user password.

The password is expected to be already hashed with a salt.

The hashing must be performed externally from this class or else we would end up with the password being hashed many times (e.g setPassword(getPassword()) would hash the password twice.

Parameters:
password the user password (hashed with salt).

Definition at line 77 of file account.hpp.

const std::string& Account::getPassword (  )  const [inline]

Get the user password (hashed with salt).

Returns:
the user password (hashed with salt).

Definition at line 86 of file account.hpp.

Referenced by DALStorage::addAccount(), and DALStorage::flush().

void Account::setEmail ( const std::string &  email  )  [inline]

Set the user email address.

The email address is expected to be already hashed.

Parameters:
email the user email address (hashed).

Definition at line 96 of file account.hpp.

const std::string& Account::getEmail (  )  const [inline]

Get the user email address (hashed).

Returns:
the user email address (hashed).

Definition at line 105 of file account.hpp.

Referenced by DALStorage::addAccount(), and DALStorage::flush().

void Account::setLevel ( int  level  )  [inline]

Set the account level.

Parameters:
level the new level.

Definition at line 114 of file account.hpp.

int Account::getLevel (  )  const [inline]

Get the account level.

Returns:
the account level.

Definition at line 123 of file account.hpp.

Referenced by DALStorage::addAccount(), DALStorage::flush(), and Character::setAccount().

void Account::setCharacters ( const Characters &  characters  ) 

Set the characters.

Parameters:
characters a list of characters.

Definition at line 42 of file account.cpp.

Referenced by DALStorage::delAccount().

void Account::addCharacter ( Character character  ) 

Add a new character.

Parameters:
character the new character.

Definition at line 51 of file account.cpp.

void Account::delCharacter ( int  i  ) 

Removes a character from the account.

Parameters:
i index of the character.

Definition at line 56 of file account.cpp.

Characters& Account::getCharacters (  )  [inline]

Get all the characters.

Returns:
all the characters.

Definition at line 156 of file account.hpp.

Referenced by DALStorage::addAccount(), and DALStorage::flush().

const Characters& Account::getCharacters (  )  const [inline]

Get all the characters.

Returns:
all the characters.

Definition at line 164 of file account.hpp.

int Account::getID (  )  const [inline]

Get account ID.

Returns:
the unique ID of the account, a negative number if none yet.

Definition at line 172 of file account.hpp.

Referenced by DALStorage::delAccount(), DALStorage::flush(), Character::setAccount(), and DALStorage::updateLastLogin().

void Account::setID ( int  id  ) 

Set account ID.

The account shall not have any ID yet.

Definition at line 61 of file account.cpp.

Referenced by DALStorage::addAccount().

void Account::setRegistrationDate ( time_t  time  ) 

Sets the time of the account registration.

Parameters:
time of the account registration.

Definition at line 67 of file account.cpp.

void Account::setLastLogin ( time_t  time  ) 

Sets the time of the last login.

Parameters:
time of the last login.

Definition at line 72 of file account.cpp.


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

Generated on Sun Apr 26 17:30:46 2009 for TMW Server Collection by  doxygen 1.5.5