DDraceNetwork Docs
CConsole Class Reference

#include <console.h>

Inheritance diagram for CConsole:
[legend]
Collaboration diagram for CConsole:
[legend]

Classes

class  CChain
 
class  CCommand
 
class  CExecFile
 
class  CExecutionQueueEntry
 
class  CResult
 

Public Member Functions

 CConsole (int FlagMask)
 
 ~CConsole ()
 
void Init () override
 
const CCommandInfoFirstCommandInfo (int AccessLevel, int FlagMask) const override
 
const CCommandInfoGetCommandInfo (const char *pName, int FlagMask, bool Temp) override
 
int PossibleCommands (const char *pStr, int FlagMask, bool Temp, FPossibleCallback pfnCallback, void *pUser) override
 
void ParseArguments (int NumArgs, const char **ppArguments) override
 
void Register (const char *pName, const char *pParams, int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp) override
 
void RegisterTemp (const char *pName, const char *pParams, int Flags, const char *pHelp) override
 
void DeregisterTemp (const char *pName) override
 
void DeregisterTempAll () override
 
void Chain (const char *pName, FChainCommandCallback pfnChainFunc, void *pUser) override
 
void StoreCommands (bool Store) override
 
bool LineIsValid (const char *pStr) override
 
void ExecuteLine (const char *pStr, int ClientId=-1, bool InterpretSemicolons=true) override
 
void ExecuteLineFlag (const char *pStr, int FlagMask, int ClientId=-1, bool InterpretSemicolons=true) override
 
bool ExecuteFile (const char *pFilename, int ClientId=-1, bool LogFailure=false, int StorageType=IStorage::TYPE_ALL) override
 
void Print (int Level, const char *pFrom, const char *pStr, ColorRGBA PrintColor=gs_ConsoleDefaultColor) const override
 
void SetTeeHistorianCommandCallback (FTeeHistorianCommandCallback pfnCallback, void *pUser) override
 
void SetUnknownCommandCallback (FUnknownCommandCallback pfnCallback, void *pUser) override
 
void InitChecksum (CChecksumData *pData) const override
 
void SetAccessLevel (int AccessLevel) override
 
bool Cheated () const override
 
int FlagMask () const override
 
void SetFlagMask (int FlagMask) override
 
virtual void Init ()=0
 
virtual const CCommandInfoFirstCommandInfo (int AccessLevel, int Flagmask) const =0
 
virtual const CCommandInfoGetCommandInfo (const char *pName, int FlagMask, bool Temp)=0
 
virtual int PossibleCommands (const char *pStr, int FlagMask, bool Temp, FPossibleCallback pfnCallback=EmptyPossibleCommandCallback, void *pUser=nullptr)=0
 
virtual void ParseArguments (int NumArgs, const char **ppArguments)=0
 
virtual void Register (const char *pName, const char *pParams, int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp)=0
 
virtual void RegisterTemp (const char *pName, const char *pParams, int Flags, const char *pHelp)=0
 
virtual void DeregisterTemp (const char *pName)=0
 
virtual void DeregisterTempAll ()=0
 
virtual void Chain (const char *pName, FChainCommandCallback pfnChainFunc, void *pUser)=0
 
virtual void StoreCommands (bool Store)=0
 
virtual bool LineIsValid (const char *pStr)=0
 
virtual void ExecuteLine (const char *pStr, int ClientId=-1, bool InterpretSemicolons=true)=0
 
virtual void ExecuteLineFlag (const char *pStr, int FlasgMask, int ClientId=-1, bool InterpretSemicolons=true)=0
 
virtual void ExecuteLineStroked (int Stroke, const char *pStr, int ClientId=-1, bool InterpretSemicolons=true)=0
 
virtual bool ExecuteFile (const char *pFilename, int ClientId=-1, bool LogFailure=false, int StorageType=IStorage::TYPE_ALL)=0
 
virtual void Print (int Level, const char *pFrom, const char *pStr, ColorRGBA PrintColor=gs_ConsoleDefaultColor) const =0
 
virtual void SetTeeHistorianCommandCallback (FTeeHistorianCommandCallback pfnCallback, void *pUser)=0
 
virtual void SetUnknownCommandCallback (FUnknownCommandCallback pfnCallback, void *pUser)=0
 
virtual void InitChecksum (CChecksumData *pData) const =0
 
virtual void SetAccessLevel (int AccessLevel)=0
 
virtual bool Cheated () const =0
 
virtual int FlagMask () const =0
 
virtual void SetFlagMask (int FlagMask)=0
 
- Public Member Functions inherited from IInterface
 IInterface ()
 
virtual void Shutdown ()
 
virtual ~IInterface ()
 

Static Public Member Functions

static void ConUserCommandStatus (IConsole::IResult *pResult, void *pUser)
 
- Static Public Member Functions inherited from IConsole
static const char * InterfaceName ()
 
static void EmptyPossibleCommandCallback (int Index, const char *pCmd, void *pUser)
 
static bool EmptyUnknownCommandCallback (const char *pCommand, void *pUser)
 
static LEVEL ToLogLevel (int ConsoleLevel)
 
static int ToLogLevelFilter (int ConsoleLevel)
 

Private Types

enum  { CONSOLE_MAX_STR_LENGTH = 8192 , MAX_PARTS = (CONSOLE_MAX_STR_LENGTH + 1) / 2 }
 
enum  { PARSEARGS_OK = 0 , PARSEARGS_MISSING_VALUE , PARSEARGS_INVALID_INTEGER , PARSEARGS_INVALID_FLOAT }
 

Private Member Functions

void ExecuteLineStroked (int Stroke, const char *pStr, int ClientId=-1, bool InterpretSemicolons=true) override
 
int ParseStart (CResult *pResult, const char *pString, int Length)
 
int ParseArgs (CResult *pResult, const char *pFormat, bool IsColor=false)
 
char NextParam (const char *&pFormat)
 
void AddCommandSorted (CCommand *pCommand)
 
CCommandFindCommand (const char *pName, int FlagMask)
 

Static Private Member Functions

static void TraverseChain (FCommandCallback *ppfnCallback, void **ppUserData)
 
static void Con_Chain (IResult *pResult, void *pUserData)
 
static void Con_Echo (IResult *pResult, void *pUserData)
 
static void Con_Exec (IResult *pResult, void *pUserData)
 
static void ConCommandAccess (IResult *pResult, void *pUser)
 
static void ConCommandStatus (IConsole::IResult *pResult, void *pUser)
 

Private Attributes

int m_FlagMask
 
bool m_StoreCommands
 
const char * m_apStrokeStr [2]
 
CCommandm_pFirstCommand
 
CExecFilem_pFirstExec
 
IStoragem_pStorage
 
int m_AccessLevel
 
CCommandm_pRecycleList
 
CHeap m_TempCommands
 
FTeeHistorianCommandCallback m_pfnTeeHistorianCommandCallback
 
void * m_pTeeHistorianCommandUserdata
 
FUnknownCommandCallback m_pfnUnknownCommandCallback = EmptyUnknownCommandCallback
 
void * m_pUnknownCommandUserdata = nullptr
 
std::vector< CExecutionQueueEntrym_vExecutionQueue
 
bool m_Cheated
 

Additional Inherited Members

- Public Types inherited from IConsole
enum  {
  OUTPUT_LEVEL_STANDARD = 0 , OUTPUT_LEVEL_ADDINFO , OUTPUT_LEVEL_DEBUG , ACCESS_LEVEL_ADMIN = 0 ,
  ACCESS_LEVEL_MOD , ACCESS_LEVEL_HELPER , ACCESS_LEVEL_USER , TEMPCMD_NAME_LENGTH = 64 ,
  TEMPCMD_HELP_LENGTH = 192 , TEMPCMD_PARAMS_LENGTH = 96 , CMDLINE_LENGTH = 512 , CLIENT_ID_GAME = -2 ,
  CLIENT_ID_NO_GAME = -3
}
 
typedef void(* FTeeHistorianCommandCallback) (int ClientId, int FlagMask, const char *pCmd, IResult *pResult, void *pUser)
 
typedef void(* FPossibleCallback) (int Index, const char *pCmd, void *pUser)
 
typedef void(* FCommandCallback) (IResult *pResult, void *pUserData)
 
