ConsoleUI Class Reference

Back to the index.

Public Member Functions | List of all members
ConsoleUI Class Reference

Text-terminal based User Interface. More...

#include <ConsoleUI.h>

Inheritance diagram for ConsoleUI:
UI ReferenceCountable

Public Member Functions

 ConsoleUI (GXemul *gxemul)
 Constructs a text console UI instance. More...
 
virtual ~ConsoleUI ()
 
virtual void Initialize ()
 Initializes the terminal for blocking, non-echo I/O. More...
 
virtual void UpdateUI ()
 Updates UI items. Not used for ConsoleUI. More...
 
virtual void ShowStartupBanner ()
 Prints the text console startup banner. More...
 
virtual void ShowDebugMessage (const string &msg)
 Shows a debug message, by printing it to stdout. More...
 
virtual void ShowDebugMessage (Component *component, const string &msg)
 Shows a debug message for a Component, by printing it to stdout. More...
 
virtual void ShowCommandMessage (const string &command)
 Does nothing for the ConsoleUI. More...
 
virtual void FatalError (const string &msg)
 Shows a fatal error message, by printing it to stderr. More...
 
virtual void RedisplayInputLine (const string &inputline, size_t cursorPosition)
 Redisplays the interactive command input line. More...
 
virtual void InputLineDone ()
 Executed by the CommandInterpreter when a line has been completed (with a newline). More...
 
virtual int MainLoop ()
 Runs the text console main loop. More...
 
virtual void Shutdown ()
 Shuts down the UI. More...
 
- Public Member Functions inherited from UI
 UI (GXemul *gxemul)
 Constructs a User Interface. More...
 
virtual ~UI ()
 
void SetIndentationMessage (const string &msg)
 Sets an indentation message, which indents all debug output. More...
 
string GetIndentationMessage () const
 Gets the indentation message. More...
 
- Public Member Functions inherited from ReferenceCountable
 ReferenceCountable ()
 Default constructor, which initializes the reference count to zero. More...
 
 ~ReferenceCountable ()
 

Additional Inherited Members

- Protected Attributes inherited from UI
GXemulm_gxemul
 
string m_indentationMsg
 

Detailed Description

Text-terminal based User Interface.

Definition at line 39 of file ConsoleUI.h.

Constructor & Destructor Documentation

◆ ConsoleUI()

ConsoleUI::ConsoleUI ( GXemul gxemul)

Constructs a text console UI instance.

Parameters
gxemulPointer to the owning GXemul instance.

Definition at line 37 of file ConsoleUI.cc.

◆ ~ConsoleUI()

ConsoleUI::~ConsoleUI ( )
virtual

Definition at line 44 of file ConsoleUI.cc.

Member Function Documentation

◆ FatalError()

void ConsoleUI::FatalError ( const string &  msg)
virtual

Shows a fatal error message, by printing it to stderr.

Parameters
msgThe error message to show.

Implements UI.

Definition at line 215 of file ConsoleUI.cc.

Referenced by MainLoop().

◆ Initialize()

void ConsoleUI::Initialize ( )
virtual

Initializes the terminal for blocking, non-echo I/O.

Implements UI.

Definition at line 98 of file ConsoleUI.cc.

References UI::m_gxemul.

◆ InputLineDone()

void ConsoleUI::InputLineDone ( )
virtual

Executed by the CommandInterpreter when a line has been completed (with a newline).

For the ConsoleUI, this simply outputs a newline character.

Implements UI.

Definition at line 255 of file ConsoleUI.cc.

◆ MainLoop()

int ConsoleUI::MainLoop ( )
virtual

Runs the text console main loop.

As long as the RunState is not Quitting:

  • If an emulation is Running, the main loop lets the emulation run, until Ctrl-C is pressed.
  • Otherwise, if the RunState is Paused, the main loop shows a prompt and lets the user input commands.

Implements UI.

Definition at line 267 of file ConsoleUI.cc.

References GXemul::Execute(), FatalError(), Component::FlushCachedState(), GXemul::GetRootComponent(), GXemul::GetRunState(), UI::m_gxemul, GXemul::Paused, Component::PreRunCheck(), GXemul::Quitting, GXemul::Running, GXemul::SetRunState(), and GXemul::SingleStepping.

◆ RedisplayInputLine()

void ConsoleUI::RedisplayInputLine ( const string &  inputline,
size_t  cursorPosition 
)
virtual

Redisplays the interactive command input line.

For the ConsoleUI, this function displays a prompt ("GXemul> ") followed by the input line, placing the cursor position at the correct position on the input line.

Parameters
inputlineThe entire input line.
cursorPositionThe current cursor position. 0 is at the leftmost position.

Implements UI.

Definition at line 222 of file ConsoleUI.cc.

◆ ShowCommandMessage()

void ConsoleUI::ShowCommandMessage ( const string &  command)
virtual

Does nothing for the ConsoleUI.

Parameters
commandThe command being executed.

Implements UI.

Definition at line 207 of file ConsoleUI.cc.

◆ ShowDebugMessage() [1/2]

void ConsoleUI::ShowDebugMessage ( const string &  msg)
virtual

Shows a debug message, by printing it to stdout.

Parameters
msgThe message to show.

Implements UI.

Definition at line 161 of file ConsoleUI.cc.

◆ ShowDebugMessage() [2/2]

void ConsoleUI::ShowDebugMessage ( Component component,
const string &  msg 
)
virtual

Shows a debug message for a Component, by printing it to stdout.

See UI::ShowDebugMessage(Component*,const string&) for a longer comment.

Parameters
componentA pointer to the Component.
msgThe message to show.

Implements UI.

Definition at line 181 of file ConsoleUI.cc.

References Component::GenerateShortestPossiblePath(), GXemul::GetQuietMode(), and UI::m_gxemul.

◆ ShowStartupBanner()

void ConsoleUI::ShowStartupBanner ( )
virtual

Prints the text console startup banner.

Implements UI.

Definition at line 131 of file ConsoleUI.cc.

References GXemul::Version().

◆ Shutdown()

void ConsoleUI::Shutdown ( )
virtual

Shuts down the UI.

Called from e.g. the "quit" command.

Implements UI.

Definition at line 262 of file ConsoleUI.cc.

◆ UpdateUI()

void ConsoleUI::UpdateUI ( )
virtual

Updates UI items. Not used for ConsoleUI.

Implements UI.

Definition at line 125 of file ConsoleUI.cc.


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

Generated on Sun Sep 30 2018 16:05:18 for GXemul by doxygen 1.8.13