openMSX
Public Member Functions | Protected Member Functions | List of all members
openmsx::RecordedCommand Class Referenceabstract

Commands that directly influence the MSX state should send and events so that they can be recorded by the event recorder. More...

#include <RecordedCommand.hh>

Inheritance diagram for openmsx::RecordedCommand:
Inheritance graph
[legend]
Collaboration diagram for openmsx::RecordedCommand:
Collaboration graph
[legend]

Public Member Functions

virtual void execute (span< const TclObject > tokens, TclObject &result, EmuTime::param time)=0
 This is like the execute() method of the Command class, it only has an extra time parameter. More...
 
virtual bool needRecord (span< const TclObject > tokens) const
 It's possible that in some cases the command doesn't need to be recorded after all (e.g. More...
 
- Public Member Functions inherited from openmsx::Command
void tabCompletion (std::vector< std::string > &tokens) const override
 Attempt tab completion for this command. More...
 
void setAllowedInEmptyMachine (bool value)
 
bool isAllowedInEmptyMachine () const
 
void setToken (void *token_)
 
void * getToken () const
 
template<typename... Args>
void executeSubCommand (std::string_view subcmd, Args &&... args)
 
- Public Member Functions inherited from openmsx::CommandCompleter
 CommandCompleter (const CommandCompleter &)=delete
 
CommandCompleteroperator= (const CommandCompleter &)=delete
 
CommandControllergetCommandController () const
 
InterpretergetInterpreter () const final
 
- Public Member Functions inherited from openmsx::Completer
const std::string & getName () const
 
virtual std::string help (const std::vector< std::string > &tokens) const =0
 Print help for this command. More...
 
void checkNumArgs (span< const TclObject > tokens, unsigned exactly, const char *errMessage) const
 
void checkNumArgs (span< const TclObject > tokens, AtLeast atLeast, const char *errMessage) const
 
void checkNumArgs (span< const TclObject > tokens, Between between, const char *errMessage) const
 
void checkNumArgs (span< const TclObject > tokens, unsigned exactly, Prefix prefix, const char *errMessage) const
 
void checkNumArgs (span< const TclObject > tokens, AtLeast atLeast, Prefix prefix, const char *errMessage) const
 
void checkNumArgs (span< const TclObject > tokens, Between between, Prefix prefix, const char *errMessage) const
 
template<typename ITER >
NEVER_INLINE std::vector< std::string_view > filter (std::string_view str, ITER begin, ITER end, bool caseSensitive)
 

Protected Member Functions

 RecordedCommand (CommandController &commandController, StateChangeDistributor &stateChangeDistributor, Scheduler &scheduler, std::string_view name)
 
 ~RecordedCommand ()
 
- Protected Member Functions inherited from openmsx::Command
 Command (CommandController &controller, std::string_view name)
 
 ~Command ()
 
- Protected Member Functions inherited from openmsx::CommandCompleter
 CommandCompleter (CommandController &controller, std::string_view name)
 
 ~CommandCompleter ()
 
GlobalCommandControllergetGlobalCommandController () const
 
CliCommgetCliComm () const
 
- Protected Member Functions inherited from openmsx::Completer
 Completer (std::string_view name)
 
 ~Completer ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from openmsx::Completer
template<typename ITER >
static void completeString (std::vector< std::string > &tokens, ITER begin, ITER end, bool caseSensitive=true)
 
template<typename RANGE >
static void completeString (std::vector< std::string > &tokens, const RANGE &possibleValues, bool caseSensitive=true)
 
template<typename RANGE >
static void completeFileName (std::vector< std::string > &tokens, const FileContext &context, const RANGE &extra)
 
static void completeFileName (std::vector< std::string > &tokens, const FileContext &context)
 
static std::vector< std::string > formatListInColumns (const std::vector< std::string_view > &input)
 
static void setOutput (InterpreterOutput *output_)
 

Detailed Description

Commands that directly influence the MSX state should send and events so that they can be recorded by the event recorder.

This class helps to implement that.

Note: when a recorded command is later replayed, it's important to check whether it's actually a recorded command and not some arbitrary other command that someone might have inserted in a replay file. IOW when you load a replay file from an untrusted source, it should never be able to cause any harm. Blindly executing any Tcl command would be bad.

Definition at line 45 of file RecordedCommand.hh.

Constructor & Destructor Documentation

◆ RecordedCommand()

openmsx::RecordedCommand::RecordedCommand ( CommandController commandController,
StateChangeDistributor stateChangeDistributor,
Scheduler scheduler,
std::string_view  name 
)
protected

◆ ~RecordedCommand()

openmsx::RecordedCommand::~RecordedCommand ( )
protected

Member Function Documentation

◆ execute()

virtual void openmsx::RecordedCommand::execute ( span< const TclObject tokens,
TclObject result,
EmuTime::param  time 
)
pure virtual

This is like the execute() method of the Command class, it only has an extra time parameter.

Implemented in openmsx::ExtCmd, openmsx::RemoveExtCmd, openmsx::LSXCommand, openmsx::ResetCmd, openmsx::CDXCommand, and openmsx::HDCommand.

Referenced by needRecord(), and ~RecordedCommand().

◆ needRecord()

bool openmsx::RecordedCommand::needRecord ( span< const TclObject tokens) const
virtual

It's possible that in some cases the command doesn't need to be recorded after all (e.g.

a query subcommand). In that case you can override this method. Return false iff the command doesn't need to be recorded.

Reimplemented in openmsx::HDCommand.

Definition at line 46 of file RecordedCommand.cc.

References execute(), and openmsx::Completer::getName().

Referenced by ~RecordedCommand().


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