43 static void ShowMsg(
GXemul& gxemul,
const string& msg)
51 if (arguments.size() < 1) {
52 ShowMsg(gxemul,
"No path given.\n");
56 if (arguments.size() > 1) {
57 ShowMsg(gxemul,
"Too many arguments.\n");
61 string path = arguments[0];
64 FindPathByPartialMatch(path);
65 if (matches.size() == 0) {
66 ShowMsg(gxemul, path+
" is not a path to a known component.\n");
69 if (matches.size() > 1) {
70 ShowMsg(gxemul, path+
" matches multiple components:\n");
71 for (
size_t i=0; i<matches.size(); i++)
72 ShowMsg(gxemul,
" " + matches[i] +
"\n");
78 if (whatToRemove.
IsNULL()) {
79 ShowMsg(gxemul,
"Lookup of " + path +
" failed.\n");
85 ShowMsg(gxemul,
"Cannot remove the root component.\n");
97 return "Removes a component from the emulation.";
104 "Removes a component (given a path) from the current emulation setup.\n" 105 "The following example shows how to remove cpu1 from a particular machine:\n" 109 " \\-- machine0 [testmips]\n" 111 " |-- ram0 (32 MB at offset 0)\n" 112 " |-- rom0 (16 MB at offset 0x1fc00000)\n" 113 " |-- cpu0 (MIPS, 100 MHz)\n" 114 " \\-- cpu1 (MIPS, 100 MHz)\n" 118 " \\-- machine0 [testmips]\n" 120 " |-- ram0 (32 MB at offset 0)\n" 121 " |-- rom0 (16 MB at offset 0x1fc00000)\n" 122 " \\-- cpu0 (MIPS, 100 MHz)\n" 124 "See also: add (to add new components)\n" 125 " root (to inspect the current emulation setup)\n";
virtual void ShowDebugMessage(const string &msg)=0
Shows a debug message.
Component * GetParent()
Gets this component's parent component, if any.
virtual string GetShortDescription() const
Returns a short (one-line) description of the command.
virtual ~RemoveComponentCommand()
virtual string GetLongDescription() const
Returns a long description/help message for the command.
virtual bool Execute(GXemul &gxemul, const vector< string > &arguments)
Executes the command on a given GXemul instance.
size_t RemoveChild(Component *childToRemove)
Removes a reference to a child component.
A Command is a named function, executed by the CommandInterpreter.
refcount_ptr< Component > GetRootComponent()
Gets a pointer to the root configuration component.
RemoveComponentCommand()
Constructs a RemoveComponentCommand.
UI * GetUI()
Gets a pointer to the GXemul instance' active UI.
const refcount_ptr< Component > LookupPath(string path) const
Looks up a path from this Component, and returns a pointer to the found Component, if any.
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.