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

#include <Command.hh>

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

Public Member Functions

virtual void execute (span< const TclObject > tokens, TclObject &result)=0
 Execute this command. More...
 
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 (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< string_viewfilter (string_view str, ITER begin, ITER end, bool caseSensitive)
 

Protected Member Functions

 Command (CommandController &controller, string_view name)
 
 ~Command ()
 
- Protected Member Functions inherited from openmsx::CommandCompleter
 CommandCompleter (CommandController &controller, string_view name)
 
 ~CommandCompleter ()
 
GlobalCommandControllergetGlobalCommandController () const
 
CliCommgetCliComm () const
 
- Protected Member Functions inherited from openmsx::Completer
 Completer (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< string_view > &input)
 
static void setOutput (InterpreterOutput *output_)
 

Detailed Description

Definition at line 40 of file Command.hh.

Constructor & Destructor Documentation

◆ Command()

openmsx::Command::Command ( CommandController controller,
string_view  name 
)
protected

◆ ~Command()

openmsx::Command::~Command ( )
protected

Member Function Documentation

◆ execute()

virtual void openmsx::Command::execute ( span< const TclObject tokens,
TclObject result 
)
pure virtual

◆ executeSubCommand()

template<typename... Args>
void openmsx::Command::executeSubCommand ( string_view  subcmd,
Args &&...  args 
)
inline

Definition at line 73 of file Command.hh.

References strAppend(), and strCat().

◆ getToken()

void* openmsx::Command::getToken ( ) const
inline

Definition at line 69 of file Command.hh.

Referenced by openmsx::Interpreter::unregisterCommand().

◆ isAllowedInEmptyMachine()

bool openmsx::Command::isAllowedInEmptyMachine ( ) const
inline

Definition at line 65 of file Command.hh.

◆ setAllowedInEmptyMachine()

void openmsx::Command::setAllowedInEmptyMachine ( bool  value)
inline

◆ setToken()

void openmsx::Command::setToken ( void *  token_)
inline

Definition at line 68 of file Command.hh.

Referenced by openmsx::Interpreter::registerCommand().

◆ tabCompletion()

void openmsx::Command::tabCompletion ( std::vector< std::string > &  tokens) const
overridevirtual

Attempt tab completion for this command.

Default implementation does nothing.

Parameters
tokensTokenized command line; tokens[0] is the command itself. The last token is incomplete, this method tries to complete it.

Implements openmsx::Completer.

Reimplemented in openmsx::ExtCmd, openmsx::RestoreMachineCommand, openmsx::StoreMachineCommand, openmsx::ActivateMachineCommand, openmsx::DeleteMachineCommand, openmsx::RemoveExtCmd, openmsx::LSXCommand, openmsx::TestMachineCommand, openmsx::LoadMachineCmd, openmsx::MachineCommand, openmsx::DiskCommand, openmsx::Sha1SumCommand, openmsx::CDXCommand, openmsx::AfterCommand, openmsx::HDCommand, openmsx::NowindCommand, openmsx::ProxyCmd, and openmsx::MessageCommand.

Definition at line 66 of file Command.cc.


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