(klass)
| 362 | |
| 363 | |
| 364 | def getProperties(klass): |
| 365 | tmpString = """ |
| 366 | NSMutableArray *result = (id)[NSMutableArray array]; |
| 367 | unsigned int count; |
| 368 | objc_property_t *props = (objc_property_t *)class_copyPropertyList((Class)$cls, &count); |
| 369 | for (int i = 0; i < count; i++) { |
| 370 | NSMutableDictionary *dict = (id)[NSMutableDictionary dictionary]; |
| 371 | |
| 372 | char *name = (char *)property_getName(props[i]); |
| 373 | [dict setObject:(id)[NSString stringWithUTF8String:name] forKey:@"name"]; |
| 374 | |
| 375 | char *attrstr = (char *)property_getAttributes(props[i]); |
| 376 | [dict setObject:(id)[NSString stringWithUTF8String:attrstr] forKey:@"attributes_string"]; |
| 377 | |
| 378 | NSMutableDictionary *attrsDict = (id)[NSMutableDictionary dictionary]; |
| 379 | unsigned int pcount; |
| 380 | objc_property_attribute_t *attrs = (objc_property_attribute_t *)property_copyAttributeList(props[i], &pcount); |
| 381 | for (int i = 0; i < pcount; i++) { |
| 382 | NSString *name = (id)[NSString stringWithUTF8String:(char *)attrs[i].name]; |
| 383 | NSString *value = (id)[NSString stringWithUTF8String:(char *)attrs[i].value]; |
| 384 | [attrsDict setObject:value forKey:name]; |
| 385 | } |
| 386 | [dict setObject:attrsDict forKey:@"attributes"]; |
| 387 | |
| 388 | [result addObject:dict]; |
| 389 | } |
| 390 | RETURN(result); |
| 391 | """ |
| 392 | command = string.Template(tmpString).substitute(cls=klass) |
| 393 | propsJson = fb.evaluate(command) |
| 394 | return [Property(m) for m in propsJson] |
| 395 | |
| 396 | |
| 397 | class Property: |
no test coverage detected