Differences From Artifact [704c371206]:
- File
src/OFSet.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 7397) [annotate] [blame] [check-ins using]
To Artifact [44df76d02e]:
- File
src/OFSet.m
— part of check-in
[ef8d57bd4e]
at
2016-06-05 20:37:10
on branch trunk
— Implement Key Value Coding for OFSet
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: 8348) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <stdlib.h> #import "OFSet.h" #import "OFSet_hashtable.h" #import "OFString.h" #import "OFArray.h" #import "OFXMLElement.h" static struct { Class isa; } placeholder; @interface OFSet_placeholder: OFSet @end | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <stdlib.h> #import "OFSet.h" #import "OFSet_hashtable.h" #import "OFString.h" #import "OFArray.h" #import "OFXMLElement.h" #import "OFNull.h" static struct { Class isa; } placeholder; @interface OFSet_placeholder: OFSet @end |
︙ | ︙ | |||
208 209 210 211 212 213 214 215 216 217 218 219 220 221 | OF_INVALID_INIT_METHOD } - (size_t)count { OF_UNRECOGNIZED_SELECTOR } - (bool)containsObject: (id)object { OF_UNRECOGNIZED_SELECTOR } - (OFEnumerator*)objectEnumerator | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | OF_INVALID_INIT_METHOD } - (size_t)count { OF_UNRECOGNIZED_SELECTOR } - (id)valueForKey: (OFString*)key { OFMutableSet *ret; if ([key hasPrefix: @"@"]) { void *pool = objc_autoreleasePoolPush(); id ret; key = [key substringWithRange: of_range(1, [key length] - 1)]; ret = [[super valueForKey: key] retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } ret = [OFMutableSet setWithCapacity: [self count]]; for (id object in self) { id value = [object valueForKey: key]; if (value != nil) [ret addObject: value]; } [ret makeImmutable]; return ret; } - (void)setValue: (id)value forKey: (OFString*)key { if ([key hasPrefix: @"@"]) { void *pool = objc_autoreleasePoolPush(); key = [key substringWithRange: of_range(1, [key length] - 1)]; [super setValue: value forKey: key]; objc_autoreleasePoolPop(pool); return; } if (value == [OFNull null]) value = nil; for (id object in self) [object setValue: value forKey: key]; } - (bool)containsObject: (id)object { OF_UNRECOGNIZED_SELECTOR } - (OFEnumerator*)objectEnumerator |
︙ | ︙ |