-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGSFormat.m
56 lines (41 loc) · 1.03 KB
/
GSFormat.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// GSFormat.m
// DoctorTunes
//
// Created by Diego Trinciarelli on 09/09/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "GSFormat.h"
@implementation GSFormat
@synthesize name,qty,descriptions;
+ (id)objectWithDictionary:(NSDictionary*)dictionary{
id obj = [[[GSFormat alloc] initWithDictionary:dictionary] autorelease];
return obj;
}
- (id)initWithDictionary:(NSDictionary*)dictionary{
self = [super init];
if (self) {
descriptions = [[NSMutableArray alloc] init];
NSArray *res = [dictionary objectForKey:@"artists"];
for (NSString *d in res) {
[descriptions addObject:d];
}
name = [dictionary objectForKey:@"name"];
qty = [dictionary objectForKey:@"qty"];
}
return self;
}
- (NSString *)itemid{
return name;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", name];
}
- (void)dealloc{
[name release];
[qty release];
[descriptions release];
[super dealloc];
}
@end