ETInstanceVariableMirror class documentation
ETInstanceVariableMirror : NSObject <ETInstanceVariableMirror, ETCollection>Overview
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.
Default
- - (id) initWithIvar: (Ivar)ivar ownerMirror: (id <ETMirror>)aMirror
Initializes and returns an instance variable mirror for the given runtime underlying representation and a owner mirror.
The owner mirror must conform to either ETClassMirror or ETObjectMirror protocols.
- + (id) mirrorWithIvar: (Ivar)ivar ownerMirror: (id <ETMirror>)aMirror
Returns a new autoreleased instance variable mirror for the given runtime underlying representation and an optional owner mirror.
See also -initWithIvar:ownerMirror: .
- - (id <ETMirror>) ownerMirror
Returns the mirror representing the runtime construct where the instance variable is declared or located.
- - (id <ETObjectMirror>) ownerObjectMirror
Returns the mirror representing the object where the instance variable is located and its value stored.
Will return nil when the owner mirror doesn't conform to ETObjectMirror protocol.
- - (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.