typedef void(* FChainCommandCallback) (IResult *pResult, void *pUserData, FCommandCallback pfnCallback, void *pCallbackUserData)
 
typedef bool(* FUnknownCommandCallback) (const char *pCommand, void *pUser)
 
- Protected Member Functions inherited from IInterface
IKernelKernel ()
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
CONSOLE_MAX_STR_LENGTH 
MAX_PARTS 

◆ anonymous enum

anonymous enum
private
Enumerator
PARSEARGS_OK 
PARSEARGS_MISSING_VALUE 
PARSEARGS_INVALID_INTEGER 
PARSEARGS_INVALID_FLOAT 

Constructor & Destructor Documentation

◆ CConsole()

CConsole::CConsole ( int  FlagMask)

◆ ~CConsole()

CConsole::~CConsole ( )

Member Function Documentation

◆ AddCommandSorted()

void CConsole::AddCommandSorted ( CCommand pCommand)
private

◆ Chain()

void CConsole::Chain ( const char *  pName,
FChainCommandCallback  pfnChainFunc,
void *  pUser 
)
overridevirtual

Implements IConsole.

◆ Cheated()

bool CConsole::Cheated ( ) const
inlineoverridevirtual

Implements IConsole.

◆ Con_Chain()

void CConsole::Con_Chain ( IResult pResult,
void *  pUserData 
)
staticprivate

◆ Con_Echo()

void CConsole::Con_Echo ( IResult pResult,
void *  pUserData 
)
staticprivate

◆ Con_Exec()

void CConsole::Con_Exec ( IResult pResult,
void *  pUserData 
)
staticprivate

◆ ConCommandAccess()

void CConsole::ConCommandAccess ( IResult pResult,
void *  pUser 
)
staticprivate

◆ ConCommandStatus()

void CConsole::ConCommandStatus ( IConsole::IResult pResult,
void *  pUser 
)
staticprivate

◆ ConUserCommandStatus()

void CConsole::ConUserCommandStatus ( IConsole::IResult pResult,
void *  pUser 
)
static

◆ DeregisterTemp()

void CConsole::DeregisterTemp ( const char *  pName)
overridevirtual

Implements IConsole.

◆ DeregisterTempAll()

void CConsole::DeregisterTempAll ( )
overridevirtual

Implements IConsole.

◆ ExecuteFile()

bool CConsole::ExecuteFile ( const char *  pFilename,
int  ClientId = -1,
bool  LogFailure = false,
int  StorageType = IStorage::TYPE_ALL 
)
overridevirtual

Implements IConsole.

◆ ExecuteLine()

void CConsole::ExecuteLine ( const char *  pStr,
int  ClientId = -1,
bool  InterpretSemicolons = true 
)
overridevirtual

Implements IConsole.

◆ ExecuteLineFlag()

void CConsole::ExecuteLineFlag ( const char *  pStr,
int  FlagMask,
int  ClientId = -1,
bool  InterpretSemicolons = true 
)
overridevirtual

Implements IConsole.

◆ ExecuteLineStroked()

void CConsole::ExecuteLineStroked ( int  Stroke,
const char *  pStr,
int  ClientId = -1,
bool  InterpretSemicolons = true 
)
overrideprivatevirtual

Implements IConsole.

◆ FindCommand()

CConsole::CCommand * CConsole::FindCommand ( const char *  pName,
int  FlagMask 
)
private

◆ FirstCommandInfo()

const IConsole::CCommandInfo * CConsole::FirstCommandInfo ( int  AccessLevel,
int  FlagMask 
) const
overridevirtual

Implements IConsole.

◆ FlagMask()

int CConsole::FlagMask ( ) const
inlineoverridevirtual

Implements IConsole.

◆ GetCommandInfo()

const IConsole::CCommandInfo * CConsole::GetCommandInfo ( const char *  pName,
int  FlagMask,
bool  Temp 
)
overridevirtual

Implements IConsole.

◆ Init()

void CConsole::Init ( )
overridevirtual

Implements IConsole.

◆ InitChecksum()

void CConsole::InitChecksum ( CChecksumData pData) const
overridevirtual

Implements IConsole.

◆ LineIsValid()

bool CConsole::LineIsValid ( const char *  pStr)
overridevirtual

