Differences From Artifact [7b45e24981]:
- File
src/OFArray.m
— part of check-in
[95e8e1e486]
at
2012-06-10 16:03:01
on branch trunk
— Add a few array methods.
OFArray:
* +[arrayByAddingObject:]
* +[arrayByAddingObjectsFromArray:]OFMutableArray:
* -[addObjectsFromArray:]
* -[insertObjectsFromArray:atIndex:] (user: js, size: 14254) [annotate] [blame] [check-ins using] [more...]
To Artifact [e58f6deb57]:
- File src/OFArray.m — part of check-in [8892ae9fcc] at 2012-07-12 01:28:46 on branch trunk — Don't access isa directly. (user: js, size: 14388) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
99 100 101 102 103 104 105 | - (void)release { } - (void)dealloc { | | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - (void)release { } - (void)dealloc { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; [super dealloc]; /* Get rid of a stupid warning */ } @end @implementation OFArray + (void)initialize { if (self == [OFArray class]) object_setClass((id)&placeholder, [OFArray_placeholder class]); } + alloc { if (self == [OFArray class]) return (id)&placeholder; |
︙ | ︙ | |||
157 158 159 160 161 162 163 | { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } - init { | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } - init { if (object_getClass(self) == [OFArray class]) { Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } return [super init]; } |
︙ | ︙ | |||
188 189 190 191 192 193 194 | return ret; } - initWithObject: (id)firstObject arguments: (va_list)arguments { | | | | | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | return ret; } - initWithObject: (id)firstObject arguments: (va_list)arguments { Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } - initWithArray: (OFArray*)array { Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } - initWithObjects: (id const*)objects count: (size_t)count { Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } - initWithSerialization: (OFXMLElement*)element { Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } - (size_t)count { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (void)getObjects: (id*)buffer inRange: (of_range_t)range { size_t i; |
︙ | ︙ | |||
263 264 265 266 267 268 269 | - mutableCopy { return [[OFMutableArray alloc] initWithArray: self]; } - (id)objectAtIndex: (size_t)index { | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - mutableCopy { return [[OFMutableArray alloc] initWithArray: self]; } - (id)objectAtIndex: (size_t)index { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (id)objectAtIndexedSubscript: (size_t)index { return [self objectAtIndex: index]; } |
︙ | ︙ | |||
567 568 569 570 571 572 573 | objects: (id*)objects count: (int)count_ { /* FIXME: Use -[getObjects:inRange:] on the passed objects */ size_t count = [self count]; if (count > INT_MAX) | | | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | objects: (id*)objects count: (int)count_ { /* FIXME: Use -[getObjects:inRange:] on the passed objects */ size_t count = [self count]; if (count > INT_MAX) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; if (state->state >= count) return 0; state->state = count; state->itemsPtr = [self objects]; state->mutationsPtr = (unsigned long*)self; |
︙ | ︙ | |||
725 726 727 728 729 730 731 | [super dealloc]; } - (id)nextObject { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException | | | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | [super dealloc]; } - (id)nextObject { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException exceptionWithClass: [self class] object: array]; if (position < count) return [array objectAtIndex: position++]; return nil; } - (void)reset { if (mutationsPtr != NULL && *mutationsPtr != mutations) @throw [OFEnumerationMutationException exceptionWithClass: [self class] object: array]; position = 0; } @end |