summaryrefslogtreecommitdiffstats
path: root/Classes/HJWeakMutableArray.h
blob: 7637c910fb8913b420f564c34b1205aeda147cd1 (plain)
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
//
//  HJWeakMutableArray.h
//  hjlib
//
//  Copyright Hunter and Johnson 2009, 2010, 2011
//  HJCache may be used freely in any iOS or Mac application free or commercial.
//  May be redistributed as source code only if all the original files are included.
//  See http://www.markj.net/hjcache-iphone-image-cache/

#import <Foundation/Foundation.h>


/*
 A mutable array of weak references. Used so that we can hold 'back references' to objects
 without preventing those objects from getting deallocated by normal memory management.
 */
@interface HJWeakMutableArray : NSObject {
	NSMutableArray* array;
}

+(HJWeakMutableArray*) arrayWithCapacity:(int)capacity;
-(HJWeakMutableArray*) initWithCapacity:(int)capacity;

- (void) addObject:(id)anObject;
- (id) objectAtIndex:(int)i;
- (id) findObject:(id)obj;
- (void) removeObject:(id)obj;
- (int) count;
- (NSEnumerator*) objectEnumerator;

@end


@interface HJWeakMutableArrayEnumerator : NSEnumerator {
	NSEnumerator* arrayEnum;
}

-(HJWeakMutableArrayEnumerator*)initWithInternalArray:(NSArray*)array;

@end