@@ -12,10 +12,11 @@ #include #import "OFObject.h" enum of_number_type { + OF_NUMBER_BOOL, OF_NUMBER_CHAR, OF_NUMBER_SHORT, OF_NUMBER_INT, OF_NUMBER_LONG, OF_NUMBER_UCHAR, @@ -45,10 +46,11 @@ * \brief Provides a way to store a number in an object. */ @interface OFNumber: OFObject { union { + BOOL bool_; char char_; short short_; int int_; long long_; unsigned char uchar; @@ -74,10 +76,16 @@ double double_; } value; enum of_number_type type; } +/** + * \param bool_ A BOOL which the OFNumber should contain + * \return A new autoreleased OFNumber + */ ++ numberWithBool: (BOOL)bool_; + /** * \param char_ A char which the OFNumber should contain * \return A new autoreleased OFNumber */ + numberWithChar: (char)char_; @@ -224,10 +232,18 @@ * \param double_ A double which the OFNumber should contain * \return A new autoreleased OFNumber */ + numberWithDouble: (double)double_; +/** + * Initializes an already allocated OFNumber with the specified BOOL. + * + * \param bool_ A BOOL which the OFNumber should contain + * \return An initialized OFNumber + */ +- initWithBool: (BOOL)bool_; + /** * Initializes an already allocated OFNumber with the specified char. * * \param char_ A char which the OFNumber should contain * \return An initialized OFNumber @@ -430,10 +446,15 @@ * \return An enum of type of_number_type indicating the type of contained * number of the OFNumber */ - (enum of_number_type)type; +/** + * \return The OFNumber as a BOOL + */ +- (BOOL)boolValue; + /** * \return The OFNumber as a char */ - (char)charValue;