Up
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.
- 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
+ (
NSNumber*)
numberWithBool: (BOOL)value;
Availability: OpenStep
New instance from boolean value.
+ (
NSNumber*)
numberWithChar: (signed char)value;
Availability: OpenStep
New instance from signed
char value.
+ (
NSNumber*)
numberWithDouble: (double)value;
Availability: OpenStep
New instance from double
value.
+ (
NSNumber*)
numberWithFloat: (float)value;
Availability: OpenStep
New instance from float
value.
+ (
NSNumber*)
numberWithInt: (signed int)value;
Availability: OpenStep
New instance from (signed)
int value.
+ (
NSNumber*)
numberWithInteger: (
NSInteger)value;
Availability: MacOS-X 10.5.0
Return a number intialised with NSInteger.
+ (
NSNumber*)
numberWithLong: (signed long)value;
Availability: OpenStep
New instance from (signed)
long value.
+ (
NSNumber*)
numberWithLongLong: (signed long long)value;
Availability: OpenStep
New instance from (signed)
long long
value.
+ (
NSNumber*)
numberWithShort: (signed short)value;
Availability: OpenStep
New instance from (signed)
short value.
+ (
NSNumber*)
numberWithUnsignedChar: (unsigned char)value;
Availability: OpenStep
New instance from unsigned
char value.
+ (
NSNumber*)
numberWithUnsignedInt: (unsigned int)value;
Availability: OpenStep
New instance from unsigned
int value.
+ (
NSNumber*)
numberWithUnsignedInteger: (
NSUInteger)value;
Availability: MacOS-X 10.5.0
Return a number intialised with NSUInteger.
+ (
NSNumber*)
numberWithUnsignedLong: (unsigned long)value;
Availability: OpenStep
New instance from unsigned
long value.
+ (
NSNumber*)
numberWithUnsignedLongLong: (unsigned long long)value;
Availability: OpenStep
New instance from unsigned
long long
value.
+ (
NSNumber*)
numberWithUnsignedShort: (unsigned short)value;
Availability: OpenStep
New instance from unsigned
short value.
- (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'.
- (signed char)
charValue;
Availability: OpenStep
Returns value as a signed
char, converting if necessary.
- (
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.
- (
NSString*)
description;
Availability: OpenStep
Returns the string representation of this number
using a non-localised conversion (decimal point is
'.' irrespective of the locale).
- (
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
- (double)
doubleValue;
Availability: OpenStep
Returns value as a double,
converting if necessary.
- (float)
floatValue;
Availability: OpenStep
Returns value as a float,
converting if necessary.
- (id)
initWithBool: (BOOL)value;
Availability: OpenStep
Initialize from boolean value.
- (id)
initWithChar: (signed char)value;
Availability: OpenStep
Initialize from signed
char value.
- (id)
initWithDouble: (double)value;
Availability: OpenStep
Initialize from double
value.
- (id)
initWithFloat: (float)value;
Availability: OpenStep
Initialize from float
value.
- (id)
initWithInt: (signed int)value;
Availability: OpenStep
Initialize from (signed)
int value.
- (id)
initWithInteger: (
NSInteger)value;
Availability: MacOS-X 10.5.0
Initialise the receiver with NSInteger content.
- (id)
initWithLong: (signed long)value;
Availability: OpenStep
Initialize from (signed)
long value.
- (id)
initWithLongLong: (signed long long)value;
Availability: OpenStep
Initialize from (signed)
long long
value.
- (id)
initWithShort: (signed short)value;
Availability: OpenStep
Initialize from (signed)
short value.
- (id)
initWithUnsignedChar: (unsigned char)value;
Availability: OpenStep
Initialize from unsigned
char value.
- (id)
initWithUnsignedInt: (unsigned int)value;
Availability: OpenStep
Initialize from unsigned
int value.
- (id)
initWithUnsignedInteger: (
NSUInteger)value;
Availability: MacOS-X 10.5.0
Initialise the receiver with NSUInteger content.
- (id)
initWithUnsignedLong: (unsigned long)value;
Availability: OpenStep
Initialize from unsigned
long value.
- (id)
initWithUnsignedLongLong: (unsigned long long)value;
Availability: OpenStep
Initialize from unsigned
long long
value.
- (id)
initWithUnsignedShort: (unsigned short)value;
Availability: OpenStep
Initialize from unsigned
short value.
- (signed int)
intValue;
Availability: OpenStep
Returns value as a (signed)
int, converting if necessary.
- (
NSInteger)
integerValue;
Availability: MacOS-X 10.5.0
Return the contents of the receiver as NSInteger.
- (BOOL)
isEqualToNumber: (
NSNumber*)otherNumber;
Availability: OpenStep
Returns whether receiver and otherNumber
represent the same numerical value.
- (signed long long)
longLongValue;
Availability: OpenStep
Returns value as a (signed)
long long,
converting if necessary.
- (signed long)
longValue;
Availability: OpenStep
Returns value as a (signed)
long, converting if necessary.
- (signed short)
shortValue;
Availability: OpenStep
Returns value as a (signed)
short, converting if necessary.
- (
NSString*)
stringValue;
Availability: OpenStep
- (unsigned char)
unsignedCharValue;
Availability: OpenStep
Returns value as an unsigned
char, converting if necessary.
- (unsigned int)
unsignedIntValue;
Availability: OpenStep
Returns value as an unsigned
int, converting if necessary.
- (
NSUInteger)
unsignedIntegerValue;
Availability: MacOS-X 10.5.0
Return the contents of the receiver as NSUInteger.
- (unsigned long long)
unsignedLongLongValue;
Availability: OpenStep
Returns value as an unsigned
long long,
converting if necessary.
- (unsigned long)
unsignedLongValue;
Availability: OpenStep
Returns value as an unsigned
long, converting if necessary.
- (unsigned short)
unsignedShortValue;
Availability: OpenStep
Returns value as an unsigned
short, converting if necessary.
- 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
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
escriptckquote>Avaass="availability">anner.html#method$NSScabr />
Returns the string reprtsoNumber: (
NSNumber*)otherNumber;
Availability: OpenStep
"align="left" />
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>
- (unsigned char)
unsignedCharValue;
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>
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