openMSX
|
#include <CommandLineParser.hh>
Public Types | |
enum | ParseStatus { UNPARSED , RUN , CONTROL , TEST , EXIT } |
enum | ParsePhase { PHASE_BEFORE_INIT , PHASE_INIT , PHASE_BEFORE_SETTINGS , PHASE_LOAD_SETTINGS , PHASE_BEFORE_MACHINE , PHASE_LOAD_MACHINE , PHASE_DEFAULT_MACHINE , PHASE_LAST } |
Public Member Functions | |
CommandLineParser (Reactor &reactor) | |
void | registerOption (const char *str, CLIOption &cliOption, ParsePhase phase=PHASE_LAST, unsigned length=2) |
void | registerFileType (std::span< const std::string_view > extensions, CLIFileType &cliFileType) |
void | parse (std::span< char * > argv) |
ParseStatus | getParseStatus () const |
const auto & | getStartupScripts () const |
const auto & | getStartupCommands () const |
MSXMotherBoard * | getMotherBoard () const |
GlobalCommandController & | getGlobalCommandController () const |
Interpreter & | getInterpreter () const |
Definition at line 34 of file CommandLineParser.hh.
Enumerator | |
---|---|
PHASE_BEFORE_INIT | |
PHASE_INIT | |
PHASE_BEFORE_SETTINGS | |
PHASE_LOAD_SETTINGS | |
PHASE_BEFORE_MACHINE | |
PHASE_LOAD_MACHINE | |
PHASE_DEFAULT_MACHINE | |
PHASE_LAST |
Definition at line 38 of file CommandLineParser.hh.
Enumerator | |
---|---|
UNPARSED | |
RUN | |
CONTROL | |
TEST | |
EXIT |
Definition at line 37 of file CommandLineParser.hh.
|
explicit |
Definition at line 40 of file CommandLineParser.cc.
References PHASE_BEFORE_INIT, PHASE_BEFORE_SETTINGS, PHASE_LOAD_MACHINE, registerFileType(), registerOption(), and ranges::sort().
GlobalCommandController & openmsx::CommandLineParser::getGlobalCommandController | ( | ) | const |
Definition at line 281 of file CommandLineParser.cc.
References openmsx::Reactor::getGlobalCommandController().
Interpreter & openmsx::CommandLineParser::getInterpreter | ( | ) | const |
Definition at line 286 of file CommandLineParser.cc.
References openmsx::Reactor::getInterpreter().
Referenced by parse(), openmsx::CassettePlayerCLI::parseFileType(), openmsx::LaserdiscPlayerCLI::parseFileType(), openmsx::ReplayCLI::parseFileType(), openmsx::SaveStateCLI::parseFileType(), and openmsx::CDImageCLI::parseOption().
MSXMotherBoard * openmsx::CommandLineParser::getMotherBoard | ( | ) | const |
Definition at line 276 of file CommandLineParser.cc.
References openmsx::Reactor::getMotherBoard().
Referenced by openmsx::CliExtension::parseOption().
CommandLineParser::ParseStatus openmsx::CommandLineParser::getParseStatus | ( | ) | const |
Definition at line 270 of file CommandLineParser.cc.
References UNPARSED.
|
inline |
Definition at line 60 of file CommandLineParser.hh.
Referenced by openmsx::Reactor::runStartupScripts().
|
inline |
Definition at line 57 of file CommandLineParser.hh.
Referenced by openmsx::Reactor::runStartupScripts().
void openmsx::CommandLineParser::parse | ( | std::span< char * > | argv | ) |
Definition at line 150 of file CommandLineParser.cc.
References openmsx::GlobalCliComm::addListener(), binary_find(), CONTROL, view::drop(), EXIT, openmsx::Reactor::getCliComm(), openmsx::FileOperations::getConventionalPath(), openmsx::Setting::getDefaultValue(), openmsx::Reactor::getGlobalCliComm(), openmsx::Reactor::getGlobalCommandController(), getInterpreter(), openmsx::Reactor::getMachineSetting(), openmsx::Reactor::getOpenMSXInfoCommand(), openmsx::GlobalCommandController::getSettingsConfig(), openmsx::TclObject::getString(), openmsx::EnumSetting< T >::getString(), openmsx::Reactor::init(), openmsx::Interpreter::init(), PHASE_BEFORE_INIT, PHASE_DEFAULT_MACHINE, PHASE_INIT, PHASE_LAST, PHASE_LOAD_SETTINGS, openmsx::CliComm::printInfo(), openmsx::CliComm::printWarning(), RUN, openmsx::Reactor::switchMachine(), openmsx::systemFileContext(), to_vector(), and view::transform().
void openmsx::CommandLineParser::registerFileType | ( | std::span< const std::string_view > | extensions, |
CLIFileType & | cliFileType | ||
) |
Definition at line 81 of file CommandLineParser.cc.
References view::transform().
Referenced by openmsx::CassettePlayerCLI::CassettePlayerCLI(), CommandLineParser(), openmsx::DiskImageCLI::DiskImageCLI(), openmsx::LaserdiscPlayerCLI::LaserdiscPlayerCLI(), openmsx::MSXRomCLI::MSXRomCLI(), openmsx::ReplayCLI::ReplayCLI(), and openmsx::SaveStateCLI::SaveStateCLI().
void openmsx::CommandLineParser::registerOption | ( | const char * | str, |
CLIOption & | cliOption, | ||
ParsePhase | phase = PHASE_LAST , |
||
unsigned | length = 2 |
||
) |
Definition at line 75 of file CommandLineParser.cc.
Referenced by openmsx::CassettePlayerCLI::CassettePlayerCLI(), openmsx::CDImageCLI::CDImageCLI(), openmsx::CliExtension::CliExtension(), CommandLineParser(), openmsx::DiskImageCLI::DiskImageCLI(), openmsx::HDImageCLI::HDImageCLI(), openmsx::LaserdiscPlayerCLI::LaserdiscPlayerCLI(), openmsx::MSXRomCLI::MSXRomCLI(), openmsx::ReplayCLI::ReplayCLI(), and openmsx::SaveStateCLI::SaveStateCLI().