Add VariableNode which will replace our use of raw NSXMLElement.
[macgdbp.git] / Source / VariableNode.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 // A VariableNode represents a property in the variable list display. It
20 // converts XML response nodes to this format and extracts all the necessary
21 // information. The fields of this class are defined by the spec:
22 // http://www.xdebug.org/docs-dbgp.php#properties-variables-and-values
23 @interface VariableNode : NSObject
24 {
25 NSString* name_;
26 NSString* fullName_;
27 NSString* className_;
28 NSString* type_;
29 NSString* value_;
30 NSMutableArray* children_;
31 NSInteger childCount_;
32 }
33
34 @property (readonly, copy) NSString* name;
35 @property (readonly, copy) NSString* fullName;
36 @property (readonly, copy) NSString* className;
37 @property (readonly, copy) NSString* type;
38 @property (readonly, copy) NSString* value;
39 @property (readonly, retain) NSArray* children;
40 @property (readonly) NSInteger childCount;
41
42 // Creates and initializes a new VariableNode from the XML response from the
43 // debugger backend.
44 - (id)initWithXMLNode:(NSXMLElement*)node;
45
46 // When properties are asynchrnously loaded, this method can be used to set
47 // the children on a node from the list of children from the XML response.
48 - (void)setChildrenFromXMLChildren:(NSArray*)children;
49
50 // Returns the children and requests any unloaded ones.
51 - (NSArray*)dynamicChildren;
52
53 // Whether or not this is a leaf node (i.e. does not have child properties).
54 - (BOOL)isLeaf;
55
56 // Returns a formatted type and classname display.
57 - (NSString*)displayType;
58
59 @end