Differences From Artifact [c13a2ddb4a]:
- File src/OFNumber.m — part of check-in [fd8c1728ea] at 2013-02-26 18:40:53 on branch trunk — OFNumber: Add long long. (user: js, size: 37799) [annotate] [blame] [check-ins using]
To Artifact [c9cabca4f9]:
- File
src/OFNumber.m
— part of check-in
[c5ef582958]
at
2013-03-04 17:20:15
on branch trunk
— Replace BOOL with bool.
The only places where BOOL is left are those where they are required by
the ABI. (user: js, size: 36335) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
339 340 341 342 343 344 345 | return [OFNumber numberWithDouble: _value.double_ o]; \ default: \ @throw [OFInvalidFormatException \ exceptionWithClass: [self class]]; \ } @implementation OFNumber | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | return [OFNumber numberWithDouble: _value.double_ o]; \ default: \ @throw [OFInvalidFormatException \ exceptionWithClass: [self class]]; \ } @implementation OFNumber + (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; } + (instancetype)numberWithChar: (signed char)schar { return [[[self alloc] initWithChar: schar] autorelease]; |
︙ | ︙ | |||
491 492 493 494 495 496 497 | [self release]; @throw e; } abort(); } | | | | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | [self release]; @throw e; } abort(); } - initWithBool: (bool)bool_ { self = [super init]; _value.bool_ = bool_; _type = OF_NUMBER_BOOL; return self; } - initWithChar: (signed char)schar { |
︙ | ︙ | |||
790 791 792 793 794 795 796 | selector: _cmd]; typeString = [[element attributeForName: @"type"] stringValue]; if ([typeString isEqual: @"boolean"]) { _type = OF_NUMBER_BOOL; | | | | | | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | selector: _cmd]; typeString = [[element attributeForName: @"type"] stringValue]; if ([typeString isEqual: @"boolean"]) { _type = OF_NUMBER_BOOL; if ([[element stringValue] isEqual: @"true"]) _value.bool_ = true; else if ([[element stringValue] isEqual: @"false"]) _value.bool_ = false; else @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; } else if ([typeString isEqual: @"unsigned"]) { /* * FIXME: This will fail if the value is bigger than |
︙ | ︙ | |||
847 848 849 850 851 852 853 | } - (of_number_type_t)type { return _type; } | | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | } - (of_number_type_t)type { return _type; } - (bool)boolValue { RETURN_AS(bool) } - (signed char)charValue { RETURN_AS(signed char) } |
︙ | ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | } - (double)doubleValue { RETURN_AS(double) } | | | | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | } - (double)doubleValue { RETURN_AS(double) } - (bool)isEqual: (id)object { OFNumber *number; if (![object isKindOfClass: [OFNumber class]]) return false; number = object; if (_type & OF_NUMBER_FLOAT || number->_type & OF_NUMBER_FLOAT) return ([number doubleValue] == [self doubleValue]); if (_type & OF_NUMBER_SIGNED || number->_type & OF_NUMBER_SIGNED) |
︙ | ︙ | |||
1329 1330 1331 1332 1333 1334 1335 | - (OFString*)description { OFMutableString *ret; switch (_type) { case OF_NUMBER_BOOL: | | | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | - (OFString*)description { OFMutableString *ret; switch (_type) { case OF_NUMBER_BOOL: return (_value.bool_ ? @"true" : @"false"); case OF_NUMBER_UCHAR: case OF_NUMBER_USHORT: case OF_NUMBER_UINT: case OF_NUMBER_ULONG: case OF_NUMBER_ULONGLONG: case OF_NUMBER_UINT8: case OF_NUMBER_UINT16: |
︙ | ︙ |