ObjFW  Diff

Differences From Artifact [d2c729f348]:

To Artifact [795a1fd15b]:


674
675
676
677
678
679
680
681
682
683
684


685
686
687
688
689
690
691
692
693
694
695
696
697

698
699
700
701
702
703
704

- (OFString *)
    of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options
			       depth: (size_t)depth
{
	OFMutableString *JSON = [OFMutableString stringWithString: @"{"];
	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *keyEnumerator = [self keyEnumerator];
	OFEnumerator *objectEnumerator = [self objectEnumerator];
	size_t i, count = self.count;
	id key, object;



	if (options & OFJSONRepresentationOptionPretty) {
		OFMutableString *indentation = [OFMutableString string];

		for (i = 0; i < depth; i++)
			[indentation appendString: @"\t"];

		[JSON appendString: @"\n"];

		i = 0;
		while ((key = [keyEnumerator nextObject]) != nil &&
		    (object = [objectEnumerator nextObject]) != nil) {
			void *pool2 = objc_autoreleasePoolPush();

			int identifierOptions =
			    options | OFJSONRepresentationOptionIsIdentifier;

			if (![key isKindOfClass: [OFString class]])
				@throw [OFInvalidArgumentException exception];

			[JSON appendString: indentation];







|
<

|
>
>










|
<

>







674
675
676
677
678
679
680
681

682
683
684
685
686
687
688
689
690
691
692
693
694
695
696

697
698
699
700
701
702
703
704
705

- (OFString *)
    of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options
			       depth: (size_t)depth
{
	OFMutableString *JSON = [OFMutableString stringWithString: @"{"];
	void *pool = objc_autoreleasePoolPush();
	OFArray *keys = self.allKeys;

	size_t i, count = self.count;

	if (options & OFJSONRepresentationOptionSorted)
		keys = keys.sortedArray;

	if (options & OFJSONRepresentationOptionPretty) {
		OFMutableString *indentation = [OFMutableString string];

		for (i = 0; i < depth; i++)
			[indentation appendString: @"\t"];

		[JSON appendString: @"\n"];

		i = 0;
		for (id key in keys) {

			void *pool2 = objc_autoreleasePoolPush();
			id object = [self objectForKey: key];
			int identifierOptions =
			    options | OFJSONRepresentationOptionIsIdentifier;

			if (![key isKindOfClass: [OFString class]])
				@throw [OFInvalidArgumentException exception];

			[JSON appendString: indentation];
718
719
720
721
722
723
724
725
726
727

728
729
730
731
732
733
734

			objc_autoreleasePoolPop(pool2);
		}

		[JSON appendString: indentation];
	} else {
		i = 0;
		while ((key = [keyEnumerator nextObject]) != nil &&
		    (object = [objectEnumerator nextObject]) != nil) {
			void *pool2 = objc_autoreleasePoolPush();

			int identifierOptions =
			    options | OFJSONRepresentationOptionIsIdentifier;

			if (![key isKindOfClass: [OFString class]])
				@throw [OFInvalidArgumentException exception];

			[JSON appendString: [key







|
<

>







719
720
721
722
723
724
725
726

727
728
729
730
731
732
733
734
735

			objc_autoreleasePoolPop(pool2);
		}

		[JSON appendString: indentation];
	} else {
		i = 0;
		for (id key in keys) {

			void *pool2 = objc_autoreleasePoolPush();
			id object = [self objectForKey: key];
			int identifierOptions =
			    options | OFJSONRepresentationOptionIsIdentifier;

			if (![key isKindOfClass: [OFString class]])
				@throw [OFInvalidArgumentException exception];

			[JSON appendString: [key