Debugger CLI: Start to imbue CliContext with life

This commit is contained in:
Ingo Weinhold 2012-07-23 23:09:08 +02:00
parent abbcb2caf5
commit d0ef75400b
5 changed files with 55 additions and 8 deletions

View File

@ -174,6 +174,7 @@ Application Debugger :
# user_interface/cli
CliCommand.cpp
CliContext.cpp
CommandLineUserInterface.cpp
# user_interface/gui

View 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();
}

View File

@ -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;
};

View File

@ -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);
}

View File

@ -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;