[TOC] [Prev] [Next]

ITKValue

Inherits From:
NSObject

Conforms To: NSObject (NSObject)

Declared in: itkRuntime/ITKValue.h

Class Description

ITKValue is an abstract class for wrapping some scripting language's native representation of a value in an Objective-C object and accessing that value in a variety of formats. Concrete subclasses of ITKValue will override some of its methods in terms of the API for a specific scripting language.

The instance method scriptingLanguage will return an object conforming to the ITKScriptingLanguage protocol that can be used to access meta information about the language which the wrapped value comes from.

Creating instances
+ valueWithNativeRep:
+ valueWithString:
+ valueWithBytes:objCType:
+ valueWithObject:
+ valueWithPointer:
+ valueWithPointer:toObjCType:
+ valueWithChar:
+ valueWithUnsignedChar:
+ valueWithShort:
+ valueWithUnsignedShort:
+ valueWithInt:
+ valueWithUnsignedInt:
+ valueWithLong:
+ valueWithUnsignedLong:
+ valueWithLongLong:
+ valueWithUnsignedLongLong:
+ valueWithFloat:
+ valueWithDouble:
+ valueWithBool:
+ valueWithArray:
- initWithNativeRep:
- initWithString:
- initWithBytes:objCType:
- initWithArray:
Accessing the value
- nativeRep
- stringValue
- getValue:objCType:
- objectValue
- pointerValue
- charValue
- unsignedCharValue
- shortValue
- unsignedShortValue
- intValue
- unsignedIntValue
- longValue
- unsignedLongValue
- longLongValue
- unsignedLongLongValue
- floatValue
- doubleValue
- boolValue
- arrayValue
Getting the value in source code form
- source
Null values
+ nullValue
- isNull
Getting meta information about the scripting language
- scriptingLanguage

Class Methods

nullValue

+(ITKValue *)nullValue

Implemented by concrete subclasses to return the scripting language's closest equivalent to a null, undefined, or void value. The isNull method is guaranteed to return YES for the ITKValue returned from this method.

See also: - isNull

valueWithArray:

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

Creates and returns the concrete scripting language's closest equivalent to a list, array, or similar ordered sequence composed of values, all of which have to be of the same ITKValue subclass this message is sent to.

See also: - initWithArray:

valueWithBool:

+(ITKValue *)valueWithBool:(BOOL)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithBytes:objCType:

+(ITKValue *)valueWithBytes:(void *)value objCType:(const char *)type

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value, which is interpreted as being of the Objective-C type type. type should be created with the Objective-C @encode() compiler directive; it shouldn't be hard-coded as a C string.

See also: - initWithBytes:objCType:

valueWithChar:

+(ITKValue *)valueWithChar:(char)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithDouble:

+(ITKValue *)valueWithDouble:(double)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithFloat:

+(ITKValue *)valueWithFloat:(float)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithInt:

+(ITKValue *)valueWithInt:(int)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithLong:

+(ITKValue *)valueWithLong:(long)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithLongLong:

+(ITKValue *)valueWithLongLong:(long long)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithNativeRep:

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

Creates and returns an ITKValue wrapping value, which is taken to be the native representation of some value in the concrete scripting language.

See also: - initWithNativeRep:

valueWithObject:

+(ITKValue *)valueWithObject:(id)object

Creates and returns an ITKValue wrapping the concrete scripting language's representation of object.

valueWithPointer:

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

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithPointer:toObjCType:

+(ITKValue *)valueWithPointer:(void *)addr toObjCType:(const char *)type

Creates and returns an ITKValue wrapping the concrete scripting language's representation of a pointer pointing to the Objective-C type type at address addr. type should be created with the Objective-C @encode() compiler directive; it shouldn't be hard-coded as a C string.

valueWithShort:

+(ITKValue *)valueWithShort:(short)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithString:

+(ITKValue *)valueWithString:(NSString *)string

Creates and returns an ITKValue wrapping the concrete scripting language's representation of string.

See also: - initWithString:

valueWithUnsignedChar:

+(ITKValue *)valueWithUnsignedChar:(unsigned char)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithUnsignedInt:

+(ITKValue *)valueWithUnsignedInt:(unsigned int)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithUnsignedLong:

+(ITKValue *)valueWithUnsignedLong:(unsigned long)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithUnsignedLongLong:

+(ITKValue *)valueWithUnsignedLongLong:(unsigned long long)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

valueWithUnsignedShort:

+(ITKValue *)valueWithUnsignedShort:(unsigned short)value

Creates and returns an ITKValue wrapping the concrete scripting language's representation of value.

Instance Methods

arrayValue

- (NSArray *)arrayValue

