This is NSConcreteNumber.m in view mode; [Download] [Up]
/* Copyright (C) 1996 Ovidiu Predescu <ovidiu@bx.logicnet.ro> Mircea Oancea <mircea@jupiter.elcom.pub.ro> Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro> This file is part of the FoundationExtensions library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <Foundation/NSString.h> #include <Foundation/NSCoder.h> #include <Foundation/NSException.h> #include <extensions/MissingMethods.h> /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Bool concrete number */ @implementation NSBoolNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(BOOL*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%d", data]; } - (int)generality { return 1; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { BOOL other_data = [otherNumber boolValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(BOOL*)value = data; } - (const char*)objCType { return @encode(BOOL); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSBoolNumber class] alloc] initValue:&data withObjCType:@encode(BOOL)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(BOOL) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(BOOL) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Char concrete number */ @implementation NSCharNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(char*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%d", data]; } - (int)generality { return 2; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { char other_data = [otherNumber charValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(char*)value = data; } - (const char*)objCType { return @encode(char); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSCharNumber class] alloc] initValue:&data withObjCType:@encode(char)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(char) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(char) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * UChar concrete number */ @implementation NSUCharNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(unsigned char*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%d", data]; } - (int)generality { return 3; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { unsigned char other_data = [otherNumber unsignedCharValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(unsigned char*)value = data; } - (const char*)objCType { return @encode(unsigned char); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSUCharNumber class] alloc] initValue:&data withObjCType:@encode(unsigned char)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(unsigned char) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(unsigned char) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Short concrete number */ @implementation NSShortNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(short*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%hd", data]; } - (int)generality { return 4; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { short other_data = [otherNumber shortValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(short*)value = data; } - (const char*)objCType { return @encode(short); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSShortNumber class] alloc] initValue:&data withObjCType:@encode(short)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(short) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(short) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * UShort concrete number */ @implementation NSUShortNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(unsigned short*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%hu", data]; } - (int)generality { return 5; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { unsigned short other_data = [otherNumber unsignedShortValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(unsigned short*)value = data; } - (const char*)objCType { return @encode(unsigned short); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSUShortNumber class] alloc] initValue:&data withObjCType:@encode(unsigned short)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(unsigned short) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(unsigned short) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Int concrete number */ @implementation NSIntNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(int*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%d", data]; } - (int)generality { return 6; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { int other_data = [otherNumber intValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(int*)value = data; } - (const char*)objCType { return @encode(int); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSIntNumber class] alloc] initValue:&data withObjCType:@encode(int)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(int) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(int) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * UInt concrete number */ @implementation NSUIntNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(unsigned int*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%u", data]; } - (int)generality { return 7; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { unsigned int other_data = [otherNumber unsignedIntValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(unsigned int*)value = data; } - (const char*)objCType { return @encode(unsigned int); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSUIntNumber class] alloc] initValue:&data withObjCType:@encode(unsigned int)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(unsigned int) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(unsigned int) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Long concrete number */ @implementation NSLongNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(long*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%ld", data]; } - (int)generality { return 8; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { long other_data = [otherNumber longValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(long*)value = data; } - (const char*)objCType { return @encode(long); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSLongNumber class] alloc] initValue:&data withObjCType:@encode(long)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(long) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(long) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * ULong concrete number */ @implementation NSULongNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(unsigned long*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%lu", data]; } - (int)generality { return 9; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { unsigned long other_data = [otherNumber unsignedLongValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(unsigned long*)value = data; } - (const char*)objCType { return @encode(unsigned long); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSULongNumber class] alloc] initValue:&data withObjCType:@encode(unsigned long)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(unsigned long) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(unsigned long) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * LongLong concrete number */ @implementation NSLongLongNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(long long*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%lld", data]; } - (int)generality { return 10; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { long long other_data = [otherNumber longLongValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(long long*)value = data; } - (const char*)objCType { return @encode(long long); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSLongLongNumber class] alloc] initValue:&data withObjCType:@encode(long long)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(long long) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(long long) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * ULongLong concrete number */ @implementation NSULongLongNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(unsigned long long*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%llu", data]; } - (int)generality { return 11; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { unsigned long long other_data = [otherNumber unsignedLongLongValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(unsigned long long*)value = data; } - (const char*)objCType { return @encode(unsigned long long); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSULongLongNumber class] alloc] initValue:&data withObjCType:@encode(unsigned long long)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(unsigned long long) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(unsigned long long) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Float concrete number */ @implementation NSFloatNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(float*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%f", data]; } - (int)generality { return 12; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { float other_data = [otherNumber floatValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(float*)value = data; } - (const char*)objCType { return @encode(float); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSFloatNumber class] alloc] initValue:&data withObjCType:@encode(float)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(float) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(float) at:&data]; return self; } @end /* * DO NOT EDIT! GENERATED AUTOMATICALLY FROM NSConcreteNumber.m.sh. * Double concrete number */ @implementation NSDoubleNumber - initValue:(const void*)value withObjCType:(const char*)type { self = [super init]; data = *(double*)value; return self; } - (BOOL)boolValue { return data; } - (char)charValue { return data; } - (unsigned char)unsignedCharValue { return data; } - (short)shortValue { return data; } - (unsigned short)unsignedShortValue { return data; } - (int)intValue { return data; } - (unsigned int)unsignedIntValue { return data; } - (long)longValue { return data; } - (unsigned long)unsignedLongValue { return data; } - (long long)longLongValue { return data; } - (unsigned long long)unsignedLongLongValue { return data; } - (float)floatValue { return data; } - (double)doubleValue { return data; } - (NSString*)stringValue { return [NSString stringWithFormat:@"%g", data]; } - (int)generality { return 13; } - (NSComparisonResult)compare:(NSNumber*)otherNumber { if([self generality] >= [otherNumber generality]) { double other_data = [otherNumber doubleValue]; if (data == other_data) return NSOrderedSame; else return (data < other_data) ? NSOrderedAscending : NSOrderedDescending; } else return [otherNumber compare:self]; } // Override these from NSValue - (void)getValue:(void*)value { if (!value) [NSException raise:NSInvalidArgumentException format:@"NULL buffer in -getValue"]; else *(double*)value = data; } - (const char*)objCType { return @encode(double); } // NSCopying - (id)copyWithZone:(NSZone*)zone { if ([self zone] == zone) return [self retain]; else return [[[NSDoubleNumber class] alloc] initValue:&data withObjCType:@encode(double)]; } // NSCoding - (void)encodeWithCoder:(NSCoder*)coder { [super encodeWithCoder:coder]; [coder encodeValueOfObjCType:@encode(double) at:&data]; } - (id)initWithCoder:(NSCoder*)coder andObjCType:(const char*)type { self = [super initWithCoder:coder]; [coder decodeValueOfObjCType:@encode(double) at:&data]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.