Implements IConsole.

◆ NextParam()

char CConsole::NextParam ( const char *&  pFormat)
private

◆ ParseArgs()

int CConsole::ParseArgs ( CResult pResult,
const char *  pFormat,
bool  IsColor = false 
)
private

◆ ParseArguments()

void CConsole::ParseArguments ( int  NumArgs,
const char **  ppArguments 
)
overridevirtual

Implements IConsole.

◆ ParseStart()

int CConsole::ParseStart ( CResult pResult,
const char *  pString,
int  Length 
)
private

◆ PossibleCommands()

int CConsole::PossibleCommands ( const char *  pStr,
int  FlagMask,
bool  Temp,
FPossibleCallback  pfnCallback,
void *  pUser 
)
overridevirtual

Implements IConsole.

◆ Print()

void CConsole::Print ( int  Level,
const char *  pFrom,
const char *  pStr,
ColorRGBA  PrintColor = gs_ConsoleDefaultColor 
) const
overridevirtual
Deprecated:
Prefer using the log_* functions from base/log.h instead of this function for the following reasons:
  • They support printf-formatting without a separate buffer.
  • They support all five log levels.
  • They do not require a pointer to IConsole to be used.

Implements IConsole.

◆ Register()

void CConsole::Register ( const char *  pName,
const char *  pParams,
int  Flags,
FCommandCallback  pfnFunc,
void *  pUser,
const char *  pHelp 
)
overridevirtual

Implements IConsole.

◆ RegisterTemp()

void CConsole::RegisterTemp ( const char *  pName,
const char *  pParams,
int  Flags,
const char *  pHelp 
)
overridevirtual

Implements IConsole.

◆ SetAccessLevel()

void CConsole::SetAccessLevel ( int  AccessLevel)
inlineoverridevirtual

Implements IConsole.

◆ SetFlagMask()

void CConsole::SetFlagMask ( int  FlagMask)
inlineoverridevirtual

Implements IConsole.

◆ SetTeeHistorianCommandCallback()

void CConsole::SetTeeHistorianCommandCallback ( FTeeHistorianCommandCallback  pfnCallback,
void *  pUser 
)
overridevirtual

Implements IConsole.

◆ SetUnknownCommandCallback()

void CConsole::SetUnknownCommandCallback ( FUnknownCommandCallback  pfnCallback,
void *  pUser 
)
overridevirtual

Implements IConsole.

◆ StoreCommands()

void CConsole::StoreCommands ( bool  Store)
overridevirtual

Implements IConsole.

◆ TraverseChain()

void CConsole::TraverseChain ( FCommandCallback ppfnCallback,
void **  ppUserData 
)
staticprivate

Member Data Documentation

◆ m_AccessLevel

int CConsole::m_AccessLevel
private

◆ m_apStrokeStr

const char* CConsole::m_apStrokeStr[2]
private

◆ m_Cheated

bool CConsole::m_Cheated
private

◆ m_FlagMask

int CConsole::m_FlagMask
private

◆ m_pFirstCommand

CCommand* CConsole::m_pFirstCommand
private

◆ m_pFirstExec

CExecFile* CConsole::m_pFirstExec
private

◆ m_pfnTeeHistorianCommandCallback

FTeeHistorianCommandCallback CConsole::m_pfnTeeHistorianCommandCallback
private

◆ m_pfnUnknownCommandCallback

FUnknownCommandCallback CConsole::m_pfnUnknownCommandCallback = EmptyUnknownCommandCallback
private

◆ m_pRecycleList

CCommand* CConsole::m_pRecycleList
private

◆ m_pStorage

IStorage* CConsole::m_pStorage
private

◆ m_pTeeHistorianCommandUserdata

void* CConsole::m_pTeeHistorianCommandUserdata
private

◆ m_pUnknownCommandUserdata

void* CConsole::m_pUnknownCommandUserdata = nullptr
private

◆ m_StoreCommands

bool CConsole::m_StoreCommands
private

◆ m_TempCommands

CHeap CConsole::m_TempCommands
private

◆ m_vExecutionQueue

std::vector<CExecutionQueueEntry> CConsole::m_vExecutionQueue
private

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