Refactored ParsedResult classes into ResultParsers & ParsedResults, to allow multiple different formats to generate the same result type

git-svn-id: https://zxing.googlecode.com/svn/trunk@478 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
christian.brunschen 2008-06-25 13:17:06 +00:00
parent 12a57d0baf
commit ee44225e3d
57 changed files with 1126 additions and 586 deletions

View file

@ -1,29 +0,0 @@
//
// AddressBookAUParsedResult.h
// ZXing
//
// Created by Christian Brunschen on 29/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
@interface AddressBookAUParsedResult : NSObject {
}
@end

View file

@ -1,27 +0,0 @@
//
// AddressBookAUParsedResult.m
// ZXing
//
// Created by Christian Brunschen on 29/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "AddressBookAUParsedResult.h"
@implementation AddressBookAUParsedResult
@end

View file

@ -22,6 +22,7 @@
#import "ArchiveController.h"
#import "Database.h"
#import "Scan.h"
#import "ResultParser.h"
#import "ParsedResult.h"
#import "DecoderViewController.h"
#import "ScanViewController.h"
@ -84,6 +85,7 @@
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(VIEW_PADDING, VIEW_PADDING, IMAGE_VIEW_SIDE, CONTENT_HEIGHT)];
[imageView setTag:IMAGE_VIEW_TAG];
[imageView setAutoresizingMask:UIViewAutoresizingFlexibleRightMargin];
[imageView setContentMode:UIViewContentModeCenter];
[cell.contentView addSubview:imageView];
[imageView release];
@ -192,7 +194,7 @@
self.scans = [NSMutableArray arrayWithArray:[[Database sharedDatabase] scans]];
self.results = [NSMutableArray arrayWithCapacity:self.scans.count];
for (Scan *scan in scans) {
[results addObject:[ParsedResult parsedResultForString:scan.text]];
[results addObject:[ResultParser parsedResultForString:scan.text]];
}
}

View file

@ -1,29 +0,0 @@
//
// BookmarkDoCoMoParsedResult.h
// ZXing
//
// Created by Christian Brunschen on 29/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
#import "URLTOParsedResult.h"
@interface BookmarkDoCoMoParsedResult : URLTOParsedResult {
}
@end

View file

@ -1,58 +0,0 @@
//
// BookmarkDoCoMoParsedResult.m
// ZXing
//
// Created by Christian Brunschen on 29/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "BookmarkDoCoMoParsedResult.h"
#import "DoCoMoParsedResult.h"
@implementation BookmarkDoCoMoParsedResult
+ parsedResultForString:(NSString *)s {
NSRange foundRange = [s rangeOfString:@"MEBKM:"];
if (foundRange.location == NSNotFound) {
return nil;
}
NSString *urlString = [s fieldWithPrefix:@"URL:"];
if (urlString == nil) {
return nil;
}
NSString *title = [s fieldWithPrefix:@"TITLE:"];
return [[[self alloc] initWithURLString:urlString
title:title] autorelease];
}
- (NSString *)stringForDisplay {
if (self.title) {
return [NSString stringWithFormat:@"%@: %@", self.title, self.urlString];
} else {
return self.urlString;
}
}
+ (NSString *)typeName {
return @"Bookmark";
}
@end

View file

@ -0,0 +1,16 @@
//
// BookmarkDoCoMoResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DoCoMoResultParser.h"
@interface BookmarkDoCoMoResultParser : DoCoMoResultParser {
}
@end

View file

@ -0,0 +1,32 @@
//
// BookmarkDoCoMoResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "BookmarkDoCoMoResultParser.h"
#import "URIParsedResult.h"
@implementation BookmarkDoCoMoResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange foundRange = [s rangeOfString:@"MEBKM:"];
if (foundRange.location == NSNotFound) {
return nil;
}
NSString *urlString = [s fieldWithPrefix:@"URL:"];
if (urlString == nil) {
return nil;
}
NSString *title = [s fieldWithPrefix:@"TITLE:"];
return [[[URIParsedResult alloc] initWithURLString:urlString
title:title] autorelease];
}
@end

View file

