PCLI::Context Class Reference

#include <cli.h>

Inheritance diagram for PCLI::Context:

PIndirectChannel PChannel PObject List of all members.

Public Member Functions

Overrides from PChannel
virtual PBoolean Write (const void *buf, PINDEX len)
Operations
bool Start ()
void Stop ()
virtual void OnStart ()
virtual void OnStop ()
virtual bool ReadAndProcessInput ()
virtual void ProcessInput (char ch)
virtual void OnCompletedLine ()
Member access
PCLIGetCLI () const
bool IsProcessingCommand () const

Protected Member Functions

 PDECLARE_NOTIFIER (PThread, Context, ThreadMain)

Protected Attributes

PCLIm_cli
PString m_commandLine
bool m_ignoreNextLF
PStringList m_commandHistory
PThreadm_thread
bool m_processingCommand

Detailed Description

Context for command line interpreter.


Constructor & Destructor Documentation

PCLI::Context::Context ( PCLI cli  ) 

Construct new command line interpreter context.

virtual PCLI::Context::~Context (  )  [virtual]

Destroy command line interpreter context. This will close and wait for threads to exit.

PCLI::Context::Context ( PCLI cli  ) 

Construct new command line interpreter context.

virtual PCLI::Context::~Context (  )  [virtual]

Destroy command line interpreter context. This will close and wait for threads to exit.


Member Function Documentation

virtual PBoolean PCLI::Context::Write ( const void *  buf,
PINDEX  len 
) [virtual]

Low level write to the channel. This function will block until the requested number of characters are written or the write timeout is reached. The GetLastWriteCount() function returns the actual number of bytes written.

This translate new line character ('
') to be the text string in PCLI::m_newLine.

The GetErrorCode() function should be consulted after Write() returns PFalse to determine what caused the failure.

Returns:
PTrue if at least len bytes were written to the channel.
Parameters:
buf  Pointer to a block of memory to write.
len  Number of bytes to write.

Reimplemented from PIndirectChannel.

bool PCLI::Context::Start (  ) 

Start a command line interpreter thread.

void PCLI::Context::Stop (  ) 

Stop command line interpreter context. This will close the channel and wait for threads to exit.

virtual void PCLI::Context::OnStart (  )  [virtual]

Call back frunction for when context is started. This is usually called from within a background thread.

The default behaviour displays the prompt.

virtual void PCLI::Context::OnStop (  )  [virtual]

Callback for when context is stopping. This is usually called from within a background thread.

The default behaviour does nothing.

virtual bool PCLI::Context::ReadAndProcessInput (  )  [virtual]

Read a character from the attached channel an process. If the character was successfully read then ProcessInput() is called.

virtual void PCLI::Context::ProcessInput ( char  ch  )  [virtual]

Process a character read from the channel.

virtual void PCLI::Context::OnCompletedLine (  )  [virtual]

Call back for a command line was completed and ENTER pressed. The default behaviour processes the line into a PArgList and deals with the command history and help.

Control is then passed on to PCLI::OnReceivedLine().

PCLI& PCLI::Context::GetCLI (  )  const [inline]

Get the CLI.

bool PCLI::Context::IsProcessingCommand (  )  const [inline]

Indicate is currently processing a command.

PCLI::Context::PDECLARE_NOTIFIER ( PThread  ,
Context  ,
ThreadMain   
) [protected]


Member Data Documentation

PCLI& PCLI::Context::m_cli [protected]

PString PCLI::Context::m_commandLine [protected]

bool PCLI::Context::m_ignoreNextLF [protected]

PStringList PCLI::Context::m_commandHistory [protected]

PThread* PCLI::Context::m_thread [protected]

bool PCLI::Context::m_processingCommand [protected]


The documentation for this class was generated from the following file:
Generated on Mon Aug 3 20:41:53 2009 for PTLib by  doxygen 1.5.1