Refactored ParsedResult classes into ResultParsers & ParsedResults, to allow multiple...
[zxing.git] / iphone / Classes / GeoResultParser.m
1 //
2 //  GeoResultParser.m
3 //  ZXing
4 //
5 //  Created by Christian Brunschen on 25/06/2008.
6 //  Copyright 2008 Google Inc. All rights reserved.
7 //
8
9 #import "GeoResultParser.h"
10 #import "GeoParsedResult.h"
11
12 #define PREFIX @"geo:"
13
14 @implementation GeoResultParser
15
16 + (ParsedResult *)parsedResultForString:(NSString *)s {
17   NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
18   if (prefixRange.location == 0) {
19     int restStart = prefixRange.location + prefixRange.length;
20     return [[[GeoParsedResult alloc] initWithLocation:[s substringFromIndex:restStart]]
21             autorelease];
22   }
23   return nil;
24 }
25
26 @end