main
1//
2// Licensed under the terms in License.txt
3//
4// Copyright 2010 Allen Ding. All rights reserved.
5//
6
7#import "NSValue+KiwiAdditions.h"
8#import "KWObjCUtilities.h"
9
10@implementation NSValue(KiwiAdditions)
11
12#pragma mark -
13#pragma mark Accessing Data
14
15- (NSData *)dataValue {
16 NSUInteger length = KWObjCTypeLength([self objCType]);
17 void *buffer = malloc(length);
18 [self getValue:buffer];
19 NSData *data = [NSData dataWithBytes:buffer length:length];
20 free(buffer);
21 return data;
22}
23
24@end