ETInstanceVariableMirror class documentationETInstanceVariableMirror : NSObject <ETInstanceVariableMirror, ETCollection>
ETInstanceVariableMirror implements the collection protocol to allow ivar content to be recursively traversed when ivars are presented in a UI inspector. For example,the inspector can use an outline view which makes possible to look at the "subivars" that makes up the object which corresponds to each ivar value.
If the ivar isn't an object type, the ivar is not traversable.
See also ETViewModelLayout in EtoileUI.
- - (id) initWithIvar: (Ivar)ivar ownerMirror: (id <ETMirror>)aMirror
- - (id <ETMirror>) ownerMirror
Returns the mirror representing the runtime construct where the instance variable is declared or located.
- - (ETUTI *) type
Returns the object type of the instance variable as an UTI.
- - (NSString *) typeName
Returns either class name or the type encoding name of the instance variable. The class name is returned when the value is an object, otherwise the the type encoding name is returned.
If -value returns nil and the type encoding denotes an object, take note the type encoding name is returned since the object type can only be looked up dynamically (by querying the object referenced by the instance variable).
- - (const char*) typeEncoding
Returns the underlying runtime basic type (object, int, char, struct etc.) associated with the instance variable.
These runtime basic types are encoded as character sequences. To interpret the returned value, see the runtime documentation.
- - (id) value
Returns the value stored in the instance variable.
If the instance variable type is a primitive type, nil is returned, unless the type encoding corresponds to a number or a structure such as NSRect, NSSize, NSPoint and NSRange. In this case, the returned value is respectively an NSNumber or NSValue object that boxes the primitive value.
- - (void) setValue: (id)value
Sets the value stored in the instance variable.
If the instance variable type is a primitive type, the value cannot be set, unless the type encoding corresponds to a number or a structure such as NSRect, NSSize, NSPoint and NSRange. In this case, you can pass the primitive value boxed respectively in an NSNumber or NSValue object.
If value is an object and the instance variable type is a primitive type, in case no primitive value matching the expected type can be unboxed, an NSInvalidArgumentException is raised.
For example, if value is a NSString and the instance variable is a NSRect, the exception reason will be: NSString does not recognize the selector -rectValue .
- - (id <ETObjectMirror>) valueMirror
Returns a mirror representing the value stored in the instance variable when the value is an object.
Returns nil when the value is a primitive type.