Renaming because there's too many Debugger* classes
[macgdbp.git] / Source / LoggingController.h
1 /*
2 * MacGDBp
3 * Copyright (c) 2010, Blue Static <http://www.bluestatic.org>
4 *
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.
8 *
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.
12 *
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
15 */
16
17 #import <Cocoa/Cocoa.h>
18
19 @class LogEntry;
20
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
25 {
26 // An array of log entries, with object at index 0 being the oldest entry.
27 NSMutableArray* logEntries_;
28
29 // The array controller.
30 IBOutlet NSArrayController* logEntriesController_;
31 }
32 @property (readonly) NSArray* logEntries;
33
34 // Designated initializer.
35 - (id)init;
36
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;
40
41 @end
42
43 // Log Entry ///////////////////////////////////////////////////////////////////
44
45 typedef enum _LogEntryDirection {
46 kLogEntrySending = 0,
47 kLogEntryReceiving
48 } LogEntryDirection;
49
50 // A simple class that stores information for a single log entry.
51 @interface LogEntry : NSObject
52 {
53 // The direction this communication went.
54 LogEntryDirection direction_;
55
56 // The command that was sent or the response.
57 NSString* contents_;
58
59 // Any error information.
60 NSError* error_;
61
62 // The values of the last read and written transaction IDs.
63 NSUInteger lastWrittenTransactionID_;
64 NSUInteger lastReadTransactionID_;
65 }
66 @property (assign) LogEntryDirection direction;
67 @property (copy) NSString* contents;
68 @property (retain) NSError* error;
69 @property (assign) NSUInteger lastWrittenTransactionID;
70 @property (assign) NSUInteger lastReadTransactionID;
71
72 - (NSString*)directionName;
73
74 + (LogEntry*)newSendEntry:(NSString*)command;
75 + (LogEntry*)newReceiveEntry:(NSString*)command;
76
77 @end