CatNiP prefinal
Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11
|
00001 00006 #import "Playlist.h" 00007 00008 00009 @implementation Playlist 00010 00011 @synthesize name; 00012 @synthesize scorelist; 00013 00014 -(id)init 00015 { 00016 self = [super init]; 00017 if (self) 00018 { 00019 self.name = @""; 00020 self.scorelist = [[NSMutableArray alloc] init]; 00021 } 00022 return self; 00023 } 00024 00025 -(id)initWithName:(NSString *)n andArray:(NSArray *)a { 00026 00027 self = [super init]; 00028 if (self) { 00029 self.name = n; 00030 self.scorelist = [[NSMutableArray alloc] initWithArray:a]; 00031 } 00032 return self; 00033 } 00034 00035 -(void)dealloc { 00036 [name release]; 00037 [scorelist release]; 00038 [super dealloc]; 00039 } 00040 00041 #pragma mark - NSCoding protocol 00042 - (id)initWithCoder:(NSCoder *)decoder 00043 { 00044 [super init]; 00045 [self setName:[decoder decodeObjectForKey:@"name"]]; 00046 [self setScorelist:[decoder decodeObjectForKey:@"scorelist"]]; 00047 return self; 00048 } 00049 - (void)encodeWithCoder:(NSCoder *)encoder 00050 { 00051 [encoder encodeObject:name forKey:@"name"]; 00052 [encoder encodeObject:scorelist forKey:@"scorelist"]; 00053 } 00054 00055 @end