Debugger CLI: Start to imbue CliContext with life
This commit is contained in:
@@ -174,6 +174,7 @@ Application Debugger :
|
|||||||
|
|
||||||
# user_interface/cli
|
# user_interface/cli
|
||||||
CliCommand.cpp
|
CliCommand.cpp
|
||||||
|
CliContext.cpp
|
||||||
CommandLineUserInterface.cpp
|
CommandLineUserInterface.cpp
|
||||||
|
|
||||||
# user_interface/gui
|
# user_interface/gui
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, Ingo Weinhold, [email protected].
|
||||||
|
* 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
|
#define CLI_CONTEXT_H
|
||||||
|
|
||||||
|
|
||||||
|
class Team;
|
||||||
|
class UserInterfaceListener;
|
||||||
|
|
||||||
|
|
||||||
class CliContext {
|
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()
|
CommandLineUserInterface::CommandLineUserInterface()
|
||||||
:
|
:
|
||||||
fTeam(NULL),
|
|
||||||
fListener(NULL),
|
|
||||||
fCommands(20, true),
|
fCommands(20, true),
|
||||||
fShowSemaphore(-1),
|
fShowSemaphore(-1),
|
||||||
fShown(false),
|
fShown(false),
|
||||||
@@ -127,8 +125,7 @@ CommandLineUserInterface::ID() const
|
|||||||
status_t
|
status_t
|
||||||
CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener)
|
CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener)
|
||||||
{
|
{
|
||||||
fTeam = team;
|
fContext.Init(team, listener);
|
||||||
fListener = listener;
|
|
||||||
|
|
||||||
status_t error = _RegisterCommands();
|
status_t error = _RegisterCommands();
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
@@ -318,8 +315,7 @@ CommandLineUserInterface::_ExecuteCommand(int argc, const char* const* argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CliContext context;
|
firstEntry->Command()->Execute(argc, argv, fContext);
|
||||||
firstEntry->Command()->Execute(argc, argv, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
#include "CliContext.h"
|
||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -68,8 +69,7 @@ private:
|
|||||||
void _PrintHelp();
|
void _PrintHelp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Team* fTeam;
|
CliContext fContext;
|
||||||
UserInterfaceListener* fListener;
|
|
||||||
CommandList fCommands;
|
CommandList fCommands;
|
||||||
sem_id fShowSemaphore;
|
sem_id fShowSemaphore;
|
||||||
bool fShown;
|
bool fShown;
|
||||||
|
|||||||
Reference in New Issue
Block a user