Up

NSValue class reference

Authors

Adam Fedor (fedor@boulder.colorado.edu)
Richard Frith-Macdonald (rfm@gnu.org)

Version: 37003

Date: 2013-08-22 16:44:54 +0100 (Thu, 22 Aug 2013)

Copyright: (C) 1993, 1994, 1996, 1999 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSNumber class
  2. Software documentation for the NSValue class
  3. Software documentation for the NSValue(Subclassing) category

Software documentation for the NSNumber class

NSNumber : NSValue

Declared in:
Foundation/NSValue.h
Conforms to:
NSCopying
NSCoding
Availability: OpenStep

Subclass of NSValue offering convenience methods for initializing from and accessing as any C primitive numeric type. On access, the value will be type-converted if necessary, using standard C conversion rules.
Method summary

numberWithBool: 

+ (NSNumber*) numberWithBool: (BOOL)value;
Availability: OpenStep

New instance from boolean value.

numberWithChar: 

+ (NSNumber*) numberWithChar: (signed char)value;
Availability: OpenStep

New instance from signed char value.

numberWithDouble: 

+ (NSNumber*) numberWithDouble: (double)value;
Availability: OpenStep

New instance from double value.

numberWithFloat: 

+ (NSNumber*) numberWithFloat: (float)value;
Availability: OpenStep

New instance from float value.

numberWithInt: 

+ (NSNumber*) numberWithInt: (signed int)value;
Availability: OpenStep

New instance from (signed) int value.

numberWithInteger: 

+ (NSNumber*) numberWithInteger: (NSInteger)value;
Availability: MacOS-X 10.5.0

Return a number intialised with NSInteger.

numberWithLong: 

+ (NSNumber*) numberWithLong: (signed long)value;
Availability: OpenStep

New instance from (signed) long value.

numberWithLongLong: 

+ (NSNumber*) numberWithLongLong: (signed long long)value;
Availability: OpenStep

New instance from (signed) long long value.

numberWithShort: 

+ (NSNumber*) numberWithShort: (signed short)value;
Availability: OpenStep

New instance from (signed) short value.

numberWithUnsignedChar: 

+ (NSNumber*) numberWithUnsignedChar: (unsigned char)value;
Availability: OpenStep

New instance from unsigned char value.

numberWithUnsignedInt: 

+ (NSNumber*) numberWithUnsignedInt: (unsigned int)value;
Availability: OpenStep

New instance from unsigned int value.

numberWithUnsignedInteger: 

+ (NSNumber*) numberWithUnsignedInteger: (NSUInteger)value;
Availability: MacOS-X 10.5.0

Return a number intialised with NSUInteger.

numberWithUnsignedLong: 

+ (NSNumber*) numberWithUnsignedLong: (unsigned long)value;
Availability: OpenStep

New instance from unsigned long value.

numberWithUnsignedLongLong: 

+ (NSNumber*) numberWithUnsignedLongLong: (unsigned long long)value;
Availability: OpenStep

New instance from unsigned long long value.

numberWithUnsignedShort: 

+ (NSNumber*) numberWithUnsignedShort: (unsigned short)value;
Availability: OpenStep

New instance from unsigned short value.

boolValue 

- (BOOL) boolValue;
Availability: OpenStep

Return value as a BOOL; this will in fact be a char value converted if necessary from type initialized with; if you wish to consider anything nonzero TRUE do not compare directly to YES, but use '!= NO'.

charValue 

- (signed char) charValue;
Availability: OpenStep

Returns value as a signed char, converting if necessary.

compare: 

- (NSComparisonResult) compare: (NSNumber*)otherNumber;
Availability: OpenStep

Compares receiver with otherNumber, using C type conversion if necessary, and returns NSOrderedAscending, NSOrderedDescending, or NSOrderedSame depending on whether it is less than, greater than, or equal to otherNumber.

description 

- (NSString*) description;
Availability: OpenStep

Returns the string representation of this number using a non-localised conversion (decimal point is '.' irrespective of the locale).

descriptionWithLocale: 

- (NSString*) descriptionWithLocale: (id)locale;
Availability: OpenStep

