[TOC] [Prev] [Next]

ITKTclObj

Inherits From:
ITKValue : NSObject

Conforms To: NSObject (NSObject)

Declared in: itkTcl/ITKTclObj.h

Class Description

ITKTclObj is used for wrapping Tcl values in Objective-C objects. All the generic methods of ITKTclInterp that are formally declared as returning and accepting ITKValues will really return and accept ITKTclObj instances exclusively!

The native representation mentioned in the class description of ITKValue is defined to be a TclObj by the ITKTclObj class. TclObj is an equivalent type to Tcl_Obj *, which can be used with the low-level Tcl API exported by tcl.h. The Objective-C API should be sufficient for almost every purpose, though.

Class Methods

nullValue

+(ITKValue *)nullValue

Tcl by itself does not have the concept of a "null" value. It can easily be simulated, however, by designating one random TclObj as the null value and making sure it is never used in any other context. That's exactly what this method does: It will return an ITKTclObj wrapping one special, empty Tcl string (accessible via the global constant ItkObjCNullObj). The Tcl command objc:isNullObj will return 1 if passed this value, and 0 for any other value (including any empty string).

See also: - isNull

tclObj:

+(ITKTclObj *)tclObj:(TclObj)value

Creates and returns an ITKTclObj wrapping value.

See also: - initWithTclObj:

valueWithArray:

+(ITKValue *)valueWithArray:(NSArray *)values

Creates and returns an ITKTclObj wrapping a Tcl list composed of values, all of which have to be instances of ITKTclObj.

See also: - initWithArray:

valueWithNativeRep:

+(ITKValue *)valueWithNativeRep:(void *)value

Creates and returns an ITKTclObj wrapping value, which must be a valid TclObj.

See also: - initWithNativeRep:

Instance Methods

arrayValue

- (NSArray *)arrayValue

Converts the wrapped value to a Tcl list and returns its elements as an NSArray of ITKTclObj's. Raises an exception if unsuccessful.

initWithArray:

-(ITKValue *)initWithArray:(NSArray *)values

Initializes a newly created ITKTclObj with a Tcl list composed of values, all of which have to be instances of ITKTclObj.

See also: + valueWithArray:

initWithNativeRep:

-(ITKValue *)initWithNativeRep:(void *)value

Initializes a newly created ITKTclObj with value, which must be a valid TclObj.

See also: + valueWithNativeRep:

initWithTclObj:

-(ITKTclObj *)initWithTclObj:(TclObj)value

Initializes a newly created ITKTclObj with value.

See also: + tclObj:

isNull

- (BOOL)isNull

Returns YES if the wrapped value equals ItkObjCNullObj.

See also: + nullValue

nativeRep

- (void *)nativeRep

Returns the TclObj wrapped by the receiver. You won't ever need to use this method unless you want to use the low-level Tcl API exported by tcl.h, and even then you should consider calling the tclObj method instead, since it already has the correct prototype.

tclObj

- (TclObj)tclObj

Returns the TclObj wrapped by the receiver.



[TOC] [Prev] [Next]

Copyright © 1999, AAA+ Software. All rights reserved.