Planeshift
ServerConsole Class Reference

This class is implements the user input and output console for the server. More...

#include <serverconsole.h>

Public Member Functions

void MainLoop ()
 The main server console loop. More...
 
void Run ()
 Starts the server console, first looking if there's a script passed via -run=file on the command line, then entering the main loop. More...
 
 ServerConsole (iObjectRegistry *oreg, const char *appname, const char *prompt)
 
void SetCommandCatcher (iCommandCatcher *cmdcatch)
 
 ~ServerConsole ()
 

Static Public Member Functions

static void ExecuteScript (const char *script)
 Executes a script of commands. More...
 
- Static Public Member Functions inherited from ConsoleOut
static ConsoleOutMsgClass GetMaximumOutputClassFile ()
 
static ConsoleOutMsgClass GetMaximumOutputClassStdout ()
 
static void Intern_Printf (ConsoleOutMsgClass con, const char *arg,...)
 Used to print things to the console. More...
 
static void Intern_Printf_LogOnly (ConsoleOutMsgClass con, const char *arg,...)
 Used to print things to the console. More...
 
static void Intern_VPrintf (ConsoleOutMsgClass con, const char *arg, va_list ap)
 Used to print things to the console. More...
 
static void Intern_VPrintf_LogOnly (ConsoleOutMsgClass con, const char *arg, va_list args)
 Used to print things to the console. More...
 
static void SetMaximumOutputClassFile (ConsoleOutMsgClass con)
 Set the maximum message class that we want to show on the output file. More...
 
static void SetMaximumOutputClassStdout (ConsoleOutMsgClass con)
 Set the maximum message class that we want to show on standard output. More...
 
static void SetOutputFile (const char *filename, bool append)
 Setup the console to additionally write to some file instead of only stdout. More...
 
static void SetPrompt (const char *format,...)
 Set the prompt to be used for stdout. More...
 
static void SetStringBuffer (csString *buffer)
 Set or clear the string buffer. More...
 
static void Shift ()
 
static void Unshift ()
 

Static Public Attributes

static const char * prompt
 Holds the prompt. More...
 
- Static Public Attributes inherited from ConsoleOut
static bool atStartOfLine
 
static bool promptDisplayed
 
static int shift
 
static csString * strBuffer
 

Protected Attributes

const char * appname
 The name of this application. Only used for printing & readline. More...
 
iCommandCatchercmdcatcher
 CommandCatcher intercepts typed commands without processing them here. More...
 
iObjectRegistry * objreg
 
bool stop
 If true, the server is shutting down, and the main loop should stop. More...
 
csRef< CS::Threading::Thread > thread
 The server console runs in its own thread. More...
 

Detailed Description

This class is implements the user input and output console for the server.

Definition at line 67 of file serverconsole.h.

Constructor & Destructor Documentation

ServerConsole::ServerConsole ( iObjectRegistry *  oreg,
const char *  appname,
const char *  prompt 
)
ServerConsole::~ServerConsole ( )

Member Function Documentation

static void ServerConsole::ExecuteScript ( const char *  script)
static

Executes a script of commands.

The script is passed in as a char array buffer (NOT a filename). This function goes through the char array script line at a time and executes the given server command. It also allows for commenting the script using the #comment...

void ServerConsole::MainLoop ( )

The main server console loop.

This waits for a user to enter a line of data and executes the command that the user entered.

void ServerConsole::Run ( )

Starts the server console, first looking if there's a script passed via -run=file on the command line, then entering the main loop.

void ServerConsole::SetCommandCatcher ( iCommandCatcher cmdcatch)
inline

Definition at line 97 of file serverconsole.h.

Member Data Documentation

const char* ServerConsole::appname
protected

The name of this application. Only used for printing & readline.

Definition at line 107 of file serverconsole.h.

iCommandCatcher* ServerConsole::cmdcatcher
protected

CommandCatcher intercepts typed commands without processing them here.

Definition at line 116 of file serverconsole.h.

iObjectRegistry* ServerConsole::objreg
protected

Definition at line 118 of file serverconsole.h.

const char* ServerConsole::prompt
static

Holds the prompt.

Definition at line 103 of file serverconsole.h.

bool ServerConsole::stop
protected

If true, the server is shutting down, and the main loop should stop.

Definition at line 113 of file serverconsole.h.

csRef<CS::Threading::Thread> ServerConsole::thread
protected

The server console runs in its own thread.

Definition at line 110 of file serverconsole.h.


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