- Inherits from:
- Object
- Conforms to:
- DTextable
- Declared in:
- DValue.h
Object
|
+---DValue
Class Description
The value class implements an union of basic data types. The class stores
the current type of the storage and the value. This class also implements
type conversion between the different types of storage.
- Last modified:
- 23-Jul-2006 (DValue.h)
Instance Variables
- private int _type
- the value type
- private union { Class _class
- the class
- private id _object
- the (general) object reference
- private SEL _sel
- the selector
- private BOOL _bool
- the boolean
- private int _int
- the integer
- private long _long
- the long integer
- private double _double
- the double
- private DText *_text
- the string
- private } _value
- Constructors
- - (DValue *) init
- Initialise to empty value
- Returns:
- the object
- Copy related methods
- - shallowCopy
- Do a shallow copy of the object
- Returns:
- the object
- Deconstructor
- - free
- Free the object
- Returns:
- the object
- Member methods
- - (DValue *) empty
- Empty the value
- Returns:
- the object
- - (BOOL) isEmpty
- Check if the value is without a value
- Returns:
- is the value empty ?
- - (int) type
- Return the type of the value
- Returns:
- the type of the value (DVL_...)
- - (const char *) typeString
- Return a string specifying the type of the value
- Returns:
- the type string
- Set methods
- - (DValue *) setBool :(BOOL) value
- Set the value to a boolean
- Parameters:
- value - the boolean
- Returns:
- the object
- - (DValue *) setClass :(Class) value
- Set the value to a class
- Parameters:
- value - the class
- Returns:
- the object
- - (DValue *) setDouble :(double) value
- Set the value to a double
- Parameters:
- value - the double
- Returns:
- the object
- - (DValue *) setInt :(int) value
- Set the value to an integer
- Parameters:
- value - the integer
- Returns:
- the object
- - (DValue *) setLong :(long) value
- Set the value to a long
- Parameters:
- value - the long
- Returns:
- the object
- - (DValue *) setObject :(id) value
- Set the value to a reference of an object. The object will NOT be
freed when the value is freed.
- Parameters:
- value - the reference to the object
- Returns:
- the object
- - (DValue *) setSel :(SEL) value
- Set the value to a selector
- Parameters:
- value - the selector
- Returns:
- the object
- - (DValue *) setString :(const char *) value
- Set the value to a c-string
- Parameters:
- value - the c-string
- Returns:
- the object
- Get methods
- - (BOOL) getBool
- Return the boolean in the value
- Returns:
- the boolean (or NO)
- - (Class) getClass
- Return the class in the value
- Returns:
- the class (or Nil)
- - (double) getDouble
- Return the double in the value
- Returns:
- the double (or 0.0)
- - (int) getInt
- Return the integer in the value
- Returns:
- the integer (or 0)
- - (long) getLong
- Return the long in the value
- Returns:
- the long (or 0)
- - (id) getObject
- Return the reference in the value
- Returns:
- the object (or nil)
- - (SEL) getSel
- Return the selector in the value
- Returns:
- the selector (or NULL)
- - (const char *) getString
- Return the c-string in the value
- Returns:
- the c-string (or NULL)
- Conversion methods
- - (BOOL) toBool
- Convert the value to a boolean: class and sel returns NO, object tries toBool, int, long and
double return true if not 0/NULL, string is scanned for contents
- Returns:
- the boolean (or NO)
- - (Class) toClass
- Convert the value to a class: Nil for selector, boolean, integer, long,
double and string.
- Returns:
- the class (or Nil)
- - (double) toDouble
- Convert the value to a double: class and sel return 0, object tries toDouble,
bool, int and long are type casted to double, string is read for an double
- Returns:
- the double (or 0.0)
- - (int) toInt
- Convert the value to an integer: class and sel return 0, object tries toInt,
bool, long and double are type casted to int, string is read for an int
- Returns:
- the integer (or 0)
- - (long) toLong
- Convert the value to a long: class and sel return 0, object tries toLong,
bool, int and double are type casted to long, string is read for an int
- Returns:
- the long (or 0)
- - (id) toObject
- Convert the value to a (new) object: a copy for an object reference, nil for selector,
DBool object for boolean, DInt object for integer, DLong object for long, DDouble object
for double and DText for string.
- Returns:
- the (new) object (or nil)
- - (SEL) toSel
- Convert the value to a selector: NULL is returned if value is not a selector
- Returns:
- the selector (or NULL)
- - (DText *) toText
- Convert the value to a string: class and sel return nil, object tries toText,
bool, int, long and double do toText, string is copied
- Returns:
- a (new) text objecct
generated 25-Jul-2006 by ObjcDoc 3.0.0