DekGenius.com
[ Team LiB ] Previous Section Next Section

NSNumber Mac OS X 10.0

NSNumber is a wrapper class for the C primitive numeric data types. Using this class, clients can store values of primitive data types, such as int and float, in Cocoa collection classes such as NSArray or NSDictionary, which only handle Objective-C objects.

figs/cocn_1371.gif

@interface NSNumber : NSValue
 // Convenience Constructors
   + (NSNumber *)numberWithBool:(BOOL)value;
   + (NSNumber *)numberWithChar:(char)value;
   + (NSNumber *)numberWithDouble:(double)value;
   + (NSNumber *)numberWithFloat:(float)value;
   + (NSNumber *)numberWithInt:(int)value;
   + (NSNumber *)numberWithLong:(long)value;
   + (NSNumber *)numberWithLongLong:(long long)value;
   + (NSNumber *)numberWithShort:(short)value;
   + (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
   + (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
   + (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
   + (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
   + (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
 // Initializers
   - (id)initWithBool:(BOOL)value;
   - (id)initWithChar:(char)value;
   - (id)initWithDouble:(double)value;
   - (id)initWithFloat:(float)value;
   - (id)initWithInt:(int)value;
   - (id)initWithLong:(long)value;
   - (id)initWithLongLong:(long long)value;
   - (id)initWithShort:(short)value;
   - (id)initWithUnsignedChar:(unsigned char)value;
   - (id)initWithUnsignedInt:(unsigned int)value;
   - (id)initWithUnsignedLong:(unsigned long)value;
   - (id)initWithUnsignedLongLong:(unsigned long long)value;
   - (id)initWithUnsignedShort:(unsigned short)value;
 // Instance Methods
   - (BOOL)boolValue;
   - (char)charValue;
   - (NSComparisonResult)compare:(NSNumber *)otherNumber;
   - (NSDecimal)decimalValue;
   - (NSString *)descriptionWithLocale:(NSDictionary *)locale;
   - (double)doubleValue;
   - (float)floatValue;
   - (int)intValue;
   - (BOOL)isEqualToNumber:(NSNumber *)number;
   - (long long)longLongValue;
   - (long)longValue;
   - (short)shortValue;
   - (NSString *)stringValue;
   - (unsigned char)unsignedCharValue;
   - (unsigned int)unsignedIntValue;
   - (unsigned long long)unsignedLongLongValue;
   - (unsigned long)unsignedLongValue;
   - (unsigned short)unsignedShortValue;

Subclasses

NSDecimalNumber

    [ Team LiB ] Previous Section Next Section