Debugger CLI: Start to imbue CliContext with life
This commit is contained in:
parent
abbcb2caf5
commit
d0ef75400b
@ -174,6 +174,7 @@ Application Debugger :
|
||||
|
||||
# user_interface/cli
|
||||
CliCommand.cpp
|
||||
CliContext.cpp
|
||||
CommandLineUserInterface.cpp
|
||||
|
||||
# user_interface/gui
|
||||
|
32
src/apps/debugger/user_interface/cli/CliContext.cpp
Normal file
32
src/apps/debugger/user_interface/cli/CliContext.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "CliContext.h"
|
||||
|
||||
#include "UserInterface.h"
|
||||
|
||||
|
||||
CliContext::CliContext()
|
||||
:
|
||||
fTeam(NULL),
|
||||
fListener(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CliContext::Init(Team* team, UserInterfaceListener* listener)
|
||||
{
|
||||
fTeam = team;
|
||||
fListener = listener;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CliContext::QuitSession()
|
||||
{
|
||||
fListener->UserInterfaceQuitRequested();
|
||||
}
|
@ -6,7 +6,25 @@
|
||||
#define CLI_CONTEXT_H
|
||||
|
||||
|
||||
class Team;
|
||||
class UserInterfaceListener;
|
||||
|
||||
|
||||
class CliContext {
|
||||
public:
|
||||
CliContext();
|
||||
|
||||
void Init(Team* team,
|
||||
UserInterfaceListener* listener);
|
||||
|
||||
Team* GetTeam() const { return fTeam; }
|
||||
|
||||
void QuitSession();
|
||||
|
||||
|
||||
private:
|
||||
Team* fTeam;
|
||||
UserInterfaceListener* fListener;
|
||||
};
|
||||
|
||||
|
||||
|
@ -100,8 +100,6 @@ private:
|
||||
|
||||
CommandLineUserInterface::CommandLineUserInterface()
|
||||
:
|
||||
fTeam(NULL),
|
||||
fListener(NULL),
|
||||
fCommands(20, true),
|
||||
fShowSemaphore(-1),
|
||||
fShown(false),
|
||||
@ -127,8 +125,7 @@ CommandLineUserInterface::ID() const
|
||||
status_t
|
||||
CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener)
|
||||
{
|
||||
fTeam = team;
|
||||
fListener = listener;
|
||||
fContext.Init(team, listener);
|
||||
|
||||
status_t error = _RegisterCommands();
|
||||
if (error != B_OK)
|
||||
@ -318,8 +315,7 @@ CommandLineUserInterface::_ExecuteCommand(int argc, const char* const* argv)
|
||||
return;
|
||||
}
|
||||
|
||||
CliContext context;
|
||||
firstEntry->Command()->Execute(argc, argv, context);
|
||||
firstEntry->Command()->Execute(argc, argv, fContext);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <ObjectList.h>
|
||||
#include <String.h>
|
||||
|
||||
#include "CliContext.h"
|
||||
#include "UserInterface.h"
|
||||
|
||||
|
||||
@ -68,8 +69,7 @@ private:
|
||||
void _PrintHelp();
|
||||
|
||||
private:
|
||||
Team* fTeam;
|
||||
UserInterfaceListener* fListener;
|
||||
CliContext fContext;
|
||||
CommandList fCommands;
|
||||
sem_id fShowSemaphore;
|
||||
bool fShown;
|
||||
|
Loading…
Reference in New Issue
Block a user