Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -73,11 +73,11 @@ */ @interface OFProperty: OFObject { OFString *_name; unsigned int _attributes; - OFString *_Nullable _getter, *_Nullable _setter; + OFString *_Nullable _getter, *_Nullable _setter, *_Nullable iVar; } /*! * @brief The name of the property. */ @@ -110,10 +110,15 @@ /*! * @brief The name of the setter. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *setter; +/*! + * @brief The name of the backing iVar. + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *iVar; + - (instancetype)init OF_UNAVAILABLE; @end /*! * @class OFInstanceVariable OFIntrospection.h ObjFW/OFIntrospection.h Index: src/OFIntrospection.m ================================================================== --- src/OFIntrospection.m +++ src/OFIntrospection.m @@ -134,11 +134,11 @@ } @end @implementation OFProperty @synthesize name = _name, attributes = _attributes; -@synthesize getter = _getter, setter = _setter; +@synthesize getter = _getter, setter = _setter, iVar = _iVar; - (instancetype)init { OF_INVALID_INIT_METHOD } @@ -183,10 +183,15 @@ while (*attributes != '\0') { const char *start; switch (*attributes) { + case 'T': + while (*attributes != ',' && + *attributes != '\0') + attributes++; + break; case 'R': _attributes |= OF_PROPERTY_READONLY; attributes++; break; case 'C': @@ -242,15 +247,25 @@ attributes++; break; case 'P': attributes++; break; - case 'T': - case 't': + case 'V': + start = ++attributes; + + if (_iVar != nil) + @throw [OFInitializationFailedException + exceptionWithClass: [self class]]; + while (*attributes != ',' && *attributes != '\0') attributes++; + + _iVar = [[OFString alloc] + initWithUTF8String: start + length: attributes - start]; + break; default: @throw [OFInitializationFailedException exceptionWithClass: [self class]]; } @@ -315,13 +330,14 @@ return [OFString stringWithFormat: @"<%@: %@\n" @"\tAttributes = 0x%03X\n" @"\tGetter = %@\n" @"\tSetter = %@\n" + @"\tiVar = %@\n" @">", [self class], _name, _attributes, - _getter, _setter]; + _getter, _setter, _iVar]; } - (bool)isEqual: (id)object { OFProperty *otherProperty;