PixelLightAPI  .
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
PLEngine::SNConsoleBase Class Reference

Abstract console base class. More...

#include <SNConsoleBase.h>

Inheritance diagram for PLEngine::SNConsoleBase:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EState { Active = 0, Inactive = 1, Activating = 2, Deactivating = 3 }
 Console state. More...
enum  EFlags { NoDebugCommands = 1<<10 }
 Scene node flags (SceneNode flags extension) More...

Public Member Functions

PL_API void Deactivate ()
 Deactivates the console.
PL_API EState GetState () const
 Returns the current console state.
PL_API void ClearCommandHistory ()
 Clear the command history.
virtual PL_API PLCore::String GetDescription () const
 Returns the console description.
PL_API bool RegisterCommand (bool bDebug, const PLCore::String &sCommand, const PLCore::String &sParameters, const PLCore::String &sHelp, const PLCore::Functor< void, ConsoleCommand & > &cFunctor)
 Registers a new command.
PL_API bool RegisterCommand (const ConsoleCommand &cCommand)
 Register a new command.
PL_API bool UnRegisterCommand (const PLCore::String &sCommand)
 Unregisters a command.
PL_API void UnRegisterAllCommands ()
 Unregisters all commands.
PL_API PLCore::uint32 GetNumOfCommands () const
 Returns the number of registered commands.
PL_API PLCore::uint32 GetNumOfParamsInString (const PLCore::String &sString) const
 Returns the number of parameters in a given string.
PL_API void ProcessKeyMessage ()
 Process a keyboard message.
PL_API void ProcessCommand (const PLCore::String &sCommand="")
 Process a command.
PL_API void List (bool bDetailed=false)
 Prints a list of all available console commands into the log.

Protected Member Functions

PL_API SNConsoleBase ()
 Default constructor.
virtual PL_API ~SNConsoleBase ()
 Destructor.
PL_API void ProcessCommand (ConsoleCommand &cCommand)
 Process the syntactical correct command.
PL_API void CompleteCommand ()
 Completes the command.

Protected Attributes

EState m_nState
PLCore::String m_sCommand
PLCore::String m_sFoundCommand
PLCore::uint32 m_nCursor
int m_nSelStart
int m_nSelEnd
PLCore::Array< ConsoleCommand * > m_lstCommands
PLCore::HashMap
< PLCore::String,
ConsoleCommand * > 
m_mapCommands
PLCore::uint32 m_nCurrentCommand
PLCore::Array< PLCore::Stringm_lstCommandHistory

Detailed Description

Abstract console base class.


Member Enumeration Documentation

Console state.

Enumerator:
Active 

Console is active

Inactive 

Console is inactive

Activating 

Console is going active

Deactivating 

Console is going inactive

Scene node flags (SceneNode flags extension)

Enumerator:
NoDebugCommands 

Do not allow debug commands

Reimplemented from PLScene::SceneNode.


Constructor & Destructor Documentation

Default constructor.

virtual PL_API PLEngine::SNConsoleBase::~SNConsoleBase ( ) [protected, virtual]

Destructor.


Member Function Documentation

Deactivates the console.

Returns the current console state.

Returns:
Console state

Clear the command history.

virtual PL_API PLCore::String PLEngine::SNConsoleBase::GetDescription ( ) const [virtual]

Returns the console description.

Returns:
Console description

Reimplemented in PLEngine::SNConsole.

PL_API bool PLEngine::SNConsoleBase::RegisterCommand ( bool  bDebug,
const PLCore::String sCommand,
const PLCore::String sParameters,
const PLCore::String sHelp,
const PLCore::Functor< void, ConsoleCommand & > &  cFunctor 
)

Registers a new command.

Parameters:
[in]bDebugDebug command?
[in]sCommandCommand string
[in]sParametersParameter string
[in]sHelpHelp string
[in]cFunctorExecution functor
Remarks:
Example:
RegisterCommand(0, "/fogcolor", "III", "<r> <g> <b>", Functor<void, ConsoleCommand &>(MyCommandFuncton));
Returns:
'true' if all went fine, else 'false'
See also:
PL_API bool PLEngine::SNConsoleBase::RegisterCommand ( const ConsoleCommand cCommand)

Register a new command.

Parameters:
[in]cCommandCommand which should be registered
Returns:
'true' if all went fine, else 'false'
See also:

Unregisters a command.

Parameters:
[in]sCommandCommand to remove
Returns:
'true' if all went fine, else 'false'
Note:
  • eg: "/fogcolor"... this will remove the /fogcolor command

Unregisters all commands.

PL_API PLCore::uint32 PLEngine::SNConsoleBase::GetNumOfCommands ( ) const

Returns the number of registered commands.

Returns:
The number of registered commands
PL_API PLCore::uint32 PLEngine::SNConsoleBase::GetNumOfParamsInString ( const PLCore::String sString) const

Returns the number of parameters in a given string.

Parameters:
[in]sStringThe string which should be checked
Returns:
Number of parameters in the given string
Remarks:
Example: "/fogcolor 100 20 240" will return the value 3

Process a keyboard message.

PL_API void PLEngine::SNConsoleBase::ProcessCommand ( const PLCore::String sCommand = "")

Process a command.

Parameters:
[in]sCommandCommand which should be executed
Note:
  • If 'sCommand' is empty, the console own command line will be executed
PL_API void PLEngine::SNConsoleBase::List ( bool  bDetailed = false)

Prints a list of all available console commands into the log.

Parameters:
[in]bDetailedShould the list have all available information about each command?
PL_API void PLEngine::SNConsoleBase::ProcessCommand ( ConsoleCommand cCommand) [protected]

Process the syntactical correct command.

Parameters:
[in]cCommandThe syntactical correct command
PL_API void PLEngine::SNConsoleBase::CompleteCommand ( ) [protected]

Completes the command.


Member Data Documentation

Current state of console

Current command string

Found command string

PLCore::uint32 PLEngine::SNConsoleBase::m_nCursor [protected]

Current cursor position

Selection cursor start position

Selection cursor end position

The collection of registered commands

Commands hash map

PLCore::uint32 PLEngine::SNConsoleBase::m_nCurrentCommand [protected]

Current selected command entry

Command history list


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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:17
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported