mirror of
https://github.com/nickshanks/ResKnife.git
synced 2024-11-17 12:05:12 +00:00
56 lines
932 B
Objective-C
56 lines
932 B
Objective-C
#import "ElementULLG.h"
|
|
|
|
#define SIZE_ON_DISK (8)
|
|
|
|
@implementation ElementULLG
|
|
|
|
- (id)copyWithZone:(NSZone*)zone
|
|
{
|
|
ElementULLG *element = [super copyWithZone:zone];
|
|
[element setValue:value];
|
|
return element;
|
|
}
|
|
|
|
- (void)readDataFrom:(TemplateStream *)stream
|
|
{
|
|
UInt64 tmp;
|
|
[stream readAmount:SIZE_ON_DISK toBuffer:&tmp];
|
|
value = CFSwapInt64BigToHost(tmp);
|
|
}
|
|
|
|
- (unsigned int)sizeOnDisk
|
|
{
|
|
return SIZE_ON_DISK;
|
|
}
|
|
|
|
- (void)writeDataTo:(TemplateStream *)stream
|
|
{
|
|
UInt64 tmp = CFSwapInt64HostToBig(value);
|
|
[stream writeAmount:SIZE_ON_DISK fromBuffer:&tmp];
|
|
}
|
|
|
|
- (void)setValue:(UInt64)v
|
|
{
|
|
value = v;
|
|
}
|
|
|
|
- (UInt64)value
|
|
{
|
|
return value;
|
|
}
|
|
|
|
- (NSString *)stringValue
|
|
{
|
|
return [NSString stringWithFormat:@"%llu", value];
|
|
}
|
|
|
|
- (void)setStringValue:(NSString *)str
|
|
{
|
|
char cstr[256];
|
|
char *endPtr = cstr + 255;
|
|
strncpy(cstr, [str cStringUsingEncoding:NSMacOSRomanStringEncoding], 255);
|
|
value = strtoull(cstr, &endPtr, 10);
|
|
}
|
|
|
|
@end
|