/
SearchResultsModel.m
34 lines (30 loc) · 1.07 KB
/
SearchResultsModel.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
//
// SearchResultsModel.m
//
// Created by Keith Lazuka on 7/25/09.
//
#import "SearchResultsModel.h"
#import "YahooSearchResultsModel.h"
#import "FlickrSearchResultsModel.h"
SearchService CurrentSearchService = SearchServiceDefault;
SearchResponseFormat CurrentSearchResponseFormat = SearchResponseFormatDefault;
id<SearchResultsModel> CreateSearchModel(SearchService service, SearchResponseFormat responseFormat)
{
id<SearchResultsModel> model = nil;
switch ( service ) {
case SearchServiceYahoo:
model = [[[YahooSearchResultsModel alloc] initWithResponseFormat:responseFormat] autorelease];
break;
case SearchServiceFlickr:
model = [[[FlickrSearchResultsModel alloc] initWithResponseFormat:responseFormat] autorelease];
break;
default:
[NSException raise:@"CurrentSearchService unknown" format:nil];
break;
}
return model;
}
id<SearchResultsModel> CreateSearchModelWithCurrentSettings(void)
{
return CreateSearchModel(CurrentSearchService, CurrentSearchResponseFormat);
}