CatNiP prefinal
Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11
|
00001 00006 #import "LocalScoreData.h" 00007 00008 00009 @implementation LocalScoreData 00010 @synthesize index; 00011 @synthesize composer; 00012 @synthesize composition; 00013 @synthesize userNotes; 00014 00015 -(id)init { 00016 self = [super init]; 00017 if (self) 00018 { 00019 self.index = -1; 00020 self.composer = @""; 00021 self.composition = @""; 00022 self.userNotes = @""; 00023 } 00024 return self; 00025 } 00026 00027 -(id)initWithScoreData:(ScoreData *)score 00028 { 00029 self = [super init]; 00030 if (self) 00031 { 00032 self.description = score.description; 00033 self.fullMetaData = score.fullMetaData; 00034 self.metaDataDict = score.metaDataDict; 00035 self.pdf = @""; 00036 self.index = -1; 00037 self.composer = @""; 00038 self.composition = @""; 00039 self.userNotes = @""; 00040 } 00041 return self; 00042 } 00043 00044 -(void)dealloc 00045 { 00046 [self.composer release]; 00047 [self.composition release]; 00048 [self.userNotes release]; 00049 [super dealloc]; 00050 } 00051 00052 #pragma mark - NSCoding protocol 00053 - (id)initWithCoder:(NSCoder *)decoder 00054 { 00055 [super initWithCoder:decoder]; 00056 [self setIndex:[decoder decodeIntegerForKey:@"index"]]; 00057 [self setComposer:[decoder decodeObjectForKey:@"composer"]]; 00058 [self setComposition:[decoder decodeObjectForKey:@"composition"]]; 00059 [self setUserNotes:[decoder decodeObjectForKey:@"userNotes"]]; 00060 return self; 00061 } 00062 00063 - (void)encodeWithCoder:(NSCoder *)encoder 00064 { 00065 [super encodeWithCoder:encoder]; 00066 [encoder encodeInteger:index forKey:@"index"]; 00067 [encoder encodeObject:composer forKey:@"composer"]; 00068 [encoder encodeObject:composition forKey:@"composition"]; 00069 [encoder encodeObject:userNotes forKey:@"userNotes"]; 00070 } 00071 00072 - (id)copyWithZone:(NSZone *)zone 00073 { 00074 LocalScoreData *newScoreData = [[LocalScoreData alloc] initWithScoreData:self]; 00075 return newScoreData; 00076 } 00077 00078 @end