3 * Copyright (c) 2011, 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 NetworkConnection 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 // Records a log entry. This will add it to the list and will update the UI.
38 // This will take ownership of |entry|.
39 - (void)recordEntry
:(LogEntry
*)entry
;
43 // Log Entry ///////////////////////////////////////////////////////////////////
45 typedef enum _LogEntryDirection
{
50 // A simple class that stores information for a single log entry.
51 @interface LogEntry
: NSObject
53 // The direction this communication went.
54 LogEntryDirection direction_
;
56 // The command that was sent or the response.
59 // The values of the last read and written transaction IDs.
60 NSUInteger lastWrittenTransactionID_
;
61 NSUInteger lastReadTransactionID_
;
63 @
property (assign
) LogEntryDirection direction
;
64 @
property (copy
) NSString
* contents
;
65 @
property (assign
) NSUInteger lastWrittenTransactionID
;
66 @
property (assign
) NSUInteger lastReadTransactionID
;
68 - (NSString
*)directionName
;
70 + (LogEntry
*)newSendEntry
:(NSString
*)command
;
71 + (LogEntry
*)newReceiveEntry
:(NSString
*)command
;