34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
-
-
+
+
+
|
#import "OFOutOfRangeException.h"
static struct {
Class isa;
} placeholder;
@interface OFArray ()
- (OFString *)of_JSONRepresentationWithOptions: (int)options
depth: (size_t)depth;
- (OFString *)
of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options
depth: (size_t)depth;
@end
@interface OFPlaceholderArray: OFArray
@end
@implementation OFPlaceholderArray
- (instancetype)init
|
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
|
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
|
-
+
+
-
-
+
+
+
-
+
|
}
- (OFString *)JSONRepresentation
{
return [self of_JSONRepresentationWithOptions: 0 depth: 0];
}
- (OFString *)JSONRepresentationWithOptions: (int)options
- (OFString *)JSONRepresentationWithOptions:
(OFJSONRepresentationOptions)options
{
return [self of_JSONRepresentationWithOptions: options depth: 0];
}
- (OFString *)of_JSONRepresentationWithOptions: (int)options
depth: (size_t)depth
- (OFString *)
of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options
depth: (size_t)depth
{
OFMutableString *JSON = [OFMutableString stringWithString: @"["];
void *pool = objc_autoreleasePoolPush();
size_t i, count = self.count;
if (options & OF_JSON_REPRESENTATION_PRETTY) {
if (options & OFJSONRepresentationOptionPretty) {
OFMutableString *indentation = [OFMutableString string];
for (i = 0; i < depth; i++)
[indentation appendString: @"\t"];
[JSON appendString: @"\n"];
|