Overview
Comment: | Add -[valueForKeyPath:] / -[setValue:forKeyPath:] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d7824704f9f1cde1a54fa570747d1b17 |
User & Date: | js on 2019-03-23 22:03:15 |
Other Links: | manifest | tags |
Context
2019-03-24
| ||
13:19 | Derive of_std{in,out,err} from std{in,out,err} check-in: 0f8a72d43c user: js tags: trunk | |
2019-03-23
| ||
22:03 | Add -[valueForKeyPath:] / -[setValue:forKeyPath:] check-in: d7824704f9 user: js tags: trunk | |
14:44 | ofhash: Add language dir before parsing options check-in: df94d134d9 user: js tags: trunk | |
Changes
Modified src/OFArray.h from [366448c221] to [f538b1be6a].
︙ | |||
228 229 230 231 232 233 234 | 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 | - - - - + + + + - - - + - - + | */ - (ObjectType)objectAtIndex: (size_t)index; - (ObjectType)objectAtIndexedSubscript: (size_t)index; /*! * @brief Returns the value for the specified key * |
︙ |
Modified src/OFArray.m from [58353278e7] to [d37721f3e3].
︙ | |||
274 275 276 277 278 279 280 | 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 | - - - + - - + - - - - - - - - - - - - - - - - | return [self objectAtIndex: idx]; } - (id)valueForKey: (OFString *)key { id ret; |
︙ |
Modified src/OFDictionary.h from [236193e334] to [d1fb2089af].
︙ | |||
211 212 213 214 215 216 217 | 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 | - - - - + + + - - - - - + + - + | - (nullable ObjectType)objectForKey: (KeyType)key; - (nullable ObjectType)objectForKeyedSubscript: (KeyType)key; /*! * @brief Returns the value for the given key or `nil` if the key was not * found. * |
︙ |
Modified src/OFDictionary.m from [f5551c8463] to [17f313b4bd].
︙ | |||
346 347 348 349 350 351 352 | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | - - - - + - - + - - - - - - - - - - - - - - - - | - (id)objectForKeyedSubscript: (id)key { return [self objectForKey: key]; } - (id)valueForKey: (OFString *)key { |
︙ |
Modified src/OFKeyValueCoding.h from [e174eddd08] to [240832dbe1].
︙ | |||
27 28 29 30 31 32 33 | 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - + + + + + + + + + - + - + + + + + + + + + + | * @brief A protocol for Key Value Coding. * * Key Value Coding makes it possible to access properties dynamically using * the interface described by this protocol. */ @protocol OFKeyValueCoding /*! |
︙ |
Modified src/OFObject+KeyValueCoding.m from [96857463c3] to [3ce407bdca].
︙ | |||
17 18 19 20 21 22 23 24 | 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + - - + + + - + + + - + + + + - + + + | #include "config.h" #include <stdlib.h> #import "OFObject.h" #import "OFObject+KeyValueCoding.h" #import "OFArray.h" #import "OFMethodSignature.h" |
︙ | |||
103 104 105 106 107 108 109 110 111 112 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | + + + + + - + + + + + + + + + + + + + + + + + + - - + + | CASE('I', unsigned int, numberWithUnsignedInt:) CASE('L', unsigned long, numberWithUnsignedLong:) CASE('Q', unsigned long long, numberWithUnsignedLongLong:) CASE('f', float, numberWithFloat:) CASE('d', double, numberWithDouble:) #undef CASE default: objc_autoreleasePoolPop(pool); return [self valueForUndefinedKey: key]; } [ret retain]; objc_autoreleasePoolPop(pool); |
︙ | |||
153 154 155 156 157 158 159 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | + - - + + + | methodSignature = [self methodSignatureForSelector: selector]; if (methodSignature == nil || methodSignature.numberOfArguments != 3 || *methodSignature.methodReturnType != 'v' || *[methodSignature argumentTypeAtIndex: 0] != '@' || *[methodSignature argumentTypeAtIndex: 1] != ':') { objc_autoreleasePoolPop(pool); |
︙ | |||
198 199 200 201 202 203 204 | 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 | + - - + + + + + + + + + + + + + + + + + + + + + + + + | CASE('I', unsigned int, unsignedIntValue) CASE('L', unsigned long, unsignedLongValue) CASE('Q', unsigned long long, unsignedLongLongValue) CASE('f', float, floatValue) CASE('d', double, doubleValue) #undef CASE default: objc_autoreleasePoolPop(pool); |
︙ |
Modified src/OFSet.h from [5e61cccf26] to [2986242031].
︙ | |||
213 214 215 216 217 218 219 | 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 | - - - - + + + - - - + - - + | * @return A boolean whether the set contains the specified object */ - (bool)containsObject: (ObjectType)object; /*! * @brief Returns the value for the specified key * |
︙ |
Modified src/OFSet.m from [136b012e98] to [a05b34b142].
︙ | |||
212 213 214 215 216 217 218 | 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 | - - - + - - + - - - - - - - - - - - - - - - - | OF_UNRECOGNIZED_SELECTOR } - (id)valueForKey: (OFString *)key { id ret; |
︙ |
Modified tests/OFObjectTests.m from [cc12013248] to [d457d186e1].
︙ | |||
246 247 248 249 250 251 252 253 254 255 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | + + + + + + + + + + + + + + | [m floatValue] == 110 && [m doubleValue] == 120) EXPECT_EXCEPTION(@"Catch -[setValue:forKey:] with nil key for scalar", OFInvalidArgumentException, [m setValue: (id _Nonnull)nil forKey: @"intValue"]) TEST(@"-[valueForKeyPath:]", (m = [[[MyObj alloc] init] autorelease]) && (m.objectValue = [[[MyObj alloc] init] autorelease]) && R([m.objectValue setObjectValue: [[[MyObj alloc] init] autorelease]]) && R([[m.objectValue objectValue] setDoubleValue: 0.5]) && [[m valueForKeyPath: @"objectValue.objectValue.doubleValue"] doubleValue] == 0.5) TEST(@"[-setValue:forKeyPath:]", R([m setValue: [OFNumber numberWithDouble: 0.75] forKeyPath: @"objectValue.objectValue.doubleValue"]) && [[[m objectValue] objectValue] doubleValue] == 0.75) [pool drain]; } @end |