Editor Class Reference

This class defines an interface for UBSocket to use in handling lines from the user. More...

#include <Editor.h>

Inheritance diagram for Editor:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 Editor (UBSocket *sock)
 Constructs an Editor with the specified socket.
virtual ~Editor (void)
 Destructor, a noop.
virtual void OnEmptyLine ()
 This function is called whenever the user sends an empty line.
virtual void OnLine (const std::string &line)
 This function is called whenever a user sends a line.
virtual void OnFocus ()
 This function is called whenever this editor becomes the editor that has the focus.
virtual std::string name ()=0
 Returns the name of this editor.
virtual std::string prompt ()
 Returns the prompt for this editor.
virtual std::string lookup (const std::string &action)
 Returns the full name of a command of the specified action.
virtual void dispatch (const std::string &action, const std::string &argument)
 Dispatches the specified action with the specified argument.
virtual bool canReceiveChannel (mud::ChannelPtr channel) const
 Whether the current editor is capable of receiving messages from the specified channel.
virtual bool supportPrefixes () const
 Whether prefixes should be handled in the current editor.
void Send (const std::string &msg)
 Send a message to the user.
void Sendf (const char *format,...)
 Send a formatted message to the user.
void Disconnect ()
 Disconnect the user.

Protected Attributes

UBSocketm_sock
 The socket this Editor is associated with.


Detailed Description

This class defines an interface for UBSocket to use in handling lines from the user.

See also:
UBSocket

Definition at line 37 of file Editor.h.


Constructor & Destructor Documentation

Editor::Editor ( UBSocket sock  ) 

Constructs an Editor with the specified socket.

virtual Editor::~Editor ( void   )  [virtual]

Destructor, a noop.


Member Function Documentation

virtual void Editor::OnEmptyLine (  )  [inline, virtual]

This function is called whenever the user sends an empty line.

Reimplemented in EditorNewAccount, and EditorNewCharacter.

Definition at line 48 of file Editor.h.

virtual void Editor::OnLine ( const std::string &  line  )  [virtual]

This function is called whenever a user sends a line.

The default implementation will handle the input and use lookup to find the matching command. If matched it will dispatch it with the dispatch functions.

See also:
lookup

dispatch

Reimplemented in EditorAccountLogin, EditorBool, EditorNewAccount, EditorNewCharacter, and EditorString.

virtual void Editor::OnFocus (  )  [inline, virtual]

This function is called whenever this editor becomes the editor that has the focus.

Reimplemented in EditorChannel, EditorChunk, EditorCluster, EditorDetail, and EditorRoom.

Definition at line 62 of file Editor.h.

virtual std::string Editor::name (  )  [pure virtual]

Returns the name of this editor.

Implemented in EditorAccount, EditorAccountLogin, EditorArea, EditorBool, EditorChannel, EditorChunk, EditorCluster, EditorColour, EditorCommand, EditorDetail, EditorGrantGroup, EditorMobile, EditorNewAccount, EditorNewCharacter, EditorOLC, EditorOOC, EditorPermission, EditorPlaying, EditorRace, EditorRoom, EditorSector, and EditorString.

virtual std::string Editor::prompt (  )  [virtual]

Returns the prompt for this editor.

Reimplemented in EditorAccount, EditorArea, EditorChannel, EditorChunk, EditorCluster, EditorColour, EditorCommand, EditorDetail, EditorGrantGroup, EditorMobile, EditorOLC, EditorOOC, EditorPermission, EditorPlaying, EditorRace, EditorRoom, and EditorSector.

virtual std::string Editor::lookup ( const std::string &  action  )  [virtual]

Returns the full name of a command of the specified action.

Reimplemented in EditorAccount, EditorArea, EditorChannel, EditorChunk, EditorCluster, EditorColour, EditorCommand, EditorDetail, EditorGrantGroup, EditorMobile, EditorOLC, EditorOOC, EditorPermission, EditorPlaying, EditorRace, EditorRoom, EditorSector, and OLCEditor.

virtual void Editor::dispatch ( const std::string &  action,
const std::string &  argument 
) [inline, virtual]

Dispatches the specified action with the specified argument.

Reimplemented in EditorAccount, EditorArea, EditorChannel, EditorChunk, EditorCluster, EditorColour, EditorCommand, EditorDetail, EditorGrantGroup, EditorMobile, EditorOLC, EditorOOC, EditorPermission, EditorPlaying, EditorRace, EditorRoom, EditorSector, and OLCEditor.

Definition at line 75 of file Editor.h.

virtual bool Editor::canReceiveChannel ( mud::ChannelPtr  channel  )  const [virtual]

Whether the current editor is capable of receiving messages from the specified channel.

Reimplemented in EditorAccountLogin, and EditorNewAccount.

virtual bool Editor::supportPrefixes (  )  const [virtual]

Whether prefixes should be handled in the current editor.

Reimplemented in EditorAccountLogin, EditorNewAccount, and EditorOOC.

void Editor::Send ( const std::string &  msg  ) 

Send a message to the user.

void Editor::Sendf ( const char *  format,
  ... 
)

Send a formatted message to the user.

void Editor::Disconnect (  ) 

Disconnect the user.


Member Data Documentation

UBSocket* Editor::m_sock [protected]

The socket this Editor is associated with.

Definition at line 94 of file Editor.h.


Generated for UnsignedByte by  doxygen 1.5.3
SourceForge.net Logo