Permalink
Browse files

don't need retain/release IMPs; pass tableview to object-attribute ca…

…llbacks for state-checking
  • Loading branch information...
1 parent f175bce commit 151f9df9939b2d977740f6283ab8ec759be521be Zachary Schneirov committed Dec 21, 2009
Showing with 4 additions and 22 deletions.
  1. +0 −3 FastListDataSource.h
  2. +4 −19 FastListDataSource.m
View
3 FastListDataSource.h
@@ -8,14 +8,11 @@
#import <Cocoa/Cocoa.h>
-
@interface FastListDataSource : NSObject {
id *objects;
NSUInteger count;
- IMP objRetain, objRelease;
}
-- (id)initWithClass:(Class)aClass;
- (const id *)immutableObjects;
- (NSUInteger)count;
View
23 FastListDataSource.m
@@ -7,26 +7,11 @@
//
#import "FastListDataSource.h"
+#import "NotesTableView.h"
#import "NoteAttributeColumn.h"
@implementation FastListDataSource
-- (id)initWithClass:(Class)aClass {
- if ([super init]) {
- objects = NULL;
- count = 0;
-
- if (![aClass instancesRespondToSelector:@selector(retain)] ||
- ![aClass instancesRespondToSelector:@selector(release)])
- return nil;
-
- objRetain = [aClass instanceMethodForSelector:@selector(retain)];
- objRelease = [aClass instanceMethodForSelector:@selector(release)];
- }
-
- return self;
-}
-
- (const id *)immutableObjects {
return (const id *)objects;
}
@@ -59,7 +44,7 @@ - (NSArray*)objectsAtFilteredIndexes:(NSIndexSet*)indexSet {
NSRange range = NSMakeRange([indexSet firstIndex],
[indexSet lastIndex]-[indexSet firstIndex]+1);
- NSMutableArray *objectsInIndexSet = [[NSMutableArray alloc] init];
+ NSMutableArray *objectsInIndexSet = [[NSMutableArray alloc] initWithCapacity:[indexSet count]];
while ((indexCount = [indexSet getIndexes:indexBuffer maxCount:40 inIndexRange:&range])) {
@@ -75,7 +60,6 @@ - (NSArray*)objectsAtFilteredIndexes:(NSIndexSet*)indexSet {
return [objectsInIndexSet autorelease];
}
-
//as long as this class is only used for temporary display, we probably do not need to uncomment the retains and releases
- (void)fillArrayFromArray:(NSArray*)array {
@@ -135,7 +119,8 @@ - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
- return columnAttributeForObject((NoteAttributeColumn*)aTableColumn, objects[rowIndex]);
+
+ return columnAttributeForObject((NotesTableView*)aTableView, (NoteAttributeColumn*)aTableColumn, objects[rowIndex]);
}
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView {

0 comments on commit 151f9df

Please sign in to comment.