Debugger CLI: Pull QuitCommand out of CommandLineUserInterface
This commit is contained in:
parent
d0ef75400b
commit
a6de32b06c
@ -175,6 +175,7 @@ Application Debugger :
|
||||
# user_interface/cli
|
||||
CliCommand.cpp
|
||||
CliContext.cpp
|
||||
CliQuitCommand.cpp
|
||||
CommandLineUserInterface.cpp
|
||||
|
||||
# user_interface/gui
|
||||
|
25
src/apps/debugger/user_interface/cli/CliQuitCommand.cpp
Normal file
25
src/apps/debugger/user_interface/cli/CliQuitCommand.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "CliQuitCommand.h"
|
||||
|
||||
#include "CliContext.h"
|
||||
|
||||
|
||||
CliQuitCommand::CliQuitCommand()
|
||||
:
|
||||
CliCommand("quit Debugger",
|
||||
"%s\n"
|
||||
"Quits Debugger.")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CliQuitCommand::Execute(int argc, const char* const* argv, CliContext& context)
|
||||
{
|
||||
context.QuitSession();
|
||||
}
|
20
src/apps/debugger/user_interface/cli/CliQuitCommand.h
Normal file
20
src/apps/debugger/user_interface/cli/CliQuitCommand.h
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CLI_QUIT_COMMAND_H
|
||||
#define CLI_QUIT_COMMAND_H
|
||||
|
||||
|
||||
#include "CliCommand.h"
|
||||
|
||||
|
||||
class CliQuitCommand : public CliCommand {
|
||||
public:
|
||||
CliQuitCommand();
|
||||
virtual void Execute(int argc, const char* const* argv,
|
||||
CliContext& context);
|
||||
};
|
||||
|
||||
|
||||
#endif // CLI_QUIT_COMMAND_H
|
@ -18,8 +18,8 @@
|
||||
#include <AutoDeleter.h>
|
||||
#include <Referenceable.h>
|
||||
|
||||
#include "CliCommand.h"
|
||||
#include "CliContext.h"
|
||||
#include "CliQuitCommand.h"
|
||||
|
||||
|
||||
// #pragma mark - CommandEntry
|
||||
@ -72,29 +72,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark - HelpCommand
|
||||
|
||||
|
||||
struct CommandLineUserInterface::QuitCommand : CliCommand {
|
||||
QuitCommand(CommandLineUserInterface* userInterface)
|
||||
:
|
||||
CliCommand("quit Debugger",
|
||||
"%s\n"
|
||||
"Quits Debugger."),
|
||||
fUserInterface(userInterface)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Execute(int argc, const char* const* argv, CliContext& context)
|
||||
{
|
||||
fUserInterface->fListener->UserInterfaceQuitRequested();
|
||||
}
|
||||
|
||||
private:
|
||||
CommandLineUserInterface* fUserInterface;
|
||||
};
|
||||
|
||||
|
||||
// #pragma mark - CommandLineUserInterface
|
||||
|
||||
|
||||
@ -266,7 +243,7 @@ status_t
|
||||
CommandLineUserInterface::_RegisterCommands()
|
||||
{
|
||||
if (_RegisterCommand("help", new(std::nothrow) HelpCommand(this)) &&
|
||||
_RegisterCommand("quit", new(std::nothrow) QuitCommand(this))) {
|
||||
_RegisterCommand("quit", new(std::nothrow) CliQuitCommand)) {
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -51,11 +51,9 @@ private:
|
||||
typedef BObjectList<CommandEntry> CommandList;
|
||||
|
||||
struct HelpCommand;
|
||||
struct QuitCommand;
|
||||
|
||||
// GCC 2 support
|
||||
friend struct HelpCommand;
|
||||
friend struct QuitCommand;
|
||||
|
||||
private:
|
||||
static status_t _InputLoopEntry(void* data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user