Overview
Comment: | Add JSON5 output option |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e07fa89b442be190bf1d02031d19afcb |
User & Date: | js on 2014-02-08 18:04:30 |
Other Links: | manifest | tags |
Context
2014-02-10
| ||
10:46 | -[cancelAsyncRequests] documentation: Add warning check-in: 048c4912d6 user: js tags: trunk | |
2014-02-08
| ||
18:04 | Add JSON5 output option check-in: e07fa89b44 user: js tags: trunk | |
09:26 | Add -[JSONRepresentationWithOptions:] check-in: eaa612ad50 user: js tags: trunk | |
Changes
Modified src/OFDictionary.m from [a7500a2644] to [a9ccdce0b3].
︙ | |||
613 614 615 616 617 618 619 620 621 622 623 | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | + + + + + - + + + + + + - + | [JSON appendString: @"\n"]; i = 0; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { void *pool2 = objc_autoreleasePoolPush(); int identifierOptions = options | OF_JSON_REPRESENTATION_IDENTIFIER; if (![key isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exception]; [JSON appendString: indentation]; [JSON appendString: @"\t"]; [JSON appendString: [key |
︙ |
Modified src/OFJSONRepresentation.h from [25865c5918] to [f9fd77253b].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ @class OFString; enum { |
︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 | 42 43 44 45 46 47 48 49 50 51 52 53 54 | + | * @brief Returns the JSON representation of the object as a string. * * @param options The options to use when creating a JSON representation.@n * Possible values are: * Value | Description * --------------------------------|------------------------- * `OF_JSON_REPRESENTATION_PRETTY` | Optimize for readability * `OF_JSON_REPRESENTATION_JSON5` | Generate JSON5 * * @return The JSON representation of the object as a string */ - (OFString*)JSONRepresentationWithOptions: (int)options; @end |
Modified src/OFNumber.m from [12ac22c22b] to [890ea8bb44].
︙ | |||
1420 1421 1422 1423 1424 1425 1426 | 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | + - - - - + + + + + + | double doubleValue; if (_type == OF_NUMBER_BOOL) return (_value.bool_ ? @"true" : @"false"); doubleValue = [self doubleValue]; if (isinf(doubleValue)) { if (options & OF_JSON_REPRESENTATION_JSON5) { |
︙ |
Modified src/OFString.m from [006b401a4b] to [ab5f534f76].
︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | + | */ #include "config.h" #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <sys/stat.h> #import "OFString.h" #import "OFString_UTF8.h" #import "OFString_UTF8+Private.h" #import "OFArray.h" |
︙ | |||
1456 1457 1458 1459 1460 1461 1462 | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | - - + + + + + + + + + + - - + + + + + + + + + + + + + + | withString: @"\\\\"]; [JSON replaceOccurrencesOfString: @"\"" withString: @"\\\""]; [JSON replaceOccurrencesOfString: @"\b" withString: @"\\b"]; [JSON replaceOccurrencesOfString: @"\f" withString: @"\\f"]; |
︙ |