UserList Class Reference

This class is used to read users into memory. More...

#include <UserList.hpp>

List of all members.


Public Member Functions

 UserList ()
 default constructor
 ~UserList ()
 default destructor
void addUser (User *u)
 add the specified user to the list
UsergetUserByName (const char *username)
UsergetUserById (const uint userId)
vector< User * > getUsers ()
void readUsersFromFile (const char *filename)
 read all users from the specified file into memory

Detailed Description

This class is used to read users into memory.

Author:
Klaus Schoeffmann

Definition at line 68 of file UserList.hpp.


Member Function Documentation

User * UserList::getUserById const uint  userId  ) 
 

Returns:
user with the specified id
Definition at line 94 of file UserList.cpp.

References User::getUserId().

Referenced by ProfileList::readProfilesFromFile().

00095 { 00096 uint i; 00097 for (i=0; i < list.size(); i++) 00098 { 00099 User *user = list[i]; 00100 if (user->getUserId() == userId) return user; 00101 } 00102 00103 return NULL; 00104 }

User * UserList::getUserByName const char *  username  ) 
 

Returns:
user with the specified username
Definition at line 81 of file UserList.cpp.

References User::getUsername().

00082 { 00083 uint i; 00084 for (i=0; i < list.size(); i++) 00085 { 00086 User *user = list[i]; 00087 if (strcmp(user->getUsername(), username) == 0) return user; 00088 } 00089 00090 return NULL; 00091 }

vector< User * > UserList::getUsers  ) 
 

Returns:
a reference to the internal list of users
Definition at line 107 of file UserList.cpp.
00108 { 00109 return list; 00110 }


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