18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#import "OFString.h"
#import "OFOutOfRangeException.h"
@implementation OFRangeValue
@synthesize rangeValue = _range;
- (instancetype)initWithRange: (of_range_t)range
{
self = [super init];
_range = range;
return self;
}
- (const char *)objCType
{
return @encode(of_range_t);
}
- (void)getValue: (void *)value size: (size_t)size
{
if (size != sizeof(_range))
@throw [OFOutOfRangeException exception];
memcpy(value, &_range, sizeof(_range));
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"<OFValue: of_range_t { %zu, %zu }>",
_range.location, _range.length];
}
@end
|
|
|
|
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#import "OFString.h"
#import "OFOutOfRangeException.h"
@implementation OFRangeValue
@synthesize rangeValue = _range;
- (instancetype)initWithRange: (OFRange)range
{
self = [super init];
_range = range;
return self;
}
- (const char *)objCType
{
return @encode(OFRange);
}
- (void)getValue: (void *)value size: (size_t)size
{
if (size != sizeof(_range))
@throw [OFOutOfRangeException exception];
memcpy(value, &_range, sizeof(_range));
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"<OFValue: OFRange { %zu, %zu }>",
_range.location, _range.length];
}
@end
|