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
46
47
48
49
|
* file.
*/
#import "NSArray_OFArray.h"
#import "OFArray.h"
#import "OFBridging.h"
@implementation NSArray_OFArray
- initWithOFArray: (OFArray*)array_
{
if ((self = [super init]) != nil) {
@try {
array = [array_ retain];
} @catch (id e) {
return nil;
}
}
return self;
}
- (id)objectAtIndex: (size_t)index
{
id object = [array objectAtIndex: index];
if ([object conformsToProtocol: @protocol(OFBridging)])
return [object NSObject];
return object;
}
- (size_t)count
{
return [array count];
}
@end
|
>
>
|
|
|
|
>
>
>
>
>
|
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
46
47
48
49
50
51
52
53
54
55
56
|
* file.
*/
#import "NSArray_OFArray.h"
#import "OFArray.h"
#import "OFBridging.h"
#import "OFOutOfRangeException.h"
@implementation NSArray_OFArray
- initWithOFArray: (OFArray*)array_
{
if ((self = [super init]) != nil) {
@try {
array = [array_ retain];
} @catch (id e) {
return nil;
}
}
return self;
}
- (id)objectAtIndex: (NSUInteger)index
{
id object = [array objectAtIndex: index];
if ([object conformsToProtocol: @protocol(OFBridging)])
return [object NSObject];
return object;
}
- (NSUInteger)count
{
size_t count = [array count];
if (count > NSUIntegerMax)
@throw [OFOutOfRangeException exceptionWithClass: [self class]];
return (NSUInteger)count;
}
@end
|