16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#import "OFConcreteValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"
#import "OFOutOfRangeException.h"
@implementation OFConcreteValue
@synthesize objCType = _objCType;
- (instancetype)initWithBytes: (const void *)bytes
objCType: (const char *)objCType
{
self = [super initWithBytes: bytes objCType: objCType];
@try {
_size = OFSizeOfTypeEncoding(objCType);
|
<
<
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#import "OFConcreteValue.h"
#import "OFMethodSignature.h"
#import "OFString.h"
#import "OFOutOfRangeException.h"
@implementation OFConcreteValue
- (instancetype)initWithBytes: (const void *)bytes
objCType: (const char *)objCType
{
self = [super initWithBytes: bytes objCType: objCType];
@try {
_size = OFSizeOfTypeEncoding(objCType);
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
- (void)dealloc
{
OFFreeMemory(_bytes);
OFFreeMemory(_objCType);
[super dealloc];
}
- (void)getValue: (void *)value size: (size_t)size
{
if (size != _size)
@throw [OFOutOfRangeException exception];
memcpy(value, _bytes, _size);
}
@end
|
>
>
>
>
>
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
- (void)dealloc
{
OFFreeMemory(_bytes);
OFFreeMemory(_objCType);
[super dealloc];
}
- (const char *)objCType
{
return _objCType;
}
- (void)getValue: (void *)value size: (size_t)size
{
if (size != _size)
@throw [OFOutOfRangeException exception];
memcpy(value, _bytes, _size);
}
@end
|