@ -20,9 +20,9 @@
*/
#import <UIKit/UIKit.h>
#import "DoCoMoParsedResult.h"
#import "ParsedResult.h"
@interface AddressBookDoCoMoParsedResult : DoCoMoParsedResult {
@interface BusinessCardParsedResult : ParsedResult {
NSString *name;
NSArray *phoneNumbers;
NSString *note;

View file

@ -19,10 +19,10 @@
* limitations under the License.
*/
#import "AddressBookDoCoMoParsedResult.h"
#import "BusinessCardParsedResult.h"
#import "AddContactAction.h"
@implementation AddressBookDoCoMoParsedResult
@implementation BusinessCardParsedResult
@synthesize name;
@synthesize phoneNumbers;
@ -31,28 +31,6 @@
@synthesize urlString;
@synthesize address;
+ parsedResultForString:(NSString *)s {
NSRange foundRange = [s rangeOfString:@"MECARD:"];
if (foundRange.location == NSNotFound) {
return nil;
}
NSString *name = [s fieldWithPrefix:@"N:"];
if (name == nil) {
return nil;
}
AddressBookDoCoMoParsedResult *result = [[self alloc] init];
result.name = name;
result.phoneNumbers = [s fieldsWithPrefix:@"TEL:"];
result.email = [s fieldWithPrefix:@"EMAIL:"];
result.note = [s fieldWithPrefix:@"NOTE:"];
result.urlString = [s fieldWithPrefix:@"URL:"];
result.address = [s fieldWithPrefix:@"ADR:"];
return [result autorelease];
}
- (NSString *)stringForDisplay {
NSMutableString *result = [NSMutableString stringWithString:self.name];
if (self.phoneNumbers) {
@ -96,7 +74,11 @@
}
+ (NSString *)typeName {
return @"MeCard";
return @"Contact";
}
- (UIImage *)icon {
return [UIImage imageNamed:@"business-card.png"];
}
@end

View file

@ -52,11 +52,11 @@ using namespace qrcode;
}
- (void)didDecodeImage:(TwoDDecoderResult *)result {
[self.delegate decoder:self didDecodeImage:self.image withResult:result];
[self.delegate decoder:self didDecodeImage:self.image usingSubset:self.subsetImage withResult:result];
}
- (void)failedToDecodeImage:(NSString *)reason {
[self.delegate decoder:self failedToDecodeImage:self.image reason:reason];
[self.delegate decoder:self failedToDecodeImage:self.image usingSubset:self.subsetImage reason:reason];
}
- (void) prepareSubset {

View file

@ -28,7 +28,7 @@
- (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image;
- (void)decoder:(Decoder *)decoder decodingImage:(UIImage *)image usingSubset:(UIImage *)subset progress:(NSString *)message;
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image withResult:(TwoDDecoderResult *)result;
- (void)decoder:(Decoder *)decoder failedToDecodeImage:(UIImage *)image reason:(NSString *)reason;
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)result;
- (void)decoder:(Decoder *)decoder failedToDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset reason:(NSString *)reason;
@end

View file

@ -72,8 +72,8 @@
/* DecoderDelegate methods */
- (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image;
- (void)decoder:(Decoder *)decoder decodingImage:(UIImage *)image usingSubset:(UIImage *)subset progress:(NSString *) message ;
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image withResult:(TwoDDecoderResult *)result;
- (void)decoder:(Decoder *)decoder decodingImage:(UIImage *)image usingSubset:(UIImage *)subset progress:(NSString *) message;
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)result;
/* UIImagePickerControllerDelegate methods */

View file

@ -22,6 +22,7 @@
#import "DecoderViewController.h"
#import "Decoder.h"
#import "NSString+HTML.h"
#import "ResultParser.h"
#import "ParsedResult.h"
#import "ResultAction.h"
@ -101,8 +102,18 @@
}
- (void)clearImageView {
imageView.image = nil;
NSArray *subviews = [imageView.subviews copy];
for (UIView *view in subviews) {
[view removeFromSuperview];
}
[subviews release];
}
- (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType {
self.result = nil;
[self clearImageView];
// Create the Image Picker
if ([UIImagePickerController isSourceTypeAvailable:sourceType]) {
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
@ -146,6 +157,7 @@
- (void)dealloc {
[decoder release];
[self clearImageView];
[imageView release];
[actionBarItem release];
[cameraBarItem release];
@ -168,6 +180,7 @@
// DecoderDelegate methods
- (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image {
[self clearImageView];
[self.imageView setImage:image];
[self showMessage:[NSString stringWithFormat:NSLocalizedString(@"Decoding image (%.0fx%.0f) ...", @"shown while image is decoding"), image.size.width, image.size.height]];
}
@ -176,30 +189,66 @@
decodingImage:(UIImage *)image
usingSubset:(UIImage *)subset
progress:(NSString *)message {
[self clearImageView];
[self.imageView setImage:subset];
[self showMessage:message];
}
- (void)presentResultForString:(NSString *)resultString {
self.result = [ParsedResult parsedResultForString:resultString];
self.result = [ResultParser parsedResultForString:resultString];
[self showMessage:[self.result stringForDisplay]];
self.actions = self.result.actions;
#ifdef DEBUG
NSLog(@"result has %d actions", actions ? 0 : actions.count);
#endif
[self updateToolbar];
}
}
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image withResult:(TwoDDecoderResult *)twoDResult {
- (void)presentResultPoints:(NSArray *)resultPoints
forImage:(UIImage *)image
usingSubset:(UIImage *)subset {
// CGSize imageSize = image.size;
CGSize subsetSize = subset.size;
CGRect viewBounds = imageView.bounds;
float scale = fmin(viewBounds.size.width / subsetSize.width,
viewBounds.size.height / subsetSize.height);
float xOffset = (viewBounds.size.width - scale * subsetSize.width) / 2.0;
float yOffset = (viewBounds.size.height - scale * subsetSize.height) / 2.0;
NSLog(@"(%f, %f) image in view with bounds (%f, %f) x (%f, %f)",
subsetSize.width, subsetSize.height,
viewBounds.origin.x, viewBounds.origin.y,
viewBounds.size.width, viewBounds.size.height);
NSLog(@"xOffset = %f, yOffset = %f, scale = %f", xOffset, yOffset, scale);
for (NSValue *pointValue in resultPoints) {
CGPoint point = [pointValue CGPointValue];
float x = xOffset + scale * point.x;
float y = yOffset + scale * point.y;
NSLog(@"have result point @ (%f, %f), imageView point (%f, %f)", point.x, point.y, x, y);
CGRect frame = CGRectMake(x - 3, y - 3, 7, 7);
UIView *pointView = [[UIView alloc] initWithFrame:frame];
pointView.opaque = YES;
pointView.backgroundColor = [UIColor greenColor];
pointView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[imageView addSubview:pointView];
[pointView release];
}
}
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)twoDResult {
[self presentResultForString:twoDResult.text];
[self presentResultPoints:twoDResult.points forImage:image usingSubset:subset];
// save the scan to the shared database
[[Database sharedDatabase] addScanWithText:twoDResult.text];
[self performResultAction:self];
}
- (void)decoder:(Decoder *)decoder failedToDecodeImage:(UIImage *)image reason:(NSString *)reason {
- (void)decoder:(Decoder *)decoder failedToDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset reason:(NSString *)reason {
[self showMessage:reason];
[self updateToolbar];
}
@ -211,26 +260,38 @@
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
UIImage *imageToDecode = image;
#ifdef DEBUG
NSLog(@"picked image size = (%f, %f)", image.size.width, image.size.height);
#endif
if (editingInfo) {
UIImage *originalImage = [editingInfo objectForKey:UIImagePickerControllerOriginalImage];
if (originalImage) {
#ifdef DEBUG
NSLog(@"original image size = (%f, %f)", originalImage.size.width, originalImage.size.height);
}
NSValue *cropRectValue = [editingInfo objectForKey:UIImagePickerControllerCropRect];
if (cropRectValue) {
CGRect cropRect = [cropRectValue CGRectValue];
NSLog(@"crop rect = (%f, %f) x (%f, %f)", CGRectGetMinX(cropRect), CGRectGetMinY(cropRect), CGRectGetWidth(cropRect), CGRectGetHeight(cropRect));
#endif
NSValue *cropRectValue = [editingInfo objectForKey:UIImagePickerControllerCropRect];
if (cropRectValue) {
CGRect cropRect = [cropRectValue CGRectValue];
#ifdef DEBUG
NSLog(@"crop rect = (%f, %f) x (%f, %f)", CGRectGetMinX(cropRect), CGRectGetMinY(cropRect), CGRectGetWidth(cropRect), CGRectGetHeight(cropRect));
#endif
UIGraphicsBeginImageContext(cropRect.size);
[originalImage drawAtPoint:CGPointMake(-CGRectGetMinX(cropRect),
-CGRectGetMinY(cropRect))];
imageToDecode = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
}
}
#endif
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
[image retain];
[imageToDecode retain];
[picker release];
[self.decoder decodeImage:image];
[image release];
[self.decoder decodeImage:imageToDecode];
[imageToDecode release];
[self updateToolbar];
}
@ -318,7 +379,7 @@
}
- (void)showScan:(Scan *)scan {
[self.imageView setImage:nil];
[self clearImageView];
[self presentResultForString:scan.text];
[[self navigationController] popToViewController:self animated:YES];
}

View file

@ -1,37 +0,0 @@
//
// DoCoMoParsedResult.h
// ZXing
//
// Created by Christian Brunschen on 28/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
#import "ParsedResult.h"
@interface NSString (DoCoMoFieldParsing)
- (NSString *)backslashUnescaped;
- (NSArray *)fieldsWithPrefix:(NSString *)prefix;
- (NSArray *)fieldsWithPrefix:(NSString *)prefix terminator:(NSString *)term;
- (NSString *)fieldWithPrefix:(NSString *)prefix;
- (NSString *)fieldWithPrefix:(NSString *)prefix terminator:(NSString *)term;
@end
@interface DoCoMoParsedResult : ParsedResult {
}
@end

View file

@ -0,0 +1,25 @@
//
// DoCoMoResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface NSString (DoCoMoFieldParsing)
- (NSString *)backslashUnescaped;
- (NSArray *)fieldsWithPrefix:(NSString *)prefix;
- (NSArray *)fieldsWithPrefix:(NSString *)prefix terminator:(NSString *)term;
- (NSString *)fieldWithPrefix:(NSString *)prefix;
- (NSString *)fieldWithPrefix:(NSString *)prefix terminator:(NSString *)term;
@end
@interface DoCoMoResultParser : ResultParser {
}
@end

View file

@ -1,25 +1,13 @@
//
// DoCoMoParsedResult.m
// DoCoMoResultParser.m
// ZXing
//
// Created by Christian Brunschen on 28/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "DoCoMoResultParser.h"
#import "DoCoMoParsedResult.h"
@implementation NSString (DoCoMoFieldParsing)
@ -107,6 +95,7 @@
@end
@implementation DoCoMoParsedResult
@implementation DoCoMoResultParser
@end

View file

@ -0,0 +1,16 @@
//
// EmailDoCoMoResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DoCoMoResultParser.h"
@interface EmailDoCoMoResultParser : DoCoMoResultParser {
}
@end

View file

@ -0,0 +1,47 @@
//
// EmailDoCoMoResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "EmailDoCoMoResultParser.h"
#import "EmailParsedResult.h"
bool LooksLikeAnEmailAddress(NSString *s) {
if ([s rangeOfString:@"@"].location == NSNotFound) {
return false;
}
if ([s rangeOfString:@"."].location == NSNotFound) {
return false;
}
if ([s rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) {
return false;
}
return true;
}
@implementation EmailDoCoMoResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange foundRange = [s rangeOfString:@"MATMSG:"];
if (foundRange.location == NSNotFound) {
return nil;
}
NSString *to = [s fieldWithPrefix:@"TO:"];
if (to == nil) {
return nil;
}
EmailParsedResult *result = [[EmailParsedResult alloc] init];
result.to = to;
result.subject = [s fieldWithPrefix:@"SUB:"];
result.body = [s fieldWithPrefix:@"BODY:"];
return [result autorelease];
}
@end

View file

@ -20,11 +20,9 @@
*/
#import <UIKit/UIKit.h>
#import "DoCoMoParsedResult.h"
#import "ParsedResult.h"
extern bool LooksLikeAnEmailAddress(NSString *s);
@interface EmailDoCoMoParsedResult : DoCoMoParsedResult {
@interface EmailParsedResult : ParsedResult {
NSString *to;
NSString *subject;
NSString *body;

View file

@ -19,47 +19,15 @@
* limitations under the License.
*/
#import "EmailDoCoMoParsedResult.h"
#import "EmailParsedResult.h"
#import "EmailAction.h"
bool LooksLikeAnEmailAddress(NSString *s) {
if ([s rangeOfString:@"@"].location == NSNotFound) {
return false;
}
if ([s rangeOfString:@"."].location == NSNotFound) {
return false;
}
if ([s rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) {
return false;
}
return true;
}
@implementation EmailDoCoMoParsedResult
@implementation EmailParsedResult
@synthesize to;
@synthesize subject;
@synthesize body;
+ parsedResultForString:(NSString *)s {
NSRange foundRange = [s rangeOfString:@"MATMSG:"];
if (foundRange.location == NSNotFound) {
return nil;
}
NSString *to = [s fieldWithPrefix:@"TO:"];
if (to == nil) {
return nil;
}
EmailDoCoMoParsedResult *result = [[self alloc] init];
result.to = to;
result.subject = [s fieldWithPrefix:@"SUB:"];
result.body = [s fieldWithPrefix:@"BODY:"];
return [result autorelease];
}
- (NSString *)stringForDisplay {
NSMutableString *result = [NSMutableString string];
[result appendFormat:@"To: %@", self.to];
@ -82,4 +50,9 @@ bool LooksLikeAnEmailAddress(NSString *s) {
body:self.body]];
}
- (UIImage *)icon {
return [UIImage imageNamed:@"email.png"];
}
@end

View file

@ -22,8 +22,6 @@
#import "GeoParsedResult.h"
#import "ShowMapAction.h"
#define PREFIX @"geo:"
@implementation GeoParsedResult
@synthesize location;
@ -36,20 +34,15 @@
}
+ parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int restStart = prefixRange.location + prefixRange.length;
return [[[self alloc] initWithLocation:[s substringFromIndex:restStart]]
autorelease];
}
return nil;
+ (NSString *)typeName {
return @"Geolocation";
}
+ (NSString *)typeName {
return @"GeoLoc";
- (UIImage *)icon {
return [UIImage imageNamed:@"map-pin.png"];
}
- (NSString *)stringForDisplay {
return [NSString stringWithFormat:@"Geo: %@", self.location];
}

View file

@ -0,0 +1,16 @@
//
// GeoResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface GeoResultParser : ResultParser {
}
@end

View file

@ -0,0 +1,26 @@
//
// GeoResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "GeoResultParser.h"
#import "GeoParsedResult.h"
#define PREFIX @"geo:"
@implementation GeoResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int restStart = prefixRange.location + prefixRange.length;
return [[[GeoParsedResult alloc] initWithLocation:[s substringFromIndex:restStart]]
autorelease];
}
return nil;
}
@end

View file

@ -0,0 +1,16 @@
//
// MeCardParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DoCoMoResultParser.h"
@interface MeCardParser : DoCoMoResultParser {
}
@end

View file

@ -0,0 +1,37 @@
//
// MeCardParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "MeCardParser.h"
#import "BusinessCardParsedResult.h"
@implementation MeCardParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange foundRange = [s rangeOfString:@"MECARD:"];
if (foundRange.location == NSNotFound) {
return nil;
}
NSString *name = [s fieldWithPrefix:@"N:"];
if (name == nil) {
return nil;
}
BusinessCardParsedResult *result = [[BusinessCardParsedResult alloc] init];
result.name = name;
result.phoneNumbers = [s fieldsWithPrefix:@"TEL:"];
result.email = [s fieldWithPrefix:@"EMAIL:"];
result.note = [s fieldWithPrefix:@"NOTE:"];
result.urlString = [s fieldWithPrefix:@"URL:"];
result.address = [s fieldWithPrefix:@"ADR:"];
return [result autorelease];
}
@end

View file

@ -38,7 +38,7 @@
}
- (NSString *)title {
return [NSString localizedStringWithFormat:NSLocalizedString(@"Open %@", @"action title"), self.URL];
return [NSString localizedStringWithFormat:NSLocalizedString(@"Open URL", @"action title"), self.URL];
}
- (NSString *)alertTitle {

View file

@ -25,8 +25,6 @@
NSMutableArray *actions;
}
+ (NSArray *)parsedResultTypes;
+ parsedResultForString:(NSString *)s;
+ (NSString *)typeName;
- (NSString *)stringForDisplay;

View file

@ -23,11 +23,9 @@
#import "TextParsedResult.h"
#import "TelParsedResult.h"
#import "EmailDoCoMoParsedResult.h"
#import "AddressBookDoCoMoParsedResult.h"
#import "EmailParsedResult.h"
#import "BusinessCardParsedResult.h"
#import "URIParsedResult.h"
#import "URLTOParsedResult.h"
#import "BookmarkDoCoMoParsedResult.h"
#import "GeoParsedResult.h"
#import "UIKit/UIStringDrawing.h"
@ -35,39 +33,8 @@
@implementation ParsedResult
static NSArray *parsedResultTypes = nil;
static NSMutableDictionary *iconsByClass = nil;
+ (NSArray *)parsedResultTypes {
if (parsedResultTypes == nil) {
parsedResultTypes =
[[NSArray alloc] initWithObjects:
[AddressBookDoCoMoParsedResult class],
[EmailDoCoMoParsedResult class],
[BookmarkDoCoMoParsedResult class],
[URLTOParsedResult class],
[TelParsedResult class],
[GeoParsedResult class],
[URIParsedResult class],
[TextParsedResult class],
nil];
}
return parsedResultTypes;
}
+ parsedResultForString:(NSString *)s {
#ifdef DEBUG
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
#endif
for (Class c in [self parsedResultTypes]) {
ParsedResult *result = [c parsedResultForString:s];
if (result != nil) {
return result;
}
}
return nil;
}
+ (NSString *)typeName {
return NSStringFromClass(self);
}

View file

@ -0,0 +1,18 @@
//
// ResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ParsedResult.h"
@interface ResultParser : NSObject {
}
+ (ParsedResult *)parsedResultForString:(NSString *)s;
@end

View file

@ -0,0 +1,57 @@
//
// ResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "ResultParser.h"
#import "MeCardParser.h"
#import "EmailDoCoMoResultParser.h"
#import "BookmarkDoCoMoResultParser.h"
#import "TelResultParser.h"
#import "GeoResultParser.h"
#import "URLTOResultParser.h"
#import "URLResultParser.h"
#import "TextResultParser.h"
#import "SMSResultParser.h"
#import "SMSTOResultParser.h"
@implementation ResultParser
static NSArray *resultParsers = nil;
+ (NSArray *)resultParsers {
if (resultParsers == nil) {
resultParsers =
[[NSArray alloc] initWithObjects:
[MeCardParser class],
[EmailDoCoMoResultParser class],
[BookmarkDoCoMoResultParser class],
[TelResultParser class],
[GeoResultParser class],
[SMSTOResultParser class],
[SMSResultParser class],
[URLTOResultParser class],
[URLResultParser class],
[TextResultParser class],
nil];
}
return resultParsers;
}
+ (ParsedResult *)parsedResultForString:(NSString *)s {
#ifdef DEBUG
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
#endif
for (Class c in [self resultParsers]) {
ParsedResult *result = [c parsedResultForString:s];
if (result != nil) {
return result;
}
}
return nil;
}
@end

View file

@ -23,7 +23,12 @@
#import "CallAction.h"
@interface SMSAction : CallAction {
NSString *body;
}
@property (nonatomic, copy) NSString *body;
+ actionWithNumber:(NSString *)number body:(NSString *)body;
+ actionWithNumber:(NSString *)number;
@end

View file

@ -24,11 +24,35 @@
@implementation SMSAction
+ (NSURL *)urlForNumber:(NSString *)number {
NSString *urlString = [NSString stringWithFormat:@"sms:%@", number];
@synthesize body;
+ (NSURL *)urlForNumber:(NSString *)number withBody:(NSString *)body {
NSString *urlString = body ?
[NSString stringWithFormat:@"sms:%@?body=%@", number, [body stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] :
[NSString stringWithFormat:@"sms:%@", number];
return [NSURL URLWithString:urlString];
}
- initWithNumber:(NSString *)n body:(NSString *)b {
if ((self = [super initWithURL:[[self class] urlForNumber:n withBody:b]]) != nil) {
self.number = n;
self.body = b;
}
return self;
}
- initWithNumber:(NSString *)n {
return [self initWithNumber:n body:nil];
}
+ actionWithNumber:(NSString *)number body:(NSString *)body {
return [[[self alloc] initWithNumber:number body:body] autorelease];
}
+ actionWithNumber:(NSString *)number {
return [self actionWithNumber:number body:nil];
}
- (NSString *)title {
return [NSString localizedStringWithFormat:NSLocalizedString(@"Compose SMS to %@", @"action title"), self.number];
}
@ -45,8 +69,8 @@
return NSLocalizedString(@"Compose", @"alert button title");
}
- (void) dealloc {
[body release];
[super dealloc];
}

View file

@ -0,0 +1,23 @@
//
// SMSParsedResult.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ParsedResult.h"
@interface SMSParsedResult : ParsedResult {
NSString *number;
NSString *body;
}
@property (nonatomic, copy) NSString *number;
@property (nonatomic, copy) NSString *body;
- initWithNumber:(NSString *)n body:(NSString *)b;
@end

View file

@ -0,0 +1,52 @@
//
// SMSParsedResult.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "SMSParsedResult.h"
#import "SMSAction.h"
@implementation SMSParsedResult
@synthesize number;
@synthesize body;
- initWithNumber:(NSString *)n body:(NSString *)b {
if ((self = [super init]) != nil) {
self.number = n;
self.body = b;
}
return self;
}
- (NSString *)stringForDisplay {
if (self.body) {
return [NSString stringWithFormat:@"%@\n%@", self.number, self.body];
}
return self.number;
}
+ (NSString *)typeName {
return @"SMS";
}
- (UIImage *)icon {
return [UIImage imageNamed:@"sms.png"];
}
- (void)populateActions {
[actions addObject:[SMSAction actionWithNumber:self.number body:self.body]];
}
- (void) dealloc {
[number release];
[body release];
[super dealloc];
}
@end

View file

@ -0,0 +1,16 @@
//
// SMSResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface SMSResultParser : ResultParser {
}
@end

View file

@ -0,0 +1,61 @@
//
// SMSResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "SMSResultParser.h"
#import "SMSParsedResult.h"
#define PREFIX @"sms:"
@implementation SMSResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int max = [s length];
int restStart = prefixRange.location + prefixRange.length;
// initial presuption: everything after the prefix is the number, and there is no body
NSRange numberRange = NSMakeRange(restStart, max - restStart);
NSRange bodyRange = NSMakeRange(NSNotFound, 0);
// is there a query string?
NSRange queryRange = [s rangeOfString:@"?" options:0 range:numberRange];
if (queryRange.location != NSNotFound) {
// truncate the number range at the beginning of the query string
numberRange.length = queryRange.location - numberRange.location;
int paramsStart = queryRange.location + queryRange.length;
NSRange paramsRange = NSMakeRange(paramsStart, max - paramsStart);
NSRange bodyPrefixRange = [s rangeOfString:@"body=" options:0 range:paramsRange];
if (bodyPrefixRange.location != NSNotFound) {
int bodyStart = bodyPrefixRange.location + bodyPrefixRange.length;
bodyRange = NSMakeRange(bodyStart, max - bodyStart);
NSRange ampRange = [s rangeOfString:@"&" options:0 range:bodyRange];
if (ampRange.location != NSNotFound) {
// we found a '&', so we truncate the body range there
bodyRange.length = ampRange.location - bodyRange.location;
}
}
}
// if there's a semicolon in the number, truncate the number there
NSRange semicolonRange = [s rangeOfString:@";" options:0 range:numberRange];
if (semicolonRange.location != NSNotFound) {
numberRange.length = semicolonRange.location - numberRange.location;
}
NSString *number = [s substringWithRange:numberRange];
NSString *body = bodyRange.location != NSNotFound ? [s substringWithRange:bodyRange] : nil;
return [[[SMSParsedResult alloc] initWithNumber:number body:body]
autorelease];
}
return nil;
}
@end