Implemented by concrete subclasses to convert the wrapped value to the scripting language's closest equivalent of a list, array, or similar ordered sequence of values and return the components of that sequence as an NSArray of ITKValues, all of which are of the same class as the receiving object. Raises an exception if unsuccessful.

boolValue

- (BOOL)boolValue

Returns the result of converting the wrapped value to a BOOL. Raises an exception if unsuccessful.

charValue

- (char)charValue

Returns the result of converting the wrapped value to a char. Raises an exception if unsuccessful.

doubleValue

- (double)doubleValue

Returns the result of converting the wrapped value to a double. Raises an exception if unsuccessful.

floatValue

- (float)floatValue

Returns the result of converting the wrapped value to a float. Raises an exception if unsuccessful.

getValue:objCType:

- (void)getValue:(void *)buffer objCType:(const char *)type

Implemented by concrete subclasses to interpret the wrapped value as the Objective-C type type and store the result in buffer. type should be created with the Objective-C @encode() compiler directive; it shouldn't be hard-coded as a C string. buffer should be large enough to hold the value. Raises an exception if unsuccessful.

initWithArray:

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

Implemented by concrete subclasses to initialize a newly created ITKValue with the scripting language's closest equivalent to a list, array, or similar ordered sequence composed of values, all of which have to be of the same ITKValue subclass as the receiver.

See also: + valueWithArray:

initWithBytes:objCType:

-(ITKValue *)initWithBytes:(void *)value objCType:(const char *)type

Implemented by concrete subclasses to initialize a newly created ITKValue with the scripting language's representation of value, which is interpreted as being of the Objective-C type type. type should be created with the Objective-C @encode() compiler directive; it shouldn't be hard-coded as a C string.

See also: + valueWithBytes:objCType:

initWithNativeRep:

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

Implemented by concrete subclasses to initialize a newly created ITKValue with value, which is taken to be the native representation of some value in the concrete scripting language.

See also: + valueWithNativeRep:

initWithString:

-(ITKValue *)initWithString:(NSString *)string

Implemented by concrete subclasses to initialize a newly created ITKValue with the scripting language's representation of string.

See also: + valueWithString:

intValue

- (int)intValue

Returns the result of converting the wrapped value to an int. Raises an exception if unsuccessful.

isNull

- (BOOL)isNull

Implemented by concrete subclasses to return YES if the wrapped value equals the scripting language's closest equivalent to a null, undefined, or void value.

See also: + nullValue

longLongValue

- (long long)longLongValue

Returns the result of converting the wrapped value to a long long. Raises an exception if unsuccessful.

longValue

- (long)longValue

Returns the result of converting the wrapped value to a long. Raises an exception if unsuccessful.

nativeRep

- (void *)nativeRep

Implemented by concrete subclasses to return the native representation wrapped by the receiver. You won't ever need to use this method unless you want to use the low-level API of some scripting language.

objectValue

- (id)objectValue

Returns the result of converting the wrapped value to an Objective-C id. Raises an exception if unsuccessful.

pointerValue

- (void *)pointerValue

Returns the result of converting the wrapped value to a pointer. Raises an exception if unsuccessful.

scriptingLanguage

- (id <ITKScriptingLanguage>)scriptingLanguage

Implemented by concrete subclasses to return an ITKScriptingLanguage conforming object providing meta information about the language which the wrapped value comes from.

shortValue

- (short)shortValue

Returns the result of converting the wrapped value to a short. Raises an exception if unsuccessful.

source

- (NSString *)source

Implemented by concrete subclasses to return a string, which, when evaluated as a script in the corresponding scripting language, will result in the original value. Raises an exception if unsuccessful.

stringValue

- (NSString *)stringValue

Implemented by concrete subclasses to return the result of converting the wrapped value to a string. Raises an exception if unsuccessful.

unsignedCharValue

- (unsigned char)unsignedCharValue

Returns the result of converting the wrapped value to an unsigned char. Raises an exception if unsuccessful.

unsignedIntValue

- (unsigned int)unsignedIntValue

Returns the result of converting the wrapped value to an unsigned int. Raises an exception if unsuccessful.

unsignedLongLongValue

- (unsigned long long)unsignedLongLongValue

Returns the result of converting the wrapped value to an unsigned long long. Raises an exception if unsuccessful.

unsignedLongValue

- (unsigned long)unsignedLongValue

Returns the result of converting the wrapped value to an unsigned long. Raises an exception if unsuccessful.

unsignedShortValue

- (unsigned short)unsignedShortValue

Returns the result of converting the wrapped value to an unsigned short. Raises an exception if unsuccessful.



[TOC] [Prev] [Next]

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