23 const std::string& machineID_)
24 : globalCommandController(globalCommandController_)
26 , motherboard(motherboard_)
27 , msxEventDistributor(msxEventDistributor_)
28 , machineID(
strCat(
"::", machineID_,
"::"))
32 machineInfoCommand.emplace(*
this,
"machine_info");
33 machineInfoCommand->setAllowedInEmptyMachine(
true);
42 machineInfoCommand.reset();
45 for (
const auto* c : commandMap) {
46 std::cout <<
"Command not unregistered: " << c->getName() <<
'\n';
48 for (
const auto* s : settings) {
49 std::cout <<
"Setting not unregistered: " << s->getFullName() <<
'\n';
51 assert(commandMap.empty());
52 assert(settings.empty());
66 assert(command.
getName() == str);
67 commandMap.insert_noDuplicateCheck(&command);
69 auto fullname = getFullName(str);
79 assert(command.
getName() == str);
80 commandMap.erase(str);
83 auto fullname = getFullName(str);
90 auto fullname = getFullName(str);
97 auto fullname = getFullName(str);
124 return it != settings.end() ? *it :
nullptr;
129 auto it = commandMap.find(name);
130 return (it !=
end(commandMap)) ? *it :
nullptr;
141 return globalCommandController.
executeCommand(command, connection);
154void MSXCommandController::signalMSXEvent(
155 const Event& event, EmuTime::param )
noexcept
160 for (
const auto* s : settings) {
163 s->getFullNameObj(), s->getValue());
164 }
catch (MSXException&) {
177 const auto& fromPrefix = from.
getPrefix();
179 for (
const auto* s : settings) {
180 if (
const auto* fromSetting = manager.findSetting(fromPrefix, s->getBaseName())) {
181 if (!fromSetting->needTransfer())
continue;
184 s->getFullNameObj(), fromSetting->getValue());
std::string_view getBaseName() const
void setAllowedInEmptyMachine(bool value)
const std::string & getName() const
void registerProxySetting(const Setting &setting)
Interpreter & getInterpreter() override
void unregisterProxySetting(const Setting &setting)
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
TclObject executeCommand(zstring_view command, CliConnection *connection=nullptr) override
Execute the given command.
void unregisterCompleter(CommandCompleter &completer, std::string_view str) override
void unregisterCommand(Command &command, std::string_view str) override
SettingsManager & getSettingsManager()
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)
bool hasCommand(std::string_view command) const
MSXCommandController(GlobalCommandController &globalCommandController, Reactor &reactor, MSXMotherBoard &motherboard, MSXEventDistributor &msxEventDistributor, const std::string &machineID)
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
Setting * findSetting(std::string_view name) const
void transferSettings(const MSXCommandController &from)
Transfer setting values from one machine to another, used for during 'reverse'.
void unregisterSetting(Setting &setting) override
const std::string & getPrefix() const
bool isActive() const
Returns true iff the machine this controller belongs to is currently active.
MSXCliComm & 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.
MSXCliComm & 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:
EventType getType(const Event &event)
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
auto find(InputRange &&range, const T &value)
void move_pop_back(VECTOR &v, typename VECTOR::iterator it)
Erase the pointed to element from the given vector.
auto rfind_unguarded(RANGE &range, const VAL &val, Proj proj={})
Similar to the find(_if)_unguarded functions above, but searches from the back to front.
TemporaryString tmpStrCat(Ts &&... ts)
constexpr auto end(const zstring_view &x)