Extend Team's listener interface.

Add hooks for sending and listening for console output events.
This commit is contained in:
Rene Gollent
2013-06-28 18:49:30 -04:00
parent 4dc355e9a9
commit d692e338d4
2 changed files with 58 additions and 0 deletions
+32
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2009-2012, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -613,6 +614,18 @@ Team::NotifyImageDebugInfoChanged(Image* image)
}
void
Team::NotifyConsoleOutputReceived(int32 fd, const BString& output)
{
for (ListenerList::Iterator it = fListeners.GetIterator();
Listener* listener = it.Next();) {
listener->ConsoleOutputReceived(
ConsoleOutputEvent(TEAM_EVENT_CONSOLE_OUTPUT_RECEIVED, this,
fd, output));
}
}
void
Team::NotifyUserBreakpointChanged(UserBreakpoint* breakpoint)
{
@@ -731,6 +744,19 @@ Team::BreakpointEvent::BreakpointEvent(uint32 type, Team* team,
}
// #pragma mark - ConsoleOutputEvent
Team::ConsoleOutputEvent::ConsoleOutputEvent(uint32 type, Team* team,
int32 fd, const BString& output)
:
Event(type, team),
fDescriptor(fd),
fOutput(output)
{
}
// #pragma mark - DebugReportEvent
@@ -823,6 +849,12 @@ Team::Listener::ImageDebugInfoChanged(const Team::ImageEvent& event)
}
void
Team::Listener::ConsoleOutputReceived(const Team::ConsoleOutputEvent& event)
{
}
void
Team::Listener::BreakpointAdded(const Team::BreakpointEvent& event)
{
+26
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef TEAM_H
@@ -32,6 +33,8 @@ enum {
TEAM_EVENT_IMAGE_DEBUG_INFO_CHANGED,
TEAM_EVENT_CONSOLE_OUTPUT_RECEIVED,
TEAM_EVENT_BREAKPOINT_ADDED,
TEAM_EVENT_BREAKPOINT_REMOVED,
TEAM_EVENT_USER_BREAKPOINT_CHANGED,
@@ -41,6 +44,7 @@ enum {
TEAM_EVENT_WATCHPOINT_CHANGED,
TEAM_EVENT_DEBUG_REPORT_CHANGED
};
@@ -63,6 +67,7 @@ class Team {
public:
class Event;
class BreakpointEvent;
class ConsoleOutputEvent;
class DebugReportEvent;
class ImageEvent;
class ThreadEvent;
@@ -178,6 +183,10 @@ public:
// service methods for Image
void NotifyImageDebugInfoChanged(Image* image);
// service methods for console output
void NotifyConsoleOutputReceived(
int32 fd, const BString& output);
// breakpoint related service methods
void NotifyUserBreakpointChanged(
UserBreakpoint* breakpoint);
@@ -268,6 +277,20 @@ protected:
};
class Team::ConsoleOutputEvent : public Event {
public:
ConsoleOutputEvent(uint32 type, Team* team,
int32 fd, const BString& output);
int32 Descriptor() const { return fDescriptor; }
const BString& Output() const { return fOutput; }
protected:
int32 fDescriptor;
BString fOutput;
};
class Team::DebugReportEvent : public Event {
public:
DebugReportEvent(uint32 type, Team* team,
@@ -323,6 +346,9 @@ public:
virtual void ImageDebugInfoChanged(
const Team::ImageEvent& event);
virtual void ConsoleOutputReceived(
const Team::ConsoleOutputEvent& event);
virtual void BreakpointAdded(
const Team::BreakpointEvent& event);
virtual void BreakpointRemoved(