ObjFW  Diff

Differences From Artifact [e5b90c57f3]:

To Artifact [f54894ca09]:


21
22
23
24
25
26
27

28
29
30
31
32
33
34
#import "OFConcreteNumber.h"
#import "OFData.h"
#import "OFString.h"
#import "OFTaggedPointerNumber.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"

#import "OFOutOfRangeException.h"

@interface OFNumber ()
- (OFString *)
    of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options
			       depth: (size_t)depth;
@end







>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#import "OFConcreteNumber.h"
#import "OFData.h"
#import "OFString.h"
#import "OFTaggedPointerNumber.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfRangeException.h"

@interface OFNumber ()
- (OFString *)
    of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options
			       depth: (size_t)depth;
@end
706
707
708
709
710
711
712















713
714
715
716
717
718
719
		return [OFString stringWithFormat: @"%lld", self.longLongValue];
	if (isUnsigned(self))
		return [OFString stringWithFormat: @"%llu",
						   self.unsignedLongLongValue];

	@throw [OFInvalidFormatException exception];
}
















- (OFString *)JSONRepresentation
{
	return [self of_JSONRepresentationWithOptions: 0 depth: 0];
}

- (OFString *)JSONRepresentationWithOptions:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
		return [OFString stringWithFormat: @"%lld", self.longLongValue];
	if (isUnsigned(self))
		return [OFString stringWithFormat: @"%llu",
						   self.unsignedLongLongValue];

	@throw [OFInvalidFormatException exception];
}

- (OFData *)ASN1DERRepresentation
{
	if (self.objCType[0] == 'B' && self.objCType[1] == '\0') {
		char buffer[] = {
			OFASN1TagNumberBoolean,
			1,
			(self.boolValue ? 0xFF : 0x00)
		};

		return [OFData dataWithItems: buffer count: sizeof(buffer)];
	} else
		@throw [OFNotImplementedException exceptionWithSelector: _cmd
								 object: self];
}

- (OFString *)JSONRepresentation
{
	return [self of_JSONRepresentationWithOptions: 0 depth: 0];
}

- (OFString *)JSONRepresentationWithOptions: