3 * Copyright (c) 2010, Blue Static <http://www.bluestatic.org>
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 #import <Cocoa/Cocoa.h>
21 // The LoggingController manages the communication log with the debugger engine.
22 // Whenever a command or a response received, the DebuggerConnection notifies
23 // this class to record the relevant information.
24 @interface LoggingController
: NSWindowController
26 // An array of log entries, with object at index 0 being the oldest entry.
27 NSMutableArray
* logEntries_
;
29 // The array controller.
30 IBOutlet NSArrayController
* logEntriesController_
;
32 @
property (readonly
) NSArray
* logEntries
;
34 // Designated initializer.
37 // Creates a new log entry with the specified command, adds it to the entries
38 // list, and returns the new entry as a weak pointer. Callers can then set
39 // additional properties.
40 - (LogEntry
*)recordSend
:(NSString
*)command
;
42 // Creates a new log entry with the specified response data, adds it to the list
43 // of entries, and returns the new entry as a weak pointer. Callers can then set
44 // additional properties.
45 - (LogEntry
*)recordReceive
:(NSString
*)response
;
49 // Log Entry ///////////////////////////////////////////////////////////////////
51 typedef enum _LogEntryDirection
{
56 // A simple class that stores information for a single log entry.
57 @interface LogEntry
: NSObject
59 // The direction this communication went.
60 LogEntryDirection direction_
;
62 // The command that was sent or the response.
65 // Any error information.
68 // The values of the last read and written transaction IDs.
69 NSUInteger lastWrittenTransactionID_
;
70 NSUInteger lastReadTransactionID_
;
72 @
property (assign
) LogEntryDirection direction
;
73 @
property (copy
) NSString
* contents
;
74 @
property (retain
) NSError
* error
;
75 @
property (assign
) NSUInteger lastWrittenTransactionID
;
76 @
property (assign
) NSUInteger lastReadTransactionID
;
77 - (NSString
*)directionName
;