View file

@ -0,0 +1,16 @@
//
// SMSTOResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface SMSTOResultParser : ResultParser {
}
@end

View file

@ -0,0 +1,40 @@
//
// SMSTOResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "SMSTOResultParser.h"
#import "SMSParsedResult.h"
#define PREFIX @"SMSTO:"
@implementation SMSTOResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int max = [s length];
int restStart = prefixRange.location + prefixRange.length;
NSRange searchRange = NSMakeRange(restStart, max - restStart);
NSRange colonRange = [s rangeOfString:@":" options:0 range:searchRange];
if (colonRange.location != NSNotFound) {
NSRange numberRange = NSMakeRange(restStart,
colonRange.location - restStart);
int bodyStart = colonRange.location + colonRange.length;
NSRange bodyRange = NSMakeRange(bodyStart, max - bodyStart);
return [[[SMSParsedResult alloc] initWithNumber:[s substringWithRange:numberRange]
body:[s substringWithRange:bodyRange]]
autorelease];
} else {
return [[[SMSParsedResult alloc] initWithNumber:[s substringFromIndex:restStart]
body:nil]
autorelease];
}
}
return nil;
}
@end

View file

@ -13,6 +13,7 @@
@interface ScanViewController : UITableViewController {
IBOutlet ParsedResult *result;
IBOutlet Scan *scan;
UIFont *bodyFont;
}
@property (nonatomic, retain) ParsedResult *result;

