@@ -19,12 +19,12 @@ #import "OFMethodSignature.h" #import "OFString.h" #import "OFValue_bytes.h" #import "OFValue_nonretainedObject.h" #import "OFValue_pointer.h" +#import "OFValue_range.h" -#import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" static struct { Class isa; } placeholder; @@ -48,10 +48,15 @@ - (instancetype)initWithNonretainedObject: (id)object { return (id)[[OFValue_nonretainedObject alloc] initWithNonretainedObject: object]; } + +- (instancetype)initWithRange: (of_range_t)range +{ + return (id)[[OFValue_range alloc] initWithRange: range]; +} @end @implementation OFValue + (void)initialize { @@ -81,10 +86,15 @@ + (instancetype)valueWithNonretainedObject: (id)object { return [[[self alloc] initWithNonretainedObject: object] autorelease]; } + ++ (instancetype)valueWithRange: (of_range_t)range +{ + return [[[self alloc] initWithRange: range] autorelease]; +} - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType { OF_INVALID_INIT_METHOD @@ -95,10 +105,15 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithNonretainedObject: (id)object { + OF_INVALID_INIT_METHOD +} + +- (instancetype)initWithRange: (of_range_t)range +{ OF_INVALID_INIT_METHOD } - (bool)isEqual: (id)object { @@ -193,10 +208,20 @@ } - (id)nonretainedObjectValue { id ret; + + [self getValue: &ret + size: sizeof(ret)]; + + return ret; +} + +- (of_range_t)rangeValue +{ + of_range_t ret; [self getValue: &ret size: sizeof(ret)]; return ret;