18 using std::string_view;
27 const std::string& machineID_)
28 : globalCommandController(globalCommandController_)
30 , motherboard(motherboard_)
31 , msxEventDistributor(msxEventDistributor_)
32 , machineID(
strCat(
"::", machineID_,
"::"))
36 machineInfoCommand = std::make_unique<InfoCommand>(*
this,
"machine_info");
37 machineInfoCommand->setAllowedInEmptyMachine(
true);
46 machineInfoCommand.reset();
49 for (
auto* c : commandMap) {
50 std::cout <<
"Command not unregistered: " << c->getName() <<
'\n';
52 for (
auto* s : settings) {
53 std::cout <<
"Setting not unregistered: " << s->getFullName() <<
'\n';
55 assert(commandMap.empty());
56 assert(settings.empty());
70 assert(command.
getName() == str);
71 commandMap.insert_noDuplicateCheck(&command);
73 auto fullname = getFullName(str);
83 assert(command.
getName() == str);
84 commandMap.erase(str);
87 auto fullname = getFullName(str);
94 auto fullname = getFullName(str);
101 auto fullname = getFullName(str);
109 settings.push_back(&setting);
127 auto it = commandMap.find(name);
128 return (it !=
end(commandMap)) ? *it :
nullptr;
139 return globalCommandController.
executeCommand(command, connection);
152 void MSXCommandController::signalMSXEvent(
153 const std::shared_ptr<const Event>& event, EmuTime::param ) noexcept
158 for (
auto* s : settings) {
161 s->getFullNameObj(), s->getValue());
162 }
catch (MSXException&) {
175 const auto& fromPrefix = from.
getPrefix();
177 for (
auto* s : settings) {
178 if (
auto* fromSetting = manager.findSetting(fromPrefix, s->getBaseName())) {
179 if (!fromSetting->needTransfer())
continue;
182 s->getFullNameObj(), fromSetting->getValue());
void setPrefix(std::string_view prefix)
Set a machine specific prefix.
void setAllowedInEmptyMachine(bool value)
const std::string & getName() const
Interpreter & getInterpreter() override
void registerProxyCommand(std::string_view name)
void unregisterProxyCommand(std::string_view name)
void registerCommand(Command &command, zstring_view str) override
(Un)register a command
void registerCompleter(CommandCompleter &completer, std::string_view str) override
(Un)register a command completer, used to complete build-in Tcl cmds
void registerProxySetting(Setting &setting)
TclObject executeCommand(zstring_view command, CliConnection *connection=nullptr) override
Execute the given command.
void unregisterProxySetting(Setting &setting)
SettingsManager & getSettingsManager()
void unregisterCompleter(CommandCompleter &completer, std::string_view str) override
void unregisterCommand(Command &command, std::string_view str) override
void deleteNamespace(const std::string &name)
Delete the global namespace with given name.
void registerSetting(BaseSetting &variable)
void createNamespace(const std::string &name)
Create the global namespace with given name.
void setVariable(const TclObject &name, const TclObject &value)
void unregisterSetting(BaseSetting &variable)
const std::string & getPrefix() const
bool hasCommand(std::string_view command) const
Interpreter & getInterpreter() override
void registerCompleter(CommandCompleter &completer, std::string_view str) override
(Un)register a command completer, used to complete build-in Tcl cmds
TclObject executeCommand(zstring_view command, CliConnection *connection=nullptr) override
Execute the given command.
void unregisterCompleter(CommandCompleter &completer, std::string_view str) override
void registerCommand(Command &command, zstring_view str) override
(Un)register a command
void transferSettings(const MSXCommandController &from)
Transfer setting values from one machine to another, used for during 'reverse'.
void unregisterSetting(Setting &setting) override
bool isActive() const
Returns true iff the machine this controller belongs to is currently active.
MSXCommandController(const MSXCommandController &)=delete
CliComm & getCliComm() override
void unregisterCommand(Command &command, std::string_view str) override
void registerSetting(Setting &setting) override
TODO.
Command * findCommand(std::string_view name) const
void registerEventListener(MSXEventListener &listener)
Registers a given object to receive certain events.
void unregisterEventListener(MSXEventListener &listener)
Unregisters a previously registered event listener.
CliComm & getMSXCliComm()
Contains the main loop of openMSX.
MSXMotherBoard * getMotherBoard() const
void unregisterSetting(BaseSetting &setting)
void registerSetting(BaseSetting &setting)
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
This file implemented 3 utility functions:
@ OPENMSX_MACHINE_ACTIVATED
Send when a machine is (de)activated.
constexpr auto rfind_unguarded(RANGE &range, const VAL &val)
Similar to the find(_if)_unguarded functions above, but searches from the back to front.
void move_pop_back(VECTOR &v, typename VECTOR::iterator it)
Erase the pointed to element from the given vector.
TemporaryString tmpStrCat(Ts &&... ts)
std::string strCat(Ts &&...ts)
constexpr auto end(const zstring_view &x)