Produces a string representation of the number. For a boolean this will be either 'true' or 'false'. For other numbers the format is produced using the initWithFormat:locale:... method of NSString, and the format depends on the type of number as follows -

char
%i
short
%hi
int
%i
long
%li
long long
%lli
unsigned char
%u
unsigned short
%hu
unsigned int
%u
unsigned long
%lu
unsigned long long
%llu
float
%0.7g
double
%0.16g

doubleValue 

- (double) doubleValue;
Availability: OpenStep

Returns value as a double, converting if necessary.

floatValue 

- (float) floatValue;
Availability: OpenStep

Returns value as a float, converting if necessary.

initWithBool: 

- (id) initWithBool: (BOOL)value;
Availability: OpenStep

Initialize from boolean value.

initWithChar: 

- (id) initWithChar: (signed char)value;
Availability: OpenStep

Initialize from signed char value.

initWithDouble: 

- (id) initWithDouble: (double)value;
Availability: OpenStep

Initialize from double value.

initWithFloat: 

- (id) initWithFloat: (float)value;
Availability: OpenStep

Initialize from float value.

initWithInt: 

- (id) initWithInt: (signed int)value;
Availability: OpenStep

Initialize from (signed) int value.

initWithInteger: 

- (id) initWithInteger: (NSInteger)value;
Availability: MacOS-X 10.5.0

Initialise the receiver with NSInteger content.

initWithLong: 

- (id) initWithLong: (signed long)value;
Availability: OpenStep

Initialize from (signed) long value.

initWithLongLong: 

- (id) initWithLongLong: (signed long long)value;
Availability: OpenStep

Initialize from (signed) long long value.

initWithShort: 

- (id) initWithShort: (signed short)value;
Availability: OpenStep

Initialize from (signed) short value.

initWithUnsignedChar: 

- (id) initWithUnsignedChar: (unsigned char)value;
Availability: OpenStep

Initialize from unsigned char value.

initWithUnsignedInt: 

- (id) initWithUnsignedInt: (unsigned int)value;
Availability: OpenStep

Initialize from unsigned int value.

initWithUnsignedInteger: 

- (id) initWithUnsignedInteger: (NSUInteger)value;
Availability: MacOS-X 10.5.0

Initialise the receiver with NSUInteger content.

initWithUnsignedLong: 

- (id) initWithUnsignedLong: (unsigned long)value;
Availability: OpenStep

Initialize from unsigned long value.

initWithUnsignedLongLong: 

- (id) initWithUnsignedLongLong: (unsigned long long)value;
Availability: OpenStep

Initialize from unsigned long long value.

initWithUnsignedShort: 

- (id) initWithUnsignedShort: (unsigned short)value;
Availability: OpenStep

Initialize from unsigned short value.

intValue 

- (signed int) intValue;
Availability: OpenStep

Returns value as a (signed) int, converting if necessary.

integerValue 

- (NSInteger) integerValue;
Availability: MacOS-X 10.5.0

Return the contents of the receiver as NSInteger.

isEqualToNumber: 

- (BOOL) isEqualToNumber: (NSNumber*)otherNumber;
Availability: OpenStep

Returns whether receiver and otherNumber represent the same numerical value.

longLongValue 

- (signed long long) longLongValue;
Availability: OpenStep

Returns value as a (signed) long long, converting if necessary.

longValue 

- (signed long) longValue;
Availability: OpenStep

Returns value as a (signed) long, converting if necessary.

shortValue 

- (signed short) shortValue;
Availability: OpenStep

Returns value as a (signed) short, converting if necessary.

stringValue 

- (NSString*) stringValue;
Availability: OpenStep

Returns -description .

unsignedCharValue 

- (unsigned char) unsignedCharValue;
Availability: OpenStep

Returns value as an unsigned char, converting if necessary.

unsignedIntValue 

- (unsigned int) unsignedIntValue;
Availability: OpenStep

Returns value as an unsigned int, converting if necessary.

unsignedIntegerValue 

- (NSUInteger) unsignedIntegerValue;
Availability: MacOS-X 10.5.0

