13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#import "OFArray.h"
#import "OFExceptions.h"
@implementation OFArray
+ array
{
return [[[OFArray alloc] init] autorelease];
}
- init
{
self = [super init];
@try {
|
|
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#import "OFArray.h"
#import "OFExceptions.h"
@implementation OFArray
+ array
{
return [[[self alloc] init] autorelease];
}
- init
{
self = [super init];
@try {
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
- (id)last
{
return *((OFObject**)[array last]);
}
- add: (OFObject*)obj
{
[array add: &obj];
[obj retain];
return self;
}
- removeNObjects: (size_t)nobjects
{
OFObject **objs;
size_t len, i;
objs = [array data];
len = [array count];
if (nobjects > len)
@throw [OFOutOfRangeException newWithClass: isa];
for (i = len - nobjects; i < len; i++)
[objs[i] release];
[array removeNItems: nobjects];
return self;
}
- (void)dealloc
{
OFObject **objs;
size_t len, i;
|
<
<
|
|
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
- (id)last
{
return *((OFObject**)[array last]);
}
- add: (OFObject*)obj
{
@throw [OFNotImplementedException newWithClass: isa
andSelector: _cmd];
}
- removeNObjects: (size_t)nobjects
{
@throw [OFNotImplementedException newWithClass: isa
andSelector: _cmd];
}
- (void)dealloc
{
OFObject **objs;
size_t len, i;
|