SimpleChatServer Class Reference
[Chat example]

A simple chat server. More...

#include <SimpleChatServer.h>

Inheritance diagram for SimpleChatServer:

Inheritance graph
[legend]

List of all members.

Public Types

typedef std::set< Wt::WStringUserSet
 Typedef for a collection of user names.

Public Member Functions

 SimpleChatServer ()
 Create a new chat server.
bool login (const Wt::WString &user)
 Try to login with given user name.
void logout (const Wt::WString &user)
 Logout from the server.
Wt::WString suggestGuest ()
 Get a suggestion for a guest user name.
void sendMessage (const Wt::WString &user, const Wt::WString &message)
 Send a message on behalve of a user.
UserSet users ()
 Get the users currently logged in.

Public Attributes

Wt::Signal< const ChatEvent & > chatEvent
 Signal that will convey chat events.

Private Attributes

boost::mutex mutex_
UserSet users_


Detailed Description

A simple chat server.

Definition at line 68 of file SimpleChatServer.h.


Member Typedef Documentation

Typedef for a collection of user names.

Definition at line 101 of file SimpleChatServer.h.


Constructor & Destructor Documentation

SimpleChatServer::SimpleChatServer (  ) 

Create a new chat server.

Definition at line 42 of file SimpleChatServer.C.


Member Function Documentation

bool SimpleChatServer::login ( const Wt::WString user  ) 

Try to login with given user name.

Returns false if the login was not successfull.

Definition at line 45 of file SimpleChatServer.C.

void SimpleChatServer::logout ( const Wt::WString user  ) 

Logout from the server.

Definition at line 59 of file SimpleChatServer.C.

WString SimpleChatServer::suggestGuest (  ) 

Get a suggestion for a guest user name.

Definition at line 72 of file SimpleChatServer.C.

void SimpleChatServer::sendMessage ( const Wt::WString user,
const Wt::WString message 
)

Send a message on behalve of a user.

Definition at line 85 of file SimpleChatServer.C.

SimpleChatServer::UserSet SimpleChatServer::users (  ) 

Get the users currently logged in.

Definition at line 92 of file SimpleChatServer.C.


Member Data Documentation

Signal that will convey chat events.

Every client should connect to this signal, and process events.

Definition at line 97 of file SimpleChatServer.h.

boost::mutex SimpleChatServer::mutex_ [private]

Definition at line 108 of file SimpleChatServer.h.

Definition at line 110 of file SimpleChatServer.h.


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

Generated on Fri Sep 12 16:53:53 2008 for Wt by doxygen 1.5.6