Differences From Artifact [a881a5d8d9]:
- File src/OFArray.m — part of check-in [e0b9167693] at 2016-02-21 15:37:42 on branch trunk — Make use of C99-style for loops (user: js, size: 17010) [annotate] [blame] [check-ins using]
To Artifact [2d002f2918]:
- File
src/OFArray.m
— part of check-in
[05196e511a]
at
2016-06-05 15:00:33
on branch trunk
— Implement Key Value Coding for OFArray
If the key starts with an @, the @ is stripped and the super method is
called. Otherwise, this returns the value for all objects / sets the
value for all objects. (user: js, size: 17497) [annotate] [blame] [check-ins using]
︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + | #import "OFArray.h" #import "OFArray_subarray.h" #import "OFArray_adjacent.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFDataArray.h" #import "OFNull.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" static struct { Class isa; |
︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | OF_UNRECOGNIZED_SELECTOR } - (id)objectAtIndexedSubscript: (size_t)index { return [self objectAtIndex: index]; } - (id)valueForKey: (OFString*)key { OFMutableArray *ret = [OFMutableArray arrayWithCapacity: [self count]]; for (id object in self) { id value = [object valueForKey: key]; if (value == nil) value = [OFNull null]; [ret addObject: value]; } [ret makeImmutable]; return ret; } - (void)setValue: (id)value forKey: (OFString*)key { if (value == [OFNull null]) value = nil; for (id object in self) [object setValue: value forKey: key]; } - (size_t)indexOfObject: (id)object { size_t i = 0; if (object == nil) return OF_NOT_FOUND; |
︙ |