Return the contents of the receiver as NSUInteger.

unsignedLongLongValue 

- (unsigned long long) unsignedLongLongValue;
Availability: OpenStep

Returns value as an unsigned long long, converting if necessary.

unsignedLongValue 

- (unsigned long) unsignedLongValue;
Availability: OpenStep

Returns value as an unsigned long, converting if necessary.

unsignedShortValue 

- (unsigned short) unsignedShortValue;
Availability: OpenStep

Returns value as an unsigned short, converting if necessary.

Software documentation for the NSValue class

NSValue : NSObject

Declared in:
Foundation/NSValue.h
Conforms to:
NSCopying
NSCoding
Availability: OpenStep

The NSValue class can wrap a single primitive value as an object so it can be otherwisan be charValue;
Availability: OpenStep

NSNumber
: OpenStep

de using default C string encoding. The NSValue
-objece.html#method$NSnitWithUnsignedLong: (unsigned h="25%" primitive value as an object so it can be otherwisan be charValue;
Availability: OpenStep

NSNumber

NSCopying
NSCoding
Availability: OpenStep


escriptckquote>Avaass="availability">anner.html#method$NSScabr />


Returns the string reprtsoNumber: (NSNumber*)otherNumber;
Availability: OpenStep

Returns whether receiver and otherNumber represen>

URL gned "="leftel="gsdoc" href="#class$NSNumber">NSNiv>
Returns whether receiver and otherNumber represen>
ass="meth
  • +numberWithUnsignedChar:
  • NSCoding
  • Availability: OpenStep

    The NSValue class can wrap a single primitive value as an object so it can be Returns whether receiver and otherNumber ="availabiwhet"> Availability: OpenStep


    NSArray
    *)modes;
    Availability: Not in OpenStep/MacOS-X

    Opens an outgoing network connection "> Returns whether receiver and otherNumber$ GSSetLocaleC
    shing a OS-X

    "gsdoc" href="NSKey
    Returns whether receiver and otherNumber represen>

    unsignedCharValue 

    - (unsigned char) unsignedCharValue;
    shortValue;
    Avaunsi

    ass="meth unsignedCharValue <. rting if necessary.

    -_encodePropertyList:forKe superclass, its implementation of unsignedCharValue 

    - (unsigned char) unsignedCharValuNSNumbep

    Initialize from unsigned short value.


    inl="gsdoc" SUInteghtabiwhet"> Initialize from unsigned short value.


    Availability: OpenStep


    < value.


    unsigned short value.


    tion$GSSkipTypeQualifierAndLaft" /> shing a OS-X
    "gsdoc" href="NSKey
    Returns whether receiver and otherNumber ue.

    NSUInteger)value;
    Availability: MacOS-X 10.5.0

    shing a OS-X
    "gsdoc" href="NSKey
    Returns whether rece;

    Opens an outgoing network connection "> Returns whether receiver and otherNumber$ Number represen>

    unsignedCharValue 

    - (unsigned char) unsignednsigned name="method$NSNumbemselves to be serialized by an shing a OS-Xa rel="gsdoc" href="#class$NSValue">NSValue
    Declared in:
    Foundation/NSValue.h
    Conforms to:
    ethod$NSNumbemselves to be serialized by an shing a OS-Xa rel="gsdoc NSHashInsertKnownAbsent(NSHashTable* table, const void* element);
    mberWithUnsignedInt:
  • +numberWithUnsignedInteger:
  • Returns value as an unsigned long long, converting if necessary. >);
    mberWithUnsignedInt:
  • a> a>

  • Initialize from unsigned short value.

    initWithUnsignedInteger: 
    - (id) initWithUnsignedInteger: (NSUInteger)value;
    Availability: MacOS-X 10.5.0

    Initialise the receiver with NSUInteger content.

    Declared in:
    Foundation/NSValue.h
    "gsdoc" href="NSKey
    Returns whether rece;

    Opens an outgoing network connection "> Returns whetherInsertKnownAbsent(NSHashTable* <>

    Foundation/NSValue.h
    <