NSValue Mac OS X 10.0

This class provides an object-oriented interface to C and Objective-C scalar data items, such as numeric primitives, and C structures. Providing an object-oriented wrapper for these non-object types makes it possible for clients to store these types in any of the Foundation collection classes.


@interface NSValue : NSObject <NSCoding, NSCopying>
 // Convenience Constructors
   + (NSValue *)value:(const void *)value withObjCType:(const char *)type;
   + (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type;
   + (NSValue *)valueWithNonretainedObject:(id)anObject;
   + (NSValue *)valueWithPoint:(NSPoint)point;
   + (NSValue *)valueWithPointer:(const void *)pointer;
   + (NSValue *)valueWithRange:(NSRange)range;
   + (NSValue *)valueWithRect:(NSRect)rect;
   + (NSValue *)valueWithSize:(NSSize)size;
 // Initializers
   - (id)initWithBytes:(const void *)value objCType:(const char *)type;
 // Instance Methods
   - (void)getValue:(void *)value;
   - (BOOL)isEqualToValue:(NSValue *)value;
   - (id)nonretainedObjectValue;
   - (const char *)objCType;
   - (NSPoint)pointValue;
   - (void *)pointerValue;
   - (NSRange)rangeValue;
   - (NSRect)rectValue;
   - (NSSize)sizeValue;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
 // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes