-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGSSearchResults.m
52 lines (41 loc) · 1.2 KB
/
GSSearchResults.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
//
// GSSearchResults.m
// DoctorTunes
//
// Created by Diego Trinciarelli on 08/09/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "GSSearchResults.h"
#import "GSSearchResult.h"
@implementation GSSearchResults
@synthesize numResults,start,end,results;
+ (id)objectWithDictionary:(NSDictionary*)dictionary{
id obj = [[[GSSearchResults alloc] initWithDictionary:dictionary] autorelease];
return obj;
}
- (id)initWithDictionary:(NSDictionary*)dictionary{
self = [super init];
if (self) {
numResults = [dictionary objectForKey:@"numResults"];
start = [dictionary objectForKey:@"start"];
end = [dictionary objectForKey:@"end"];
results = [[NSMutableArray alloc] init];
NSArray *res = [dictionary objectForKey:@"results"];
for (NSDictionary *d in res) {
[results addObject:[GSSearchResult objectWithDictionary:d]];
}
}
return self;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"num %@: %@", numResults, results];
}
- (void)dealloc{
[numResults release];
[start release];
[end release];
[results release];
[super dealloc];
}
@end