// // TKResourcePointer.m // ThemeKit // // Created by Colin Cornaby on Sun Dec 14 2003. // Copyright (c) 2003 Carpe Stellarem. All rights reserved. // #import "TKResourcePointer.h" #import "TKVariation.h" #import "TKTheme.h" @implementation TKResourcePointer -(id)initForHash:(NSData *)theHash forID:(int)theID owner:(id)owner{ //Just the init method, pretty self explanatory [super init]; resID=theID; hashData=[[NSData alloc] initWithData:theHash]; myOwner=owner; return self; } -(id)owner { return myOwner; } -(id)resource { return [(TKTheme *)myOwner resourceForHash:hashData]; } //Some accessor methods -(int)ID{ return resID; } -(NSData *)hash{ return hashData; } -(void)setOwner:(id)anOwner{ myOwner = anOwner; } //Just some serialization - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:hashData forKey:@"hashData"]; [coder encodeObject:[NSNumber numberWithInt:resID] forKey:@"resourceID"]; } - (id)initWithCoder:(NSCoder *)coder { hashData = [[coder decodeObjectForKey:@"hashData"] retain]; resID = [[coder decodeObjectForKey:@"resourceID"] intValue]; return self; } @end