xoreos  0.0.5
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Engines::Console Class Reference

#include <console.h>

Inheritance diagram for Engines::Console:
Inheritance graph
[legend]
Collaboration diagram for Engines::Console:
Collaboration graph
[legend]

Classes

struct  Command
 
struct  CommandLine
 

Public Member Functions

 Console (Engine &engine, const Common::UString &font, int fontHeight=0)
 
virtual ~Console ()
 
void show ()
 
void hide ()
 
bool isVisible () const
 
float getWidth () const
 
float getHeight () const
 
size_t getLines () const
 
size_t getColumns () const
 
bool processEvent (const Events::Event &event)
 
void disableCommand (const Common::UString &cmd, const Common::UString &reason="")
 
void enableCommand (const Common::UString &cmd)
 
void clear ()
 
void print (const Common::UString &line)
 
void printf (const char *s,...) GCC_PRINTF(2
 

Protected Types

typedef boost::function< void(const CommandLine &cl)> CommandCallback
 

Protected Member Functions

void printException (Common::Exception &e, const Common::UString &prefix="ERROR: ")
 
bool registerCommand (const Common::UString &cmd, const CommandCallback &callback, const Common::UString &help)
 
void printCommandHelp (const Common::UString &cmd)
 
void printList (const std::vector< Common::UString > &list, size_t maxSize=0)
 
void setArguments (const Common::UString &cmd, const std::vector< Common::UString > &args)
 
void setArguments (const Common::UString &cmd)
 
virtual void updateCaches ()
 
virtual void showCallback ()
 

Static Protected Member Functions

static void splitArguments (Common::UString argLine, std::vector< Common::UString > &args)
 

Private Types

typedef std::map< Common::UString, Command, Common::UString::ilessCommandMap
 

Private Member Functions

void updateVideos ()
 
void updateSounds ()
 
void cmdHelp (const CommandLine &cl)
 
void cmdClear (const CommandLine &cl)
 
void cmdClose (const CommandLine &cl)
 
void cmdQuit (const CommandLine &cl)
 
void cmdDumpResList (const CommandLine &cl)
 
void cmdDumpRes (const CommandLine &cl)
 
void cmdDumpTGA (const CommandLine &cl)
 
void cmdDump2DA (const CommandLine &cl)
 
void cmdDumpAll2DA (const CommandLine &cl)
 
void cmdListVideos (const CommandLine &cl)
 
void cmdPlayVideo (const CommandLine &cl)
 
void cmdListSounds (const CommandLine &cl)
 
void cmdPlaySound (const CommandLine &cl)
 
void cmdSilence (const CommandLine &cl)
 
void cmdGetOption (const CommandLine &cl)
 
void cmdSetOption (const CommandLine &cl)
 
void cmdShowFPS (const CommandLine &cl)
 
void cmdListLangs (const CommandLine &cl)
 
void cmdGetLang (const CommandLine &cl)
 
void cmdSetLang (const CommandLine &cl)
 
void cmdGetString (const CommandLine &cl)
 
void cmdGetCamera (const CommandLine &cl)
 
void cmdSetCamera (const CommandLine &cl)
 
void updateHelpArguments ()
 
void printFullHelp ()
 
bool printHints (const Common::UString &command)
 
void execute (const Common::UString &line)
 

Private Attributes

Engine_engine
 
bool _neverShown
 
bool _visible
 
Common::ScopedPtr< Common::ReadLine_readLine
 
Common::ScopedPtr< ConsoleWindow_console
 
CommandMap _commands
 
size_t _tabCount
 
bool _printedCompleteWarning
 
int8 _lastClickCount
 
uint8 _lastClickButton
 
uint32 _lastClickTime
 
ptrdiff_t _lastClickX
 
ptrdiff_t _lastClickY
 
std::vector< Common::UString_videos
 
std::vector< Common::UString_sounds
 
size_t _maxSizeVideos
 
size_t _maxSizeSounds
 

Detailed Description

Definition at line 190 of file console.h.

Member Typedef Documentation

◆ CommandCallback

typedef boost::function<void (const CommandLine &cl)> Engines::Console::CommandCallback
protected

Definition at line 221 of file console.h.

◆ CommandMap

Definition at line 252 of file console.h.

Constructor & Destructor Documentation

◆ Console()

Engines::Console::Console ( Engine engine,
const Common::UString font,
int  fontHeight = 0 
)

◆ ~Console()

Engines::Console::~Console ( )
virtual

Member Function Documentation

◆ clear()

void Engines::Console::clear ( )

Definition at line 1085 of file console.cpp.

References _console.

Referenced by cmdClear(), and processEvent().

Here is the caller graph for this function:

◆ cmdClear()

void Engines::Console::cmdClear ( const CommandLine cl)
private

Definition at line 1172 of file console.cpp.

References clear().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdClose()

void Engines::Console::cmdClose ( const CommandLine cl)
private

Definition at line 1176 of file console.cpp.

References hide().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdDump2DA()

void Engines::Console::cmdDump2DA ( const CommandLine cl)
private

Definition at line 1227 of file console.cpp.

References Engines::Console::CommandLine::args, Common::UString::c_str(), Engines::Console::CommandLine::cmd, Engines::dump2DA(), Common::UString::empty(), Common::FilePath::getUserDataFile(), printCommandHelp(), and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdDumpAll2DA()

void Engines::Console::cmdDumpAll2DA ( const CommandLine cl)
private

Definition at line 1241 of file console.cpp.

References Common::UString::c_str(), Engines::dump2DA(), Common::FilePath::getUserDataFile(), Aurora::kFileType2DA, printf(), and ResMan.

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdDumpRes()

void Engines::Console::cmdDumpRes ( const CommandLine cl)
private

Definition at line 1199 of file console.cpp.

References Engines::Console::CommandLine::args, Common::UString::c_str(), Engines::Console::CommandLine::cmd, Engines::dumpResource(), Common::UString::empty(), Common::FilePath::getUserDataFile(), printCommandHelp(), and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdDumpResList()

void Engines::Console::cmdDumpResList ( const CommandLine cl)
private

Definition at line 1185 of file console.cpp.

References Engines::Console::CommandLine::args, Common::UString::c_str(), Engines::Console::CommandLine::cmd, Engines::dumpResList(), Common::UString::empty(), Common::FilePath::getUserDataFile(), printCommandHelp(), and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdDumpTGA()

void Engines::Console::cmdDumpTGA ( const CommandLine cl)
private

Definition at line 1213 of file console.cpp.

References Engines::Console::CommandLine::args, Common::UString::c_str(), Engines::Console::CommandLine::cmd, Engines::dumpTGA(), Common::UString::empty(), Common::FilePath::getUserDataFile(), printCommandHelp(), and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdGetCamera()

void Engines::Console::cmdGetCamera ( const CommandLine cl)
private

Definition at line 1418 of file console.cpp.

References CameraMan, and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdGetLang()

void Engines::Console::cmdGetLang ( const CommandLine cl)
private

Definition at line 1351 of file console.cpp.

References _engine, Engines::Engine::getLanguage(), LangMan, and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdGetOption()

void Engines::Console::cmdGetOption ( const CommandLine cl)
private

Definition at line 1288 of file console.cpp.

References Engines::Console::CommandLine::args, Engines::Console::CommandLine::cmd, ConfigMan, printCommandHelp(), printf(), and splitArguments().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdGetString()

void Engines::Console::cmdGetString ( const CommandLine cl)
private

Definition at line 1401 of file console.cpp.

References Engines::Console::CommandLine::args, Engines::Console::CommandLine::cmd, Common::UString::empty(), Common::parseString(), printCommandHelp(), printf(), and TalkMan.

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdHelp()

void Engines::Console::cmdHelp ( const CommandLine cl)
private

Definition at line 1163 of file console.cpp.

References Engines::Console::CommandLine::args, Common::UString::empty(), printCommandHelp(), and printFullHelp().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdListLangs()

void Engines::Console::cmdListLangs ( const CommandLine cl)
private

Definition at line 1325 of file console.cpp.

References _engine, Engines::Engine::detectLanguages(), LangMan, and printf().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdListSounds()

void Engines::Console::cmdListSounds ( const CommandLine cl)
private

Definition at line 1270 of file console.cpp.

References _maxSizeSounds, _sounds, printList(), and updateSounds().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdListVideos()

void Engines::Console::cmdListVideos ( const CommandLine cl)
private

Definition at line 1256 of file console.cpp.

References _maxSizeVideos, _videos, printList(), and updateVideos().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdPlaySound()

void Engines::Console::cmdPlaySound ( const CommandLine cl)
private

Definition at line 1275 of file console.cpp.

References Engines::Console::CommandLine::args, Engines::Console::CommandLine::cmd, Common::UString::empty(), Sound::kSoundTypeSFX, Engines::playSound(), and printCommandHelp().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdPlayVideo()

void Engines::Console::cmdPlayVideo ( const CommandLine cl)
private

Definition at line 1261 of file console.cpp.

References Engines::Console::CommandLine::args, Engines::Console::CommandLine::cmd, Common::UString::empty(), Engines::playVideo(), and printCommandHelp().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdQuit()

void Engines::Console::cmdQuit ( const CommandLine cl)
private

Definition at line 1180 of file console.cpp.

References EventMan, and print().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdSetCamera()

void Engines::Console::cmdSetCamera ( const CommandLine cl)
private

Definition at line 1426 of file console.cpp.

References Engines::Console::CommandLine::args, CameraMan, Engines::Console::CommandLine::cmd, Common::parseString(), printCommandHelp(), and splitArguments().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdSetLang()

void Engines::Console::cmdSetLang ( const CommandLine cl)
private

Definition at line 1362 of file console.cpp.

References _engine, Engines::Console::CommandLine::args, Engines::Engine::changeLanguage(), Engines::Console::CommandLine::cmd, ConfigMan, Engines::Engine::getLanguage(), LangMan, printCommandHelp(), printf(), and splitArguments().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdSetOption()

void Engines::Console::cmdSetOption ( const CommandLine cl)
private

Definition at line 1300 of file console.cpp.

References _engine, Engines::Console::CommandLine::args, Engines::Console::CommandLine::cmd, ConfigMan, printCommandHelp(), printf(), Engines::Engine::showFPS(), and splitArguments().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdShowFPS()

void Engines::Console::cmdShowFPS ( const CommandLine cl)
private

Definition at line 1315 of file console.cpp.

References _engine, Engines::Console::CommandLine::args, Engines::Console::CommandLine::cmd, ConfigMan, Common::UString::empty(), printCommandHelp(), and Engines::Engine::showFPS().

Referenced by Console().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdSilence()

void Engines::Console::cmdSilence ( const CommandLine cl)
private

Definition at line 1284 of file console.cpp.

References SoundMan.

Referenced by Console().

Here is the caller graph for this function:

◆ disableCommand()

void Engines::Console::disableCommand ( const Common::UString cmd,
const Common::UString reason = "" 
)

Definition at line 972 of file console.cpp.

References _commands, and Common::UString::c_str().

Referenced by Engines::KotOR2::Game::mainMenu(), Engines::KotOR::Game::mainMenu(), Engines::Jade::Game::mainMenu(), and Engines::NWN::Game::mainMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enableCommand()

void Engines::Console::enableCommand ( const Common::UString cmd)

Definition at line 983 of file console.cpp.

References _commands, and Common::UString::c_str().

Referenced by Engines::KotOR2::Game::mainMenu(), Engines::KotOR::Game::mainMenu(), Engines::Jade::Game::mainMenu(), and Engines::NWN::Game::mainMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute()

void Engines::Console::execute ( const Common::UString line)
private

Definition at line 993 of file console.cpp.

References _commands, _console, Engines::Console::CommandLine::args, Common::UString::c_str(), Engines::Console::CommandLine::cmd, Common::UString::empty(), Common::UString::findFirst(), kPrompt, printf(), Common::UString::split(), and Common::UString::trim().

Referenced by processEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getColumns()

size_t Engines::Console::getColumns ( ) const

Definition at line 813 of file console.cpp.

References _console.

Referenced by printHints(), and printList().

Here is the caller graph for this function:

◆ getHeight()

float Engines::Console::getHeight ( ) const

Definition at line 805 of file console.cpp.

References _console.

◆ getLines()

size_t Engines::Console::getLines ( ) const

Definition at line 809 of file console.cpp.

References _console.

◆ getWidth()

float Engines::Console::getWidth ( ) const

Definition at line 801 of file console.cpp.

References _console.

◆ hide()

void Engines::Console::hide ( )

◆ isVisible()

bool Engines::Console::isVisible ( ) const

◆ print()

void Engines::Console::print ( const Common::UString line)

Definition at line 1089 of file console.cpp.

References _console.

Referenced by Engines::NWN::Console::cmdListCampaigns(), cmdQuit(), printCommandHelp(), printException(), printf(), printFullHelp(), and printList().

Here is the caller graph for this function:

◆ printCommandHelp()

void Engines::Console::printCommandHelp ( const Common::UString cmd)
protected

◆ printException()

void Engines::Console::printException ( Common::Exception e,
const Common::UString prefix = "ERROR: " 
)
protected

Definition at line 1104 of file console.cpp.

References Common::UString::c_str(), Common::StackException::getStack(), print(), and printf().

Here is the call graph for this function:

◆ printf()

void Engines::Console::printf ( const char *  s,
  ... 
)

Definition at line 1093 of file console.cpp.

References print(), and STRINGBUFLEN.

Referenced by cmdDump2DA(), cmdDumpAll2DA(), cmdDumpRes(), cmdDumpResList(), cmdDumpTGA(), cmdGetCamera(), cmdGetLang(), cmdGetOption(), Engines::KotOR::Console::cmdGetPCRoom(), Engines::KotOR2::Console::cmdGetPCRoom(), cmdGetString(), Engines::Sonic::Console::cmdGotoArea(), Engines::NWN2::Console::cmdGotoArea(), Engines::Witcher::Console::cmdGotoArea(), Engines::NWN::Console::cmdGotoArea(), Engines::DragonAge::Console::cmdListAreas(), Engines::DragonAge2::Console::cmdListAreas(), Engines::Sonic::Console::cmdListAreas(), Engines::NWN2::Console::cmdListAreas(), Engines::Witcher::Console::cmdListAreas(), Engines::NWN::Console::cmdListAreas(), Engines::DragonAge::Console::cmdListCampaigns(), Engines::DragonAge2::Console::cmdListCampaigns(), Engines::NWN2::Console::cmdListCampaigns(), Engines::Witcher::Console::cmdListCampaigns(), cmdListLangs(), Engines::KotOR::Console::cmdListModules(), Engines::KotOR2::Console::cmdListModules(), Engines::NWN2::Console::cmdListModules(), Engines::Witcher::Console::cmdListModules(), Engines::KotOR2::Console::cmdListRoomsVisibleFrom(), Engines::KotOR::Console::cmdListRoomsVisibleFrom(), Engines::DragonAge::Console::cmdLoadArea(), Engines::DragonAge2::Console::cmdLoadArea(), Engines::DragonAge2::Console::cmdLoadCampaign(), Engines::DragonAge::Console::cmdLoadCampaign(), Engines::NWN2::Console::cmdLoadCampaign(), Engines::NWN::Console::cmdLoadCampaign(), Engines::Witcher::Console::cmdLoadCampaign(), Engines::Jade::Console::cmdLoadModule(), Engines::KotOR::Console::cmdLoadModule(), Engines::KotOR2::Console::cmdLoadModule(), Engines::NWN2::Console::cmdLoadModule(), Engines::Witcher::Console::cmdLoadModule(), Engines::NWN::Console::cmdLoadModule(), cmdSetLang(), cmdSetOption(), Engines::NWN2::Module::enter(), Engines::KotOR2::Module::enter(), Engines::Jade::Module::enter(), Engines::Witcher::Module::enter(), Engines::NWN::Module::enter(), Engines::KotOR::Module::enter(), Engines::Witcher::Module::enterArea(), Engines::NWN2::Module::enterArea(), Engines::NWN::Module::enterArea(), execute(), printException(), and printHints().

Here is the call graph for this function:

◆ printFullHelp()

void Engines::Console::printFullHelp ( )
private

Definition at line 1463 of file console.cpp.

References _commands, MAX(), print(), and printList().

Referenced by cmdHelp(), and printCommandHelp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printHints()

bool Engines::Console::printHints ( const Common::UString command)
private

Definition at line 1052 of file console.cpp.

References _console, _printedCompleteWarning, _readLine, _tabCount, getColumns(), kConsoleLines, kPrompt, printf(), and printList().

Referenced by processEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printList()

void Engines::Console::printList ( const std::vector< Common::UString > &  list,
size_t  maxSize = 0 
)
protected

◆ processEvent()

bool Engines::Console::processEvent ( const Events::Event event)

◆ registerCommand()

bool Engines::Console::registerCommand ( const Common::UString cmd,
const CommandCallback callback,
const Common::UString help 
)
protected

◆ setArguments() [1/2]

void Engines::Console::setArguments ( const Common::UString cmd,
const std::vector< Common::UString > &  args 
)
protected

◆ setArguments() [2/2]

void Engines::Console::setArguments ( const Common::UString cmd)
protected

Definition at line 1569 of file console.cpp.

References _readLine.

◆ show()

void Engines::Console::show ( )

◆ showCallback()

void Engines::Console::showCallback ( )
protectedvirtual

Definition at line 1573 of file console.cpp.

Referenced by show().

Here is the caller graph for this function:

◆ splitArguments()

void Engines::Console::splitArguments ( Common::UString  argLine,
std::vector< Common::UString > &  args 
)
staticprotected

Definition at line 1539 of file console.cpp.

References Common::UString::begin(), and Common::UString::end().

Referenced by cmdGetOption(), Engines::NWN2::Console::cmdMove(), Engines::Witcher::Console::cmdMove(), cmdSetCamera(), cmdSetLang(), and cmdSetOption().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateCaches()

void Engines::Console::updateCaches ( )
protectedvirtual

◆ updateHelpArguments()

void Engines::Console::updateHelpArguments ( )
private

Definition at line 1600 of file console.cpp.

References _commands, and _readLine.

Referenced by registerCommand().

Here is the caller graph for this function:

◆ updateSounds()

void Engines::Console::updateSounds ( )
private

Definition at line 1145 of file console.cpp.

References _maxSizeSounds, _sounds, Aurora::kFileTypeWAV, MAX(), ResMan, and setArguments().

Referenced by cmdListSounds(), and updateCaches().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateVideos()

void Engines::Console::updateVideos ( )
private

Definition at line 1127 of file console.cpp.

References _maxSizeVideos, _videos, Aurora::kResourceVideo, MAX(), ResMan, and setArguments().

Referenced by cmdListVideos(), and updateCaches().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _commands

CommandMap Engines::Console::_commands
private

◆ _console

Common::ScopedPtr<ConsoleWindow> Engines::Console::_console
private

◆ _engine

Engine* Engines::Console::_engine
private

Definition at line 255 of file console.h.

Referenced by cmdGetLang(), cmdListLangs(), cmdSetLang(), cmdSetOption(), and cmdShowFPS().

◆ _lastClickButton

uint8 Engines::Console::_lastClickButton
private

Definition at line 269 of file console.h.

Referenced by processEvent().

◆ _lastClickCount

int8 Engines::Console::_lastClickCount
private

Definition at line 268 of file console.h.

Referenced by processEvent().

◆ _lastClickTime

uint32 Engines::Console::_lastClickTime
private

Definition at line 270 of file console.h.

Referenced by processEvent().

◆ _lastClickX

ptrdiff_t Engines::Console::_lastClickX
private

Definition at line 272 of file console.h.

Referenced by processEvent().

◆ _lastClickY

ptrdiff_t Engines::Console::_lastClickY
private

Definition at line 273 of file console.h.

Referenced by processEvent().

◆ _maxSizeSounds

size_t Engines::Console::_maxSizeSounds
private

Definition at line 280 of file console.h.

Referenced by cmdListSounds(), and updateSounds().

◆ _maxSizeVideos

size_t Engines::Console::_maxSizeVideos
private

Definition at line 279 of file console.h.

Referenced by cmdListVideos(), and updateVideos().

◆ _neverShown

bool Engines::Console::_neverShown
private

Definition at line 257 of file console.h.

Referenced by show().

◆ _printedCompleteWarning

bool Engines::Console::_printedCompleteWarning
private

Definition at line 266 of file console.h.

Referenced by printHints(), and processEvent().

◆ _readLine

Common::ScopedPtr<Common::ReadLine> Engines::Console::_readLine
private

◆ _sounds

std::vector<Common::UString> Engines::Console::_sounds
private

Definition at line 277 of file console.h.

Referenced by cmdListSounds(), and updateSounds().

◆ _tabCount

size_t Engines::Console::_tabCount
private

Definition at line 265 of file console.h.

Referenced by printHints(), and processEvent().

◆ _videos

std::vector<Common::UString> Engines::Console::_videos
private

Definition at line 276 of file console.h.

Referenced by cmdListVideos(), and updateVideos().

◆ _visible

bool Engines::Console::_visible
private

Definition at line 258 of file console.h.

Referenced by hide(), isVisible(), and show().


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