View file

@ -11,6 +11,7 @@
#define TEXT_VIEW_TAG 0x17
#define BUTTON_LABEL_TAG 0x17
#define TITLE_HEIGHT 44
#define BODY_HEIGHT 88
@ -19,11 +20,15 @@
@synthesize result;
@synthesize scan;
#define FONT_NAME @"TimesNewRomanPSMT"
#define FONT_SIZE 16
- (id)initWithResult:(ParsedResult *)r forScan:(Scan *)s {
if (self = [super initWithStyle:UITableViewStyleGrouped]) {
self.result = r;
self.scan = s;
self.title = NSLocalizedString(@"Scan", @"scan view controller title");
bodyFont = [[UIFont fontWithName:FONT_NAME size:FONT_SIZE] retain];
}
return self;
}
@ -64,6 +69,7 @@
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 320, BODY_HEIGHT) reuseIdentifier:BodyIdentifier] autorelease];
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectInset(cell.contentView.bounds, 6, 6)];
textView.font = bodyFont;
[textView setTag:TEXT_VIEW_TAG];
textView.editable = NO;
[textView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
@ -75,9 +81,19 @@
- (UITableViewCell *)buttonCellInTableView:(UITableView *)tableView {
static NSString *ButtonIdentifier = @"ScanViewButtonIdentifier";
UITableViewCell *cell = [self cellWithIdentifier:ButtonIdentifier inTableView:tableView];
cell.textAlignment = UITextAlignmentCenter;
cell.textColor = [UIColor grayColor];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ButtonIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 320, 44) reuseIdentifier:ButtonIdentifier] autorelease];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectInset(cell.contentView.bounds, 6, 6)];
label.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
[label setTag:BUTTON_LABEL_TAG];
label.lineBreakMode = UILineBreakModeMiddleTruncation;
label.textColor = [UIColor grayColor];
label.textAlignment = UITextAlignmentCenter;
[label setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
[cell.contentView addSubview:label];
[label release];
}
return cell;
}
@ -86,7 +102,11 @@
if (indexPath.row == 0) {
return TITLE_HEIGHT;
} else if (indexPath.row == 1) {
return BODY_HEIGHT;
CGSize size = [[result stringForDisplay] sizeWithFont:bodyFont constrainedToSize:CGSizeMake(280.0, 200.0) lineBreakMode:UILineBreakModeWordWrap];
#ifdef DEBUG
NSLog(@"text size = %f", size.height);
#endif
return fminf(200, fmaxf(44, size.height + 24));
}
}
return tableView.rowHeight;
@ -109,7 +129,8 @@
} else if (indexPath.section == 1) {
cell = [self buttonCellInTableView:tableView];
ResultAction *action = [[result actions] objectAtIndex:indexPath.row];
cell.text = [action title];
UILabel *label = (UILabel *)[cell viewWithTag:BUTTON_LABEL_TAG];
label.text = [action title];
}
return cell;
@ -160,6 +181,7 @@
- (void)dealloc {
[result release];
[scan release];
[bodyFont release];
[super dealloc];
}

View file

@ -22,8 +22,6 @@
#import "TelParsedResult.h"
#import "CallAction.h"
#define PREFIX @"tel:"
@implementation TelParsedResult
@synthesize number;
@ -35,16 +33,6 @@
return self;
}
+ parsedResultForString:(NSString *)s {
NSRange telRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (telRange.location == 0) {
int restStart = telRange.location + telRange.length;
return [[[self alloc] initWithNumber:[s substringFromIndex:restStart]]
autorelease];
}
return nil;
}
- (NSString *)stringForDisplay {
return self.number;
}
@ -54,9 +42,12 @@
return @"Tel";
}
- (UIImage *)icon {
return [UIImage imageNamed:@"phone.png"];
}
- (NSArray *)actions {
return [NSArray arrayWithObject:[CallAction actionWithNumber:self.number]];
- (void)populateActions {
[actions addObject:[CallAction actionWithNumber:self.number]];
}
- (void) dealloc {

View file

@ -0,0 +1,16 @@
//
// TelResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface TelResultParser : NSObject {
}
@end

View file

@ -0,0 +1,27 @@
//
// TelResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "TelResultParser.h"
#import "TelParsedResult.h"
#define PREFIX @"tel:"
@implementation TelResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange telRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (telRange.location == 0) {
int restStart = telRange.location + telRange.length;
return [[[TelParsedResult alloc] initWithNumber:[s substringFromIndex:restStart]]
autorelease];
}
return nil;
}
@end

View file

@ -33,14 +33,14 @@
return self;
}
+ parsedResultForString:(NSString *)s {
return [[[self alloc] initWithString:s] autorelease];
}
+ (NSString *)typeName {
return @"Text";
}
- (UIImage *)icon {
return [UIImage imageNamed:@"text.png"];
}
- (NSString *)stringForDisplay {
return self.text;
}

View file

@ -0,0 +1,17 @@
//
// TextResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface TextResultParser : ResultParser {
}
@end

View file

@ -0,0 +1,19 @@
//
// TextResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "TextResultParser.h"
#import "TextParsedResult.h"
@implementation TextResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
return [[[TextParsedResult alloc] initWithString:s] autorelease];
}
@end

View file

@ -29,13 +29,17 @@
@interface URIParsedResult : ParsedResult {
NSString *urlString;
NSString *title;
NSURL *URL;
}
- initWithURLString:(NSString *)s title:(NSString *)t URL:(NSURL *)ur;
- initWithURLString:(NSString *)s title:(NSString *)t;
- initWithURLString:(NSString *)s URL:(NSURL *)ur;
- initWithURLString:(NSString *)s;
@property (nonatomic, retain) NSString *urlString;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSURL *URL;
@end

View file

@ -24,93 +24,51 @@
#import "EmailAction.h"
#import "SMSAction.h"
@implementation NSString (ZXingURLExtensions)
- (bool)looksLikeAURI {
if ([self rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) {
return false;
}
if ([self rangeOfString:@":"].location == NSNotFound) {
return false;
}
return true;
}
- (NSString *)massagedURLString {
NSRange colonRange = [self rangeOfString:@":"];
if (colonRange.location == NSNotFound) {
return [NSString stringWithFormat:@"http://%@", self];
} else {
return [NSString stringWithFormat:@"%@%@",
[[self substringToIndex:colonRange.location] lowercaseString],
[self substringFromIndex:colonRange.location]
];
}
}
@end
@implementation URIParsedResult
#define PREFIX @"URL:"
@synthesize urlString;
@synthesize title;
@synthesize URL;
- (ResultAction *)createAction {
NSString *scheme = [self.URL scheme];
if (scheme) {
if ([@"mailto" isEqualToString:scheme]) {
return [EmailAction actionWithRecipient:[urlString substringFromIndex:7]
subject:nil
body:nil];
} else if ([@"sms" isEqualToString:scheme]) {
return [SMSAction actionWithNumber:[urlString substringFromIndex:4]];
}
}
return [OpenUrlAction actionWithURL:self.URL];
}
- initWithURLString:(NSString *)s URL:(NSURL *)url {
- initWithURLString:(NSString *)s title:(NSString *)t URL:(NSURL *)url {
if ((self = [super init]) != nil) {
self.urlString = s;
self.title = t;
self.URL = url;
}
return self;
}
- initWithURLString:(NSString *)s {
return [self initWithURLString:s URL:[NSURL URLWithString:s]];
- initWithURLString:(NSString *)s URL:(NSURL *)url {
return [self initWithURLString:s title:nil URL:url];
}
+ parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int restStart = prefixRange.location + prefixRange.length;
return [[[self alloc] initWithURLString:[[s substringFromIndex:restStart] massagedURLString]]
autorelease];
}
if ([s looksLikeAURI]) {
NSString *massaged = [s massagedURLString];
NSURL *url = [NSURL URLWithString:massaged];
if (url != nil) {
return [[[self alloc] initWithURLString:massaged URL:url] autorelease];
}
}
return nil;
- initWithURLString:(NSString *)s title:(NSString *)t {
return [self initWithURLString:s title:t URL:[NSURL URLWithString:s]];
}
- initWithURLString:(NSString *)s {
return [self initWithURLString:s title:nil URL:[NSURL URLWithString:s]];
}
- (NSString *)stringForDisplay {
return self.urlString;
return self.title ?
[NSString stringWithFormat:@"%@ <%@>", self.title, self.urlString] :
self.urlString;
}
+ (NSString *)typeName {
return @"URI";
}
- (UIImage *)icon {
return [UIImage imageNamed:@"link2.png"];
}
- (void)populateActions {
#ifdef DEBUG

View file

@ -0,0 +1,17 @@
//
// URIResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface URLResultParser : ResultParser {
}
@end

View file

@ -0,0 +1,63 @@
//
// URIResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "URLResultParser.h"
#import "URIParsedResult.h"
@implementation NSString (ZXingURLExtensions)
- (bool)looksLikeAURI {
if ([self rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) {
return false;
}
if ([self rangeOfString:@":"].location == NSNotFound) {
return false;
}
return true;
}
- (NSString *)massagedURLString {
NSRange colonRange = [self rangeOfString:@":"];
if (colonRange.location == NSNotFound) {
return [NSString stringWithFormat:@"http://%@", self];
} else {
return [NSString stringWithFormat:@"%@%@",
[[self substringToIndex:colonRange.location] lowercaseString],
[self substringFromIndex:colonRange.location]
];
}
}
@end
#define PREFIX @"URL:"
@implementation URLResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int restStart = prefixRange.location + prefixRange.length;
return [[[URIParsedResult alloc] initWithURLString:[[s substringFromIndex:restStart] massagedURLString]]
autorelease];
}
if ([s looksLikeAURI]) {
NSString *massaged = [s massagedURLString];
NSURL *url = [NSURL URLWithString:massaged];
if (url != nil) {
return [[[URIParsedResult alloc] initWithURLString:massaged URL:url] autorelease];
}
}
return nil;
}
@end

View file

@ -1,34 +0,0 @@
//
// URLTOParsedResult.h
// ZXing
//
// Created by Christian Brunschen on 29/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
#import "URIParsedResult.h"
@interface URLTOParsedResult : URIParsedResult {
NSString *title;
}
@property (nonatomic, copy) NSString *title;
- initWithURLString:(NSString *)s title:(NSString *)t;
@end

View file

@ -1,67 +0,0 @@
//
// URLTOParsedResult.m
// ZXing
//
// Created by Christian Brunschen on 29/05/2008.
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "URLTOParsedResult.h"
#define PREFIX @"UTRLTO:"
@implementation URLTOParsedResult
@synthesize title;
- initWithURLString:(NSString *)s title:(NSString *)t {
if ((self = [super initWithURLString:s]) != nil) {
self.title = t;
}
return self;
}
+ parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int max = [s length];
int titleStart = prefixRange.location + prefixRange.length;
NSRange searchRange = NSMakeRange(titleStart, max - titleStart);
NSRange colonRange = [s rangeOfString:@":" options:0 range:searchRange];
if (colonRange.location != NSNotFound) {
NSRange titleRange = NSMakeRange(titleStart,
colonRange.location - titleStart);
int linkStart = colonRange.location + colonRange.length;
NSRange linkRange = NSMakeRange(linkStart, max - linkStart);
return [[[self alloc] initWithURLString:[s substringWithRange:linkRange]
title:[s substringWithRange:titleRange]]
autorelease];
}
}
return nil;
}
- (NSString *)stringForDisplay {
return [NSString stringWithFormat:@"%@: %S", self.title, self.urlString];
}
+ (NSString *)typeName {
return @"UrlTo";
}
@end

View file

@ -0,0 +1,16 @@
//
// URLTOResultParser.h
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ResultParser.h"
@interface URLTOResultParser : ResultParser {
}
@end

View file

@ -0,0 +1,37 @@
//
// URLTOResultParser.m
// ZXing
//
// Created by Christian Brunschen on 25/06/2008.
// Copyright 2008 Google Inc. All rights reserved.
//
#import "URLTOResultParser.h"
#import "URIParsedResult.h"
#define PREFIX @"URLTO:"
@implementation URLTOResultParser
+ (ParsedResult *)parsedResultForString:(NSString *)s {
NSRange prefixRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
if (prefixRange.location == 0) {
int max = [s length];
int titleStart = prefixRange.location + prefixRange.length;
NSRange searchRange = NSMakeRange(titleStart, max - titleStart);
NSRange colonRange = [s rangeOfString:@":" options:0 range:searchRange];
if (colonRange.location != NSNotFound) {
NSRange titleRange = NSMakeRange(titleStart,
colonRange.location - titleStart);
int linkStart = colonRange.location + colonRange.length;
NSRange linkRange = NSMakeRange(linkStart, max - linkStart);
return [[[URIParsedResult alloc] initWithURLString:[s substringWithRange:linkRange]
title:[s substringWithRange:titleRange]]
autorelease];
}
}
return nil;
}
@end

View file

