-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeIterator.h
More file actions
45 lines (33 loc) · 1013 Bytes
/
Copy pathTreeIterator.h
File metadata and controls
45 lines (33 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// TreeIterator.h
// Character Utility
//
// Created by Mark Heiple on 4/17/12.
// Copyright (c) 2012 Mark Heiple. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface TreeIterator : NSObject {
NSArray *arrayOfNodes;
NSString *childKeyPath;
//change to use an NSIndexPath
NSIndexPath *i;
}
+ (id) iteratorWithArray:(NSArray*)array withChildKeyPath:(NSString*)path;
- (id) initWithArray:(NSArray*)array withChildKeyPath:(NSString*)path;
//for iterating through the array and children
- (id)startAtIndex:(NSInteger)pos;
//descend/ascend
- (id)descend;
- (id)ascend;
- (id)first;
- (id)next;
- (id)nextChild; //only enumerate the current child
//warning! the returned index is NOT retained.
//all iteratating methods will release it (descent/ascend, first/next/nextChild)
- (NSIndexPath*)index;
- (void) setIndex:(NSIndexPath*)path;
- (id)objectAtIndexPath:(NSIndexPath*)path;
- (id)parentAtIndexPath:(NSIndexPath*)path;
- (id)parent;
- (id)object;
@end