Differences From Artifact [0561641365]:
- File src/OFNumber.m — part of check-in [3b97fc3cd9] at 2014-01-04 00:24:08 on branch trunk — Update copyright. (user: js, size: 35882) [annotate] [blame] [check-ins using]
To Artifact [12ac22c22b]:
- File
src/OFNumber.m
— part of check-in
[eaa612ad50]
at
2014-02-08 09:26:40
on branch trunk
— Add -[JSONRepresentationWithOptions:]
This also adds OF_JSON_REPRESENTATION_PRETTY. (user: js, size: 36310) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
329 330 331 332 333 334 335 336 337 338 339 340 341 342 | case OF_NUMBER_FLOAT: \ return [OFNumber numberWithFloat: _value.float_ o]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: _value.double_ o]; \ default: \ @throw [OFInvalidFormatException exception]; \ } @implementation OFNumber + (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; } | > > > > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | case OF_NUMBER_FLOAT: \ return [OFNumber numberWithFloat: _value.float_ o]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: _value.double_ o]; \ default: \ @throw [OFInvalidFormatException exception]; \ } @interface OFNumber (OF_PRIVATE_CATEGORY) - (OFString*)OF_JSONRepresentationWithOptions: (int)options depth: (size_t)depth; @end @implementation OFNumber + (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; } |
︙ | ︙ | |||
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 | objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFString*)JSONRepresentation { double doubleValue; if (_type == OF_NUMBER_BOOL) return (_value.bool_ ? @"true" : @"false"); doubleValue = [self doubleValue]; | > > > > > > > > > > > > > | 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFString*)JSONRepresentation { return [self OF_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString*)JSONRepresentationWithOptions: (int)options { return [self OF_JSONRepresentationWithOptions: options depth: 0]; } - (OFString*)OF_JSONRepresentationWithOptions: (int)options depth: (size_t)depth { double doubleValue; if (_type == OF_NUMBER_BOOL) return (_value.bool_ ? @"true" : @"false"); doubleValue = [self doubleValue]; |
︙ | ︙ |