@ -31,6 +31,14 @@
@synthesize navigationController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
for (NSString *familyName in [UIFont familyNames]) {
NSLog(@"family name: '%@'", familyName);
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@" font name: '%@'", fontName);
}
}
/* create the view controller */
DecoderViewController *vc =
[[DecoderViewController alloc] initWithNibName:@"DecoderView"

View file

@ -64,12 +64,10 @@
8552C4980E0A61D6000CC4F0 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8552C4970E0A61D6000CC4F0 /* Default.png */; };
855A66800DF5E757007B394F /* ArchiveController.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66510DF5E757007B394F /* ArchiveController.m */; };
855A66810DF5E757007B394F /* Database.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66540DF5E757007B394F /* Database.m */; };
855A66820DF5E757007B394F /* AddressBookAUParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66560DF5E757007B394F /* AddressBookAUParsedResult.m */; };
855A66830DF5E757007B394F /* AddContactAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66580DF5E757007B394F /* AddContactAction.m */; };
855A66840DF5E757007B394F /* AddressBookDoCoMoParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A665A0DF5E757007B394F /* AddressBookDoCoMoParsedResult.m */; };
855A66840DF5E757007B394F /* BusinessCardParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A665A0DF5E757007B394F /* BusinessCardParsedResult.m */; };
855A66860DF5E757007B394F /* EmailAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A665E0DF5E757007B394F /* EmailAction.m */; };
855A66870DF5E757007B394F /* EmailDoCoMoParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66600DF5E757007B394F /* EmailDoCoMoParsedResult.m */; };
855A66880DF5E757007B394F /* DoCoMoParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66620DF5E757007B394F /* DoCoMoParsedResult.m */; };
855A66870DF5E757007B394F /* EmailParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66600DF5E757007B394F /* EmailParsedResult.m */; };
855A66890DF5E757007B394F /* CallAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66640DF5E757007B394F /* CallAction.m */; };
855A668A0DF5E757007B394F /* OpenUrlAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66660DF5E757007B394F /* OpenUrlAction.m */; };
855A668B0DF5E757007B394F /* ResultAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66680DF5E757007B394F /* ResultAction.m */; };
@ -81,8 +79,6 @@
855A66910DF5E757007B394F /* ParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66750DF5E757007B394F /* ParsedResult.m */; };
855A66920DF5E757007B394F /* NSString+HTML.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66770DF5E757007B394F /* NSString+HTML.m */; };
855A66930DF5E757007B394F /* URIParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A66790DF5E757007B394F /* URIParsedResult.m */; };
855A66940DF5E757007B394F /* URLTOParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A667B0DF5E757007B394F /* URLTOParsedResult.m */; };
855A66950DF5E757007B394F /* BookmarkDoCoMoParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A667D0DF5E757007B394F /* BookmarkDoCoMoParsedResult.m */; };
855A66960DF5E757007B394F /* Scan.m in Sources */ = {isa = PBXBuildFile; fileRef = 855A667F0DF5E757007B394F /* Scan.m */; };
855A66A50DF5E7B4007B394F /* scans.db in Resources */ = {isa = PBXBuildFile; fileRef = 855A66A00DF5E7B4007B394F /* scans.db */; };
855A66A60DF5E7B4007B394F /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 855A66A10DF5E7B4007B394F /* Settings.bundle */; };
@ -91,6 +87,27 @@
855A66BD0DF5E8D6007B394F /* libsqlite3.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 855A66BC0DF5E8D6007B394F /* libsqlite3.0.dylib */; };
855A66BF0DF5E8F8007B394F /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 855A66BE0DF5E8F8007B394F /* libiconv.2.dylib */; };
855A66D20DF5E954007B394F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 855A66D10DF5E954007B394F /* CoreGraphics.framework */; };
85C0B9140E123AFC005EED58 /* ResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0B9130E123AFC005EED58 /* ResultParser.m */; };
85C0B91A0E123BD2005EED58 /* DoCoMoResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0B9190E123BD2005EED58 /* DoCoMoResultParser.m */; };
85C0B9220E123C93005EED58 /* MeCardParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0B9210E123C93005EED58 /* MeCardParser.m */; };
85C0B9AB0E123DB6005EED58 /* EmailDoCoMoResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0B9AA0E123DB6005EED58 /* EmailDoCoMoResultParser.m */; };
85C0B9BA0E123E99005EED58 /* TelResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0B9B90E123E99005EED58 /* TelResultParser.m */; };
85C0BA020E123F30005EED58 /* TextResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BA010E123F30005EED58 /* TextResultParser.m */; };
85C0BA5A0E124497005EED58 /* URLTOResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BA590E124497005EED58 /* URLTOResultParser.m */; };
85C0BA640E124AC7005EED58 /* URLResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BA630E124AC7005EED58 /* URLResultParser.m */; };
85C0BAFA0E1250E4005EED58 /* BookmarkDoCoMoResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BAF90E1250E4005EED58 /* BookmarkDoCoMoResultParser.m */; };
85C0BAFD0E12515D005EED58 /* GeoResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BAFC0E12515D005EED58 /* GeoResultParser.m */; };
85C0BC100E12548D005EED58 /* SMSTOResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BC0F0E12548D005EED58 /* SMSTOResultParser.m */; };
85C0BC140E1254C0005EED58 /* SMSParsedResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BC130E1254C0005EED58 /* SMSParsedResult.m */; };
85C0BC1C0E125842005EED58 /* SMSResultParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 85C0BC1B0E125842005EED58 /* SMSResultParser.m */; };
85C3CC350E119E1700A01C6A /* business-card.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC2D0E119E1600A01C6A /* business-card.png */; };
85C3CC360E119E1700A01C6A /* email.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC2E0E119E1700A01C6A /* email.png */; };
85C3CC370E119E1700A01C6A /* link1.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC2F0E119E1700A01C6A /* link1.png */; };
85C3CC380E119E1700A01C6A /* link2.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC300E119E1700A01C6A /* link2.png */; };
85C3CC390E119E1700A01C6A /* map-pin.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC310E119E1700A01C6A /* map-pin.png */; };
85C3CC3A0E119E1700A01C6A /* phone.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC320E119E1700A01C6A /* phone.png */; };
85C3CC3B0E119E1700A01C6A /* sms.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC330E119E1700A01C6A /* sms.png */; };
85C3CC3C0E119E1700A01C6A /* text.png in Resources */ = {isa = PBXBuildFile; fileRef = 85C3CC340E119E1700A01C6A /* text.png */; };
85D937270E11064700B785E0 /* ScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 85D937260E11064700B785E0 /* ScanViewController.m */; };
/* End PBXBuildFile section */
@ -239,18 +256,14 @@
855A66520DF5E757007B394F /* ArchiveController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveController.h; sourceTree = "<group>"; };
855A66530DF5E757007B394F /* Database.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Database.h; sourceTree = "<group>"; };
855A66540DF5E757007B394F /* Database.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Database.m; sourceTree = "<group>"; };
855A66550DF5E757007B394F /* AddressBookAUParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddressBookAUParsedResult.h; sourceTree = "<group>"; };
855A66560DF5E757007B394F /* AddressBookAUParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddressBookAUParsedResult.m; sourceTree = "<group>"; };
855A66570DF5E757007B394F /* AddContactAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddContactAction.h; sourceTree = "<group>"; };
855A66580DF5E757007B394F /* AddContactAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddContactAction.m; sourceTree = "<group>"; };
855A66590DF5E757007B394F /* AddressBookDoCoMoParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddressBookDoCoMoParsedResult.h; sourceTree = "<group>"; };
855A665A0DF5E757007B394F /* AddressBookDoCoMoParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddressBookDoCoMoParsedResult.m; sourceTree = "<group>"; };
855A66590DF5E757007B394F /* BusinessCardParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BusinessCardParsedResult.h; sourceTree = "<group>"; };
855A665A0DF5E757007B394F /* BusinessCardParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BusinessCardParsedResult.m; sourceTree = "<group>"; };
855A665D0DF5E757007B394F /* EmailAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailAction.h; sourceTree = "<group>"; };
855A665E0DF5E757007B394F /* EmailAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailAction.m; sourceTree = "<group>"; };
855A665F0DF5E757007B394F /* EmailDoCoMoParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailDoCoMoParsedResult.h; sourceTree = "<group>"; };
855A66600DF5E757007B394F /* EmailDoCoMoParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailDoCoMoParsedResult.m; sourceTree = "<group>"; };
855A66610DF5E757007B394F /* DoCoMoParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoCoMoParsedResult.h; sourceTree = "<group>"; };
855A66620DF5E757007B394F /* DoCoMoParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DoCoMoParsedResult.m; sourceTree = "<group>"; };
855A665F0DF5E757007B394F /* EmailParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailParsedResult.h; sourceTree = "<group>"; };
855A66600DF5E757007B394F /* EmailParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailParsedResult.m; sourceTree = "<group>"; };
855A66630DF5E757007B394F /* CallAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallAction.h; sourceTree = "<group>"; };
855A66640DF5E757007B394F /* CallAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CallAction.m; sourceTree = "<group>"; };
855A66650DF5E757007B394F /* OpenUrlAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenUrlAction.h; sourceTree = "<group>"; };
@ -274,10 +287,6 @@
855A66770DF5E757007B394F /* NSString+HTML.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+HTML.m"; sourceTree = "<group>"; };
855A66780DF5E757007B394F /* URIParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URIParsedResult.h; sourceTree = "<group>"; };
855A66790DF5E757007B394F /* URIParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = URIParsedResult.m; sourceTree = "<group>"; };
855A667A0DF5E757007B394F /* URLTOParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLTOParsedResult.h; sourceTree = "<group>"; };
855A667B0DF5E757007B394F /* URLTOParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = URLTOParsedResult.m; sourceTree = "<group>"; };
855A667C0DF5E757007B394F /* BookmarkDoCoMoParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BookmarkDoCoMoParsedResult.h; sourceTree = "<group>"; };
855A667D0DF5E757007B394F /* BookmarkDoCoMoParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BookmarkDoCoMoParsedResult.m; sourceTree = "<group>"; };
855A667E0DF5E757007B394F /* Scan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scan.h; sourceTree = "<group>"; };
855A667F0DF5E757007B394F /* Scan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Scan.m; sourceTree = "<group>"; };
855A66A00DF5E7B4007B394F /* scans.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = scans.db; sourceTree = "<group>"; };
@ -291,6 +300,40 @@
857D36400DF60E37000E0C89 /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; };
857D368E0DF613F3000E0C89 /* GrayBytesMonochromeBitmapSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrayBytesMonochromeBitmapSource.h; sourceTree = "<group>"; };
857D368F0DF613F3000E0C89 /* GrayBytesMonochromeBitmapSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrayBytesMonochromeBitmapSource.cpp; sourceTree = "<group>"; };
85C0B9120E123AFC005EED58 /* ResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultParser.h; sourceTree = "<group>"; };
85C0B9130E123AFC005EED58 /* ResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultParser.m; sourceTree = "<group>"; };
85C0B9180E123BD2005EED58 /* DoCoMoResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoCoMoResultParser.h; sourceTree = "<group>"; };
85C0B9190E123BD2005EED58 /* DoCoMoResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DoCoMoResultParser.m; sourceTree = "<group>"; };
85C0B9200E123C93005EED58 /* MeCardParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeCardParser.h; sourceTree = "<group>"; };
85C0B9210E123C93005EED58 /* MeCardParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeCardParser.m; sourceTree = "<group>"; };
85C0B9A90E123DB6005EED58 /* EmailDoCoMoResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmailDoCoMoResultParser.h; sourceTree = "<group>"; };
85C0B9AA0E123DB6005EED58 /* EmailDoCoMoResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EmailDoCoMoResultParser.m; sourceTree = "<group>"; };
85C0B9B80E123E99005EED58 /* TelResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelResultParser.h; sourceTree = "<group>"; };
85C0B9B90E123E99005EED58 /* TelResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TelResultParser.m; sourceTree = "<group>"; };
85C0BA000E123F30005EED58 /* TextResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextResultParser.h; sourceTree = "<group>"; };
85C0BA010E123F30005EED58 /* TextResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextResultParser.m; sourceTree = "<group>"; };
85C0BA580E124497005EED58 /* URLTOResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLTOResultParser.h; sourceTree = "<group>"; };
85C0BA590E124497005EED58 /* URLTOResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = URLTOResultParser.m; sourceTree = "<group>"; };
85C0BA620E124AC7005EED58 /* URLResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLResultParser.h; sourceTree = "<group>"; };
85C0BA630E124AC7005EED58 /* URLResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = URLResultParser.m; sourceTree = "<group>"; };
85C0BAF80E1250E4005EED58 /* BookmarkDoCoMoResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BookmarkDoCoMoResultParser.h; sourceTree = "<group>"; };
85C0BAF90E1250E4005EED58 /* BookmarkDoCoMoResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BookmarkDoCoMoResultParser.m; sourceTree = "<group>"; };
85C0BAFB0E12515D005EED58 /* GeoResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoResultParser.h; sourceTree = "<group>"; };
85C0BAFC0E12515D005EED58 /* GeoResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeoResultParser.m; sourceTree = "<group>"; };
85C0BC0E0E12548D005EED58 /* SMSTOResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMSTOResultParser.h; sourceTree = "<group>"; };
85C0BC0F0E12548D005EED58 /* SMSTOResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SMSTOResultParser.m; sourceTree = "<group>"; };
85C0BC120E1254C0005EED58 /* SMSParsedResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMSParsedResult.h; sourceTree = "<group>"; };
85C0BC130E1254C0005EED58 /* SMSParsedResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SMSParsedResult.m; sourceTree = "<group>"; };
85C0BC1A0E125842005EED58 /* SMSResultParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMSResultParser.h; sourceTree = "<group>"; };
85C0BC1B0E125842005EED58 /* SMSResultParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SMSResultParser.m; sourceTree = "<group>"; };
85C3CC2D0E119E1600A01C6A /* business-card.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "business-card.png"; sourceTree = "<group>"; };
85C3CC2E0E119E1700A01C6A /* email.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = email.png; sourceTree = "<group>"; };
85C3CC2F0E119E1700A01C6A /* link1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = link1.png; sourceTree = "<group>"; };
85C3CC300E119E1700A01C6A /* link2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = link2.png; sourceTree = "<group>"; };
85C3CC310E119E1700A01C6A /* map-pin.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "map-pin.png"; sourceTree = "<group>"; };
85C3CC320E119E1700A01C6A /* phone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = phone.png; sourceTree = "<group>"; };
85C3CC330E119E1700A01C6A /* sms.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sms.png; sourceTree = "<group>"; };
85C3CC340E119E1700A01C6A /* text.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = text.png; sourceTree = "<group>"; };
85D937250E11064700B785E0 /* ScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanViewController.h; sourceTree = "<group>"; };
85D937260E11064700B785E0 /* ScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanViewController.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -325,40 +368,17 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
85D937250E11064700B785E0 /* ScanViewController.h */,
85D937260E11064700B785E0 /* ScanViewController.m */,
85096CCE0E06D45400D660F9 /* SMSAction.h */,
85096CCF0E06D45400D660F9 /* SMSAction.m */,
852683C00DF8562B005DD4C0 /* ShowMapAction.h */,
852683C10DF8562B005DD4C0 /* ShowMapAction.m */,
85C0B9100E123AC4005EED58 /* ResultParsers */,
85C0B8E70E1238FD005EED58 /* ParsedResults */,
85C0B8E80E123929005EED58 /* Actions */,
851B4BF40DF6C64A00C8958F /* TwoDDecoderResult.h */,
851B4BF50DF6C64A00C8958F /* TwoDDecoderResult.m */,
85D937250E11064700B785E0 /* ScanViewController.h */,
85D937260E11064700B785E0 /* ScanViewController.m */,
855A66510DF5E757007B394F /* ArchiveController.m */,
855A66520DF5E757007B394F /* ArchiveController.h */,
855A66530DF5E757007B394F /* Database.h */,
855A66540DF5E757007B394F /* Database.m */,
855A66550DF5E757007B394F /* AddressBookAUParsedResult.h */,
855A66560DF5E757007B394F /* AddressBookAUParsedResult.m */,
855A66570DF5E757007B394F /* AddContactAction.h */,
855A66580DF5E757007B394F /* AddContactAction.m */,
855A66590DF5E757007B394F /* AddressBookDoCoMoParsedResult.h */,
855A665A0DF5E757007B394F /* AddressBookDoCoMoParsedResult.m */,
855A665D0DF5E757007B394F /* EmailAction.h */,
855A665E0DF5E757007B394F /* EmailAction.m */,
855A665F0DF5E757007B394F /* EmailDoCoMoParsedResult.h */,
855A66600DF5E757007B394F /* EmailDoCoMoParsedResult.m */,
855A66610DF5E757007B394F /* DoCoMoParsedResult.h */,
855A66620DF5E757007B394F /* DoCoMoParsedResult.m */,
855A66630DF5E757007B394F /* CallAction.h */,
855A66640DF5E757007B394F /* CallAction.m */,
855A66650DF5E757007B394F /* OpenUrlAction.h */,
855A66660DF5E757007B394F /* OpenUrlAction.m */,
855A66670DF5E757007B394F /* ResultAction.h */,
855A66680DF5E757007B394F /* ResultAction.m */,
855A66690DF5E757007B394F /* TelParsedResult.h */,
855A666A0DF5E757007B394F /* TelParsedResult.m */,
855A666B0DF5E757007B394F /* TextParsedResult.h */,
855A666C0DF5E757007B394F /* TextParsedResult.m */,
855A666D0DF5E757007B394F /* DecoderViewController.h */,
855A666E0DF5E757007B394F /* DecoderViewController.m */,
855A666F0DF5E757007B394F /* DecoderDelegate.h */,
@ -366,20 +386,10 @@
855A66710DF5E757007B394F /* Decoder.m */,
855A66720DF5E757007B394F /* ZXingAppDelegate.h */,
855A66730DF5E757007B394F /* ZXingAppDelegate.m */,
855A66740DF5E757007B394F /* ParsedResult.h */,
855A66750DF5E757007B394F /* ParsedResult.m */,
855A66760DF5E757007B394F /* NSString+HTML.h */,
855A66770DF5E757007B394F /* NSString+HTML.m */,
855A66780DF5E757007B394F /* URIParsedResult.h */,
855A66790DF5E757007B394F /* URIParsedResult.m */,
855A667A0DF5E757007B394F /* URLTOParsedResult.h */,
855A667B0DF5E757007B394F /* URLTOParsedResult.m */,
855A667C0DF5E757007B394F /* BookmarkDoCoMoParsedResult.h */,
855A667D0DF5E757007B394F /* BookmarkDoCoMoParsedResult.m */,
855A667E0DF5E757007B394F /* Scan.h */,
855A667F0DF5E757007B394F /* Scan.m */,
852683A00DF851ED005DD4C0 /* GeoParsedResult.h */,
852683A10DF851ED005DD4C0 /* GeoParsedResult.m */,
);
path = Classes;
sourceTree = "<group>";
@ -419,6 +429,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
85C3CC0F0E119E0500A01C6A /* Images */,
852A99960E0BC49E003E6D6D /* Localizable.strings */,
855A66A00DF5E7B4007B394F /* scans.db */,
855A66A10DF5E7B4007B394F /* Settings.bundle */,
@ -642,6 +653,96 @@
path = detector;
sourceTree = "<group>";
};
85C0B8E70E1238FD005EED58 /* ParsedResults */ = {
isa = PBXGroup;
children = (
855A66590DF5E757007B394F /* BusinessCardParsedResult.h */,
855A665A0DF5E757007B394F /* BusinessCardParsedResult.m */,
855A665F0DF5E757007B394F /* EmailParsedResult.h */,
855A66600DF5E757007B394F /* EmailParsedResult.m */,
855A66690DF5E757007B394F /* TelParsedResult.h */,
855A666A0DF5E757007B394F /* TelParsedResult.m */,
855A666B0DF5E757007B394F /* TextParsedResult.h */,
855A666C0DF5E757007B394F /* TextParsedResult.m */,
855A66740DF5E757007B394F /* ParsedResult.h */,
855A66750DF5E757007B394F /* ParsedResult.m */,
855A66780DF5E757007B394F /* URIParsedResult.h */,
855A66790DF5E757007B394F /* URIParsedResult.m */,
852683A00DF851ED005DD4C0 /* GeoParsedResult.h */,
852683A10DF851ED005DD4C0 /* GeoParsedResult.m */,
85C0BC120E1254C0005EED58 /* SMSParsedResult.h */,
85C0BC130E1254C0005EED58 /* SMSParsedResult.m */,
);
name = ParsedResults;
sourceTree = "<group>";
};
85C0B8E80E123929005EED58 /* Actions */ = {
isa = PBXGroup;
children = (
85096CCE0E06D45400D660F9 /* SMSAction.h */,
85096CCF0E06D45400D660F9 /* SMSAction.m */,
852683C00DF8562B005DD4C0 /* ShowMapAction.h */,
852683C10DF8562B005DD4C0 /* ShowMapAction.m */,
855A66570DF5E757007B394F /* AddContactAction.h */,
855A66580DF5E757007B394F /* AddContactAction.m */,
855A665D0DF5E757007B394F /* EmailAction.h */,
855A665E0DF5E757007B394F /* EmailAction.m */,
855A66630DF5E757007B394F /* CallAction.h */,
855A66640DF5E757007B394F /* CallAction.m */,
855A66650DF5E757007B394F /* OpenUrlAction.h */,
855A66660DF5E757007B394F /* OpenUrlAction.m */,
855A66670DF5E757007B394F /* ResultAction.h */,
855A66680DF5E757007B394F /* ResultAction.m */,
);
name = Actions;
sourceTree = "<group>";
};
85C0B9100E123AC4005EED58 /* ResultParsers */ = {
isa = PBXGroup;
children = (
85C0B9120E123AFC005EED58 /* ResultParser.h */,
85C0B9130E123AFC005EED58 /* ResultParser.m */,
85C0B9180E123BD2005EED58 /* DoCoMoResultParser.h */,
85C0B9190E123BD2005EED58 /* DoCoMoResultParser.m */,
85C0B9200E123C93005EED58 /* MeCardParser.h */,
85C0B9210E123C93005EED58 /* MeCardParser.m */,
85C0B9A90E123DB6005EED58 /* EmailDoCoMoResultParser.h */,
85C0B9AA0E123DB6005EED58 /* EmailDoCoMoResultParser.m */,
85C0BAF80E1250E4005EED58 /* BookmarkDoCoMoResultParser.h */,
85C0BAF90E1250E4005EED58 /* BookmarkDoCoMoResultParser.m */,
85C0B9B80E123E99005EED58 /* TelResultParser.h */,
85C0B9B90E123E99005EED58 /* TelResultParser.m */,
85C0BA000E123F30005EED58 /* TextResultParser.h */,
85C0BA010E123F30005EED58 /* TextResultParser.m */,
85C0BA620E124AC7005EED58 /* URLResultParser.h */,
85C0BA630E124AC7005EED58 /* URLResultParser.m */,
85C0BA580E124497005EED58 /* URLTOResultParser.h */,
85C0BA590E124497005EED58 /* URLTOResultParser.m */,
85C0BC1A0E125842005EED58 /* SMSResultParser.h */,
85C0BC1B0E125842005EED58 /* SMSResultParser.m */,
85C0BAFB0E12515D005EED58 /* GeoResultParser.h */,
85C0BAFC0E12515D005EED58 /* GeoResultParser.m */,
85C0BC0E0E12548D005EED58 /* SMSTOResultParser.h */,
85C0BC0F0E12548D005EED58 /* SMSTOResultParser.m */,
);
name = ResultParsers;
sourceTree = "<group>";
};
85C3CC0F0E119E0500A01C6A /* Images */ = {
isa = PBXGroup;
children = (
85C3CC2D0E119E1600A01C6A /* business-card.png */,
85C3CC2E0E119E1700A01C6A /* email.png */,
85C3CC2F0E119E1700A01C6A /* link1.png */,
85C3CC300E119E1700A01C6A /* link2.png */,
85C3CC310E119E1700A01C6A /* map-pin.png */,
85C3CC320E119E1700A01C6A /* phone.png */,
85C3CC330E119E1700A01C6A /* sms.png */,
85C3CC340E119E1700A01C6A /* text.png */,
);
name = Images;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -732,6 +833,14 @@
852A99910E0BC43C003E6D6D /* MainWindow.xib in Resources */,
8552C4980E0A61D6000CC4F0 /* Default.png in Resources */,
852A99970E0BC49E003E6D6D /* Localizable.strings in Resources */,
85C3CC350E119E1700A01C6A /* business-card.png in Resources */,
85C3CC360E119E1700A01C6A /* email.png in Resources */,
85C3CC370E119E1700A01C6A /* link1.png in Resources */,
85C3CC380E119E1700A01C6A /* link2.png in Resources */,
85C3CC390E119E1700A01C6A /* map-pin.png in Resources */,
85C3CC3A0E119E1700A01C6A /* phone.png in Resources */,
85C3CC3B0E119E1700A01C6A /* sms.png in Resources */,
85C3CC3C0E119E1700A01C6A /* text.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -745,12 +854,10 @@
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
855A66800DF5E757007B394F /* ArchiveController.m in Sources */,
855A66810DF5E757007B394F /* Database.m in Sources */,
855A66820DF5E757007B394F /* AddressBookAUParsedResult.m in Sources */,
855A66830DF5E757007B394F /* AddContactAction.m in Sources */,
855A66840DF5E757007B394F /* AddressBookDoCoMoParsedResult.m in Sources */,
855A66840DF5E757007B394F /* BusinessCardParsedResult.m in Sources */,
855A66860DF5E757007B394F /* EmailAction.m in Sources */,
855A66870DF5E757007B394F /* EmailDoCoMoParsedResult.m in Sources */,
855A66880DF5E757007B394F /* DoCoMoParsedResult.m in Sources */,
855A66870DF5E757007B394F /* EmailParsedResult.m in Sources */,
855A66890DF5E757007B394F /* CallAction.m in Sources */,
855A668A0DF5E757007B394F /* OpenUrlAction.m in Sources */,
855A668B0DF5E757007B394F /* ResultAction.m in Sources */,
@ -762,14 +869,25 @@
855A66910DF5E757007B394F /* ParsedResult.m in Sources */,
855A66920DF5E757007B394F /* NSString+HTML.m in Sources */,
855A66930DF5E757007B394F /* URIParsedResult.m in Sources */,
855A66940DF5E757007B394F /* URLTOParsedResult.m in Sources */,
855A66950DF5E757007B394F /* BookmarkDoCoMoParsedResult.m in Sources */,
855A66960DF5E757007B394F /* Scan.m in Sources */,
851B4BF60DF6C64A00C8958F /* TwoDDecoderResult.m in Sources */,
852683A20DF851ED005DD4C0 /* GeoParsedResult.m in Sources */,
852683C20DF8562B005DD4C0 /* ShowMapAction.m in Sources */,
85096CD00E06D45400D660F9 /* SMSAction.m in Sources */,
85D937270E11064700B785E0 /* ScanViewController.m in Sources */,
85C0B9140E123AFC005EED58 /* ResultParser.m in Sources */,
85C0B91A0E123BD2005EED58 /* DoCoMoResultParser.m in Sources */,
85C0B9220E123C93005EED58 /* MeCardParser.m in Sources */,
85C0B9AB0E123DB6005EED58 /* EmailDoCoMoResultParser.m in Sources */,
85C0B9BA0E123E99005EED58 /* TelResultParser.m in Sources */,
85C0BA020E123F30005EED58 /* TextResultParser.m in Sources */,
85C0BA5A0E124497005EED58 /* URLTOResultParser.m in Sources */,
85C0BA640E124AC7005EED58 /* URLResultParser.m in Sources */,
85C0BAFA0E1250E4005EED58 /* BookmarkDoCoMoResultParser.m in Sources */,
85C0BAFD0E12515D005EED58 /* GeoResultParser.m in Sources */,
85C0BC100E12548D005EED58 /* SMSTOResultParser.m in Sources */,
85C0BC140E1254C0005EED58 /* SMSParsedResult.m in Sources */,
85C0BC1C0E125842005EED58 /* SMSResultParser.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -875,6 +993,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ZXing_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = ZXing;
};

View file

@ -43,10 +43,10 @@
"Open %@" = "%@ Öffnen";
/* alert title */
"Open URL" = "Webseite Öffnen";
"Open URL" = "Link Öffnen";
/* alert message */
"Open URL <%@>?" = "Webseite <%@> Öffnen?";
"Open URL <%@>?" = "Link <%@> Öffnen?";
/* No comment provided by engineer. */
"Please take or choose a picture containing a barcode" = "Bitte nehmen oder wählen Sie ein Bild mit Strichkod";