mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
[iphone/Barcodes/ZWingWidget] added ORG and TITLE tag support in Me card ResultParser. This is a bit ahead of the java version
git-svn-id: https://zxing.googlecode.com/svn/trunk@1709 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
6f62deca64
commit
b9d867c4aa
|
@ -509,10 +509,10 @@
|
||||||
1FB4327D1290295C002D63E8 /* Localizable.strings */ = {
|
1FB4327D1290295C002D63E8 /* Localizable.strings */ = {
|
||||||
isa = PBXVariantGroup;
|
isa = PBXVariantGroup;
|
||||||
children = (
|
children = (
|
||||||
|
1FF80CDB12A3AB1B00FE297C /* fr */,
|
||||||
1FB4327E1290295C002D63E8 /* de */,
|
1FB4327E1290295C002D63E8 /* de */,
|
||||||
1FB4328E12902968002D63E8 /* en */,
|
1FB4328E12902968002D63E8 /* en */,
|
||||||
1FB4329512902973002D63E8 /* sv */,
|
1FB4329512902973002D63E8 /* sv */,
|
||||||
1FF80CDB12A3AB1B00FE297C /* fr */,
|
|
||||||
);
|
);
|
||||||
name = Localizable.strings;
|
name = Localizable.strings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -551,6 +551,7 @@
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = Barcodes_Prefix.pch;
|
GCC_PREFIX_HEADER = Barcodes_Prefix.pch;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
INFOPLIST_FILE = "Barcodes-Info.plist";
|
INFOPLIST_FILE = "Barcodes-Info.plist";
|
||||||
OTHER_LDFLAGS = (
|
OTHER_LDFLAGS = (
|
||||||
"-all_load",
|
"-all_load",
|
||||||
|
@ -567,6 +568,7 @@
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = Barcodes_Prefix.pch;
|
GCC_PREFIX_HEADER = Barcodes_Prefix.pch;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
INFOPLIST_FILE = "Barcodes-Info.plist";
|
INFOPLIST_FILE = "Barcodes-Info.plist";
|
||||||
PRODUCT_NAME = Barcodes;
|
PRODUCT_NAME = Barcodes;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
|
@ -584,8 +586,8 @@
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"../ZXingWidget/Classes/**",
|
|
||||||
../../cpp/core/src,
|
../../cpp/core/src,
|
||||||
|
"../ZXingWidget/Classes/**",
|
||||||
);
|
);
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 4.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 4.1;
|
||||||
PREBINDING = NO;
|
PREBINDING = NO;
|
||||||
|
@ -602,6 +604,11 @@
|
||||||
GCC_C_LANGUAGE_STANDARD = c99;
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
HEADER_SEARCH_PATHS = (
|
||||||
|
../../cpp/core/src,
|
||||||
|
"../ZXingWidget/Classes/**",
|
||||||
|
);
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 4.1;
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
PREBINDING = NO;
|
PREBINDING = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
|
|
@ -90,9 +90,9 @@ static Database *sharedDatabase = nil;
|
||||||
sqlite3_bind_double(insertStatement, 3, timeStamp);
|
sqlite3_bind_double(insertStatement, 3, timeStamp);
|
||||||
sqlite3_step(insertStatement);
|
sqlite3_step(insertStatement);
|
||||||
sqlite3_reset(insertStatement);
|
sqlite3_reset(insertStatement);
|
||||||
NSDate* theDate = [NSDate dateWithTimeIntervalSince1970:timeStamp];
|
NSDate* theDate = [[NSDate alloc] initWithTimeIntervalSince1970:timeStamp];
|
||||||
Scan *scan = [[[Scan alloc] initWithIdent:nextScanIdent text:text stamp:theDate] autorelease];
|
Scan *scan = [[[Scan alloc] initWithIdent:nextScanIdent text:text stamp:theDate] autorelease];
|
||||||
|
[theDate release];
|
||||||
return scan;
|
return scan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +100,11 @@ static Database *sharedDatabase = nil;
|
||||||
NSMutableArray *scans = [NSMutableArray array];
|
NSMutableArray *scans = [NSMutableArray array];
|
||||||
while (SQLITE_ROW == sqlite3_step(selectAllStatement)) {
|
while (SQLITE_ROW == sqlite3_step(selectAllStatement)) {
|
||||||
int ident = sqlite3_column_int(selectAllStatement, 0);
|
int ident = sqlite3_column_int(selectAllStatement, 0);
|
||||||
NSString *text = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectAllStatement, 1)];
|
NSString *text = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(selectAllStatement, 1)];
|
||||||
NSDate *stamp = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_double(selectAllStatement, 2)];
|
NSDate *stamp = [[NSDate alloc] initWithTimeIntervalSince1970:sqlite3_column_double(selectAllStatement, 2)];
|
||||||
Scan *scan = [[Scan alloc] initWithIdent:ident text:text stamp:stamp];
|
Scan *scan = [[Scan alloc] initWithIdent:ident text:text stamp:stamp];
|
||||||
|
[text release];
|
||||||
|
[stamp release];
|
||||||
[scans addObject:scan];
|
[scans addObject:scan];
|
||||||
[scan release];
|
[scan release];
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,4 +37,10 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[stamp release];
|
||||||
|
[text release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -19,24 +19,16 @@
|
||||||
@interface ZXMainViewController : UIViewController <ZXingDelegate,UIActionSheetDelegate,ModalViewControllerDelegate> {
|
@interface ZXMainViewController : UIViewController <ZXingDelegate,UIActionSheetDelegate,ModalViewControllerDelegate> {
|
||||||
NSArray *actions;
|
NSArray *actions;
|
||||||
ParsedResult *result;
|
ParsedResult *result;
|
||||||
IBOutlet UITextView *resultView;
|
|
||||||
IBOutlet UIButton *lastActionButton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic,assign) NSArray *actions;
|
@property (nonatomic,assign) NSArray *actions;
|
||||||
@property (nonatomic,assign) ParsedResult *result;
|
@property (nonatomic,assign) ParsedResult *result;
|
||||||
@property (nonatomic,retain) IBOutlet UITextView *resultView;
|
|
||||||
@property (nonatomic,retain) IBOutlet UIButton *lastActionButton;
|
|
||||||
|
|
||||||
- (IBAction)scan:(id)sender;
|
- (IBAction)scan:(id)sender;
|
||||||
- (IBAction)info:(id)sender;
|
|
||||||
- (IBAction)showArchive:(id)sender;
|
|
||||||
- (IBAction)lastResultAction:(id)sender;
|
|
||||||
|
|
||||||
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result;
|
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result;
|
||||||
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller;
|
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller;
|
||||||
- (void)performResultAction;
|
- (void)performResultAction;
|
||||||
- (void)setResultViewWithText:(NSString*)theResult;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
@implementation ZXMainViewController
|
@implementation ZXMainViewController
|
||||||
@synthesize actions;
|
@synthesize actions;
|
||||||
@synthesize result;
|
@synthesize result;
|
||||||
@synthesize resultView;
|
|
||||||
@synthesize lastActionButton;
|
|
||||||
|
|
||||||
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
|
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
|
||||||
/*
|
/*
|
||||||
|
@ -37,10 +35,6 @@
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
self.navigationItem.title = @"Barcodes";
|
self.navigationItem.title = @"Barcodes";
|
||||||
NSString *rawLatestResult = [[NSUserDefaults standardUserDefaults] objectForKey:@"lastScan"];
|
|
||||||
if (!rawLatestResult) rawLatestResult = NSLocalizedString(@"Latest result will appear here once you have scanned a barcode at least once",@"Latest result will appear here once you have scanned a barcode at least once");
|
|
||||||
[self setResultViewWithText:rawLatestResult];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,28 +74,6 @@
|
||||||
[messageController release];
|
[messageController release];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)info:(id)sender {
|
|
||||||
MessageViewController *aboutController =
|
|
||||||
[[MessageViewController alloc] initWithMessageFilename:@"About"];
|
|
||||||
aboutController.delegate = self;
|
|
||||||
//TODO: change this
|
|
||||||
[self.navigationController pushViewController:aboutController animated:YES];
|
|
||||||
[aboutController release];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)showArchive:(id)sender {
|
|
||||||
ArchiveController *archiveController = [[ArchiveController alloc] init];
|
|
||||||
archiveController.delegate = self;
|
|
||||||
//TODO: change this
|
|
||||||
[self.navigationController pushViewController:archiveController animated:YES];
|
|
||||||
[archiveController release];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)lastResultAction:(id)sender {
|
|
||||||
[self performResultAction];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)performAction:(ResultAction *)action {
|
- (void)performAction:(ResultAction *)action {
|
||||||
[action performActionWithController:self shouldConfirm:NO];
|
[action performActionWithController:self shouldConfirm:NO];
|
||||||
}
|
}
|
||||||
|
@ -124,52 +96,24 @@
|
||||||
|
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[resultView release];
|
|
||||||
[lastActionButton release];
|
|
||||||
actions = nil;
|
actions = nil;
|
||||||
result = nil;
|
result = nil;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setResultViewWithText:(NSString*)theResult {
|
|
||||||
ParsedResult *parsedResult = [[UniversalResultParser parsedResultForString:theResult] retain];
|
|
||||||
NSString *displayString = [parsedResult stringForDisplay];
|
|
||||||
self.resultView.text = displayString;
|
|
||||||
self.result = [parsedResult retain];
|
|
||||||
self.actions = [[parsedResult actions] retain];
|
|
||||||
NSString *buttonTitle;
|
|
||||||
if ([self.actions count] == 1) {
|
|
||||||
ResultAction *theAction = [self.actions objectAtIndex:0];
|
|
||||||
buttonTitle = [theAction title];
|
|
||||||
lastActionButton.userInteractionEnabled = YES;
|
|
||||||
} else if ([self.actions count] == 0) {
|
|
||||||
lastActionButton.userInteractionEnabled = NO;
|
|
||||||
buttonTitle = NSLocalizedString(@"No Actions",@"No Actions");
|
|
||||||
} else {
|
|
||||||
|
|
||||||
lastActionButton.userInteractionEnabled = YES;
|
|
||||||
buttonTitle = NSLocalizedString(@"Actions ...",@"Actions ...");
|
|
||||||
}
|
|
||||||
[lastActionButton setTitle:buttonTitle forState: UIControlStateNormal];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark ZXingDelegateMethods
|
#pragma mark ZXingDelegateMethods
|
||||||
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
|
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
|
||||||
[self dismissModalViewControllerAnimated:YES];
|
[self dismissModalViewControllerAnimated:YES];
|
||||||
//ParsedResult *theResult = [UniversalResultParser parsedResultForString:resultString];
|
|
||||||
//self.result = [theResult retain];
|
|
||||||
//self.actions = [self.result.actions retain];
|
|
||||||
[self setResultViewWithText:resultString];
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NSLog(@"result has %d actions", actions ? 0 : actions.count);
|
NSLog(@"result has %d actions", actions ? 0 : actions.count);
|
||||||
#endif
|
#endif
|
||||||
Scan * scan = [[Database sharedDatabase] addScanWithText:resultString];
|
Scan * scan = [[Database sharedDatabase] addScanWithText:resultString];
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:resultString forKey:@"lastScan"];
|
[[NSUserDefaults standardUserDefaults] setObject:resultString forKey:@"lastScan"];
|
||||||
|
|
||||||
|
|
||||||
//TODO: toggle view into result view that needs to be done.
|
|
||||||
ParsedResult *parsedResult = [[UniversalResultParser parsedResultForString:resultString] retain];
|
ParsedResult *parsedResult = [[UniversalResultParser parsedResultForString:resultString] retain];
|
||||||
|
self.result = [parsedResult retain];
|
||||||
|
self.actions = [self.result.actions retain];
|
||||||
ScanViewController *scanViewController = [[ScanViewController alloc] initWithResult:parsedResult forScan:scan];
|
ScanViewController *scanViewController = [[ScanViewController alloc] initWithResult:parsedResult forScan:scan];
|
||||||
[self.navigationController pushViewController:scanViewController animated:NO];
|
[self.navigationController pushViewController:scanViewController animated:NO];
|
||||||
[scanViewController release];
|
[scanViewController release];
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 47 KiB |
Binary file not shown.
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 119 KiB |
|
@ -160,7 +160,7 @@ public:
|
||||||
- (BOOL)decode {
|
- (BOOL)decode {
|
||||||
NSAutoreleasePool* mainpool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool* mainpool = [[NSAutoreleasePool alloc] init];
|
||||||
TwoDDecoderResult *decoderResult = nil;
|
TwoDDecoderResult *decoderResult = nil;
|
||||||
|
BOOL returnCode = NO;
|
||||||
{
|
{
|
||||||
//NSSet *formatReaders = [FormatReader formatReaders];
|
//NSSet *formatReaders = [FormatReader formatReaders];
|
||||||
NSSet *formatReaders = self.readers;
|
NSSet *formatReaders = self.readers;
|
||||||
|
@ -205,10 +205,13 @@ public:
|
||||||
[points addObject:[NSValue valueWithCGPoint:p]];
|
[points addObject:[NSValue valueWithCGPoint:p]];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *resultString = [NSString stringWithCString:cString
|
//NSString *resultString = [NSString stringWithCString:cString
|
||||||
encoding:NSUTF8StringEncoding];
|
// encoding:NSUTF8StringEncoding];
|
||||||
|
NSString *resultString = [[NSString alloc] initWithCString:cString encoding:NSUTF8StringEncoding];
|
||||||
decoderResult = [[TwoDDecoderResult resultWithText:resultString points:points] retain];
|
//decoderResult = [[TwoDDecoderResult resultWithText:resultString points:points] retain];
|
||||||
|
if (decoderResult) [decoderResult release];
|
||||||
|
decoderResult = [[TwoDDecoderResult alloc] initWithText:resultString points:points];
|
||||||
|
[resultString release];
|
||||||
[points release];
|
[points release];
|
||||||
} catch (ReaderException &rex) {
|
} catch (ReaderException &rex) {
|
||||||
NSLog(@"failed to decode, caught ReaderException '%s'",
|
NSLog(@"failed to decode, caught ReaderException '%s'",
|
||||||
|
@ -245,8 +248,10 @@ public:
|
||||||
|
|
||||||
if (decoderResult) {
|
if (decoderResult) {
|
||||||
[self performSelectorOnMainThread:@selector(didDecodeImage:)
|
[self performSelectorOnMainThread:@selector(didDecodeImage:)
|
||||||
withObject:decoderResult
|
withObject:[decoderResult copy]
|
||||||
waitUntilDone:NO];
|
waitUntilDone:NO];
|
||||||
|
[decoderResult release];
|
||||||
|
returnCode = YES;
|
||||||
} else {
|
} else {
|
||||||
[self performSelectorOnMainThread:@selector(failedToDecodeImage:)
|
[self performSelectorOnMainThread:@selector(failedToDecodeImage:)
|
||||||
withObject:NSLocalizedString(@"Decoder BarcodeDetectionFailure", @"No barcode detected.")
|
withObject:NSLocalizedString(@"Decoder BarcodeDetectionFailure", @"No barcode detected.")
|
||||||
|
@ -260,7 +265,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
[mainpool release];
|
[mainpool release];
|
||||||
|
|
||||||
return decoderResult == nil ? NO : YES;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) decodeImage:(UIImage *)i {
|
- (BOOL) decodeImage:(UIImage *)i {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
UIImageView *imageView;
|
UIImageView *imageView;
|
||||||
NSMutableArray *_points;
|
NSMutableArray *_points;
|
||||||
UIButton *cancelButton;
|
UIButton *cancelButton;
|
||||||
|
UILabel *instructionsLabel;
|
||||||
id<CancelDelegate> delegate;
|
id<CancelDelegate> delegate;
|
||||||
BOOL oneDMode;
|
BOOL oneDMode;
|
||||||
CGRect cropRect;
|
CGRect cropRect;
|
||||||
|
|
|
@ -20,6 +20,7 @@ static const CGFloat kPadding = 10;
|
||||||
|
|
||||||
@interface OverlayView()
|
@interface OverlayView()
|
||||||
@property (nonatomic,assign) UIButton *cancelButton;
|
@property (nonatomic,assign) UIButton *cancelButton;
|
||||||
|
@property (nonatomic,retain) UILabel *instructionsLabel;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ static const CGFloat kPadding = 10;
|
||||||
@synthesize points = _points;
|
@synthesize points = _points;
|
||||||
@synthesize cancelButton;
|
@synthesize cancelButton;
|
||||||
@synthesize cropRect;
|
@synthesize cropRect;
|
||||||
|
@synthesize instructionsLabel;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
- (id) initWithFrame:(CGRect)theFrame cancelEnabled:(BOOL)isCancelEnabled oneDMode:(BOOL)isOneDModeEnabled {
|
- (id) initWithFrame:(CGRect)theFrame cancelEnabled:(BOOL)isCancelEnabled oneDMode:(BOOL)isOneDModeEnabled {
|
||||||
|
@ -61,6 +63,7 @@ static const CGFloat kPadding = 10;
|
||||||
[self addSubview:cancelButton];
|
[self addSubview:cancelButton];
|
||||||
[self addSubview:imageView];
|
[self addSubview:imageView];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +79,7 @@ static const CGFloat kPadding = 10;
|
||||||
- (void) dealloc {
|
- (void) dealloc {
|
||||||
[imageView release];
|
[imageView release];
|
||||||
[_points release];
|
[_points release];
|
||||||
|
[instructionsLabel release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface TwoDDecoderResult : NSObject {
|
@interface TwoDDecoderResult : NSObject<NSCopying> {
|
||||||
NSString *text;
|
NSString *text;
|
||||||
NSArray *points;
|
NSArray *points;
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,7 @@
|
||||||
|
|
||||||
+ (id)resultWithText:(NSString *)text points:(NSArray *)points;
|
+ (id)resultWithText:(NSString *)text points:(NSArray *)points;
|
||||||
- (id)initWithText:(NSString *)text points:(NSArray *)points;
|
- (id)initWithText:(NSString *)text points:(NSArray *)points;
|
||||||
|
- (id)copyWithZone:(NSZone *)zone;
|
||||||
|
- (id)copy;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -39,6 +39,15 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id)copyWithZone:(NSZone *)zone {
|
||||||
|
TwoDDecoderResult *theCopy = [[TwoDDecoderResult allocWithZone:zone] initWithText:[text copyWithZone:zone] points:[points copyWithZone:zone]];
|
||||||
|
return theCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)copy {
|
||||||
|
return [self copyWithZone:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[text release];
|
[text release];
|
||||||
[points release];
|
[points release];
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#import "ResultParser.h"
|
#import "ResultParser.h"
|
||||||
#import "ParsedResult.h"
|
#import "ParsedResult.h"
|
||||||
#import "ResultAction.h"
|
#import "ResultAction.h"
|
||||||
|
#import "TwoDDecoderResult.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
@ -239,11 +240,13 @@
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)presentResultPoints:(NSMutableArray *)resultPoints
|
- (void)presentResultPoints:(NSArray *)resultPoints
|
||||||
forImage:(UIImage *)image
|
forImage:(UIImage *)image
|
||||||
usingSubset:(UIImage *)subset {
|
usingSubset:(UIImage *)subset {
|
||||||
// simply add the points to the image view
|
// simply add the points to the image view
|
||||||
[overlayView setPoints:resultPoints];
|
NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithArray:resultPoints];
|
||||||
|
[overlayView setPoints:mutableArray];
|
||||||
|
[mutableArray release];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)twoDResult {
|
- (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)twoDResult {
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
NSString *address;
|
NSString *address;
|
||||||
NSString *organization;
|
NSString *organization;
|
||||||
|
NSString *jobTitle;
|
||||||
|
|
||||||
UIViewController *viewController;
|
UIViewController *viewController;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
@property (nonatomic, copy) NSString *urlString;
|
@property (nonatomic, copy) NSString *urlString;
|
||||||
@property (nonatomic, copy) NSString *address;
|
@property (nonatomic, copy) NSString *address;
|
||||||
@property (nonatomic, copy) NSString *organization;
|
@property (nonatomic, copy) NSString *organization;
|
||||||
|
@property (nonatomic, copy) NSString *jobTitle;
|
||||||
|
|
||||||
+ (id)actionWithName:(NSString *)n
|
+ (id)actionWithName:(NSString *)n
|
||||||
phoneNumbers:(NSArray *)nums
|
phoneNumbers:(NSArray *)nums
|
||||||
|
@ -49,6 +51,7 @@
|
||||||
url:(NSString *)us
|
url:(NSString *)us
|
||||||
address:(NSString *)ad
|
address:(NSString *)ad
|
||||||
note:(NSString *)nt
|
note:(NSString *)nt
|
||||||
organization:(NSString *)org;
|
organization:(NSString *)org
|
||||||
|
jobTitle:(NSString *)title;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
@synthesize urlString;
|
@synthesize urlString;
|
||||||
@synthesize address;
|
@synthesize address;
|
||||||
@synthesize organization;
|
@synthesize organization;
|
||||||
|
@synthesize jobTitle;
|
||||||
|
|
||||||
+ (id)actionWithName:(NSString *)n
|
+ (id)actionWithName:(NSString *)n
|
||||||
phoneNumbers:(NSArray *)nums
|
phoneNumbers:(NSArray *)nums
|
||||||
|
@ -39,7 +40,8 @@
|
||||||
url:(NSString *)us
|
url:(NSString *)us
|
||||||
address:(NSString *)ad
|
address:(NSString *)ad
|
||||||
note:(NSString *)nt
|
note:(NSString *)nt
|
||||||
organization:(NSString *)org {
|
organization:(NSString *)org
|
||||||
|
jobTitle:(NSString *)title {
|
||||||
AddContactAction *aca = [[[self alloc] init] autorelease];
|
AddContactAction *aca = [[[self alloc] init] autorelease];
|
||||||
aca.name = n;
|
aca.name = n;
|
||||||
aca.phoneNumbers = nums;
|
aca.phoneNumbers = nums;
|
||||||
|
@ -48,6 +50,7 @@
|
||||||
aca.address = ad;
|
aca.address = ad;
|
||||||
aca.note = nt;
|
aca.note = nt;
|
||||||
aca.organization = org;
|
aca.organization = org;
|
||||||
|
aca.jobTitle = title;
|
||||||
return aca;
|
return aca;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +99,10 @@
|
||||||
ABRecordSetValue(person, kABPersonOrganizationProperty, (CFStringRef)self.organization, error);
|
ABRecordSetValue(person, kABPersonOrganizationProperty, (CFStringRef)self.organization, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.jobTitle) {
|
||||||
|
ABRecordSetValue(person, kABPersonJobTitleProperty, (CFStringRef)self.jobTitle, error);
|
||||||
|
}
|
||||||
|
|
||||||
if (self.phoneNumbers && self.phoneNumbers.count > 0) {
|
if (self.phoneNumbers && self.phoneNumbers.count > 0) {
|
||||||
// multi-values: nultiple phone numbers
|
// multi-values: nultiple phone numbers
|
||||||
ABMutableMultiValueRef phoneNumberMultiValue =
|
ABMutableMultiValueRef phoneNumberMultiValue =
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
NSString *address;
|
NSString *address;
|
||||||
NSString *organization;
|
NSString *organization;
|
||||||
|
NSString *jobTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, copy) NSString *name;
|
@property (nonatomic, copy) NSString *name;
|
||||||
|
@ -39,5 +40,6 @@
|
||||||
@property (nonatomic, copy) NSString *urlString;
|
@property (nonatomic, copy) NSString *urlString;
|
||||||
@property (nonatomic, copy) NSString *address;
|
@property (nonatomic, copy) NSString *address;
|
||||||
@property (nonatomic, copy) NSString *organization;
|
@property (nonatomic, copy) NSString *organization;
|
||||||
|
@property (nonatomic, copy) NSString *jobTitle;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
@synthesize urlString;
|
@synthesize urlString;
|
||||||
@synthesize address;
|
@synthesize address;
|
||||||
@synthesize organization;
|
@synthesize organization;
|
||||||
|
@synthesize jobTitle;
|
||||||
|
|
||||||
- (NSString *)stringForDisplay {
|
- (NSString *)stringForDisplay {
|
||||||
NSMutableString *result = [NSMutableString stringWithString:self.name];
|
NSMutableString *result = [NSMutableString stringWithString:self.name];
|
||||||
|
@ -63,7 +64,8 @@
|
||||||
url:self.urlString
|
url:self.urlString
|
||||||
address:self.address
|
address:self.address
|
||||||
note:self.note
|
note:self.note
|
||||||
organization:self.organization]];
|
organization:self.organization
|
||||||
|
jobTitle:self.jobTitle]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc {
|
- (void) dealloc {
|
||||||
|
@ -74,6 +76,7 @@
|
||||||
[address release];
|
[address release];
|
||||||
[note release];
|
[note release];
|
||||||
[organization release];
|
[organization release];
|
||||||
|
[jobTitle release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
int max = [self length];
|
int max = [self length];
|
||||||
NSRange searchRange;
|
NSRange searchRange;
|
||||||
NSRange foundRange;
|
NSRange foundRange;
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
while (i < max) {
|
while (i < max) {
|
||||||
searchRange = NSMakeRange(i, max - i);
|
searchRange = NSMakeRange(i, max - i);
|
||||||
foundRange = [self rangeOfString:prefix options:0 range:searchRange];
|
foundRange = [self rangeOfString:prefix options:0 range:searchRange];
|
||||||
|
@ -78,18 +79,20 @@
|
||||||
} else {
|
} else {
|
||||||
NSString *substring = [self substringWithRange:NSMakeRange(start, termRange.location - start)];
|
NSString *substring = [self substringWithRange:NSMakeRange(start, termRange.location - start)];
|
||||||
NSString *unescaped = [substring backslashUnescaped];
|
NSString *unescaped = [substring backslashUnescaped];
|
||||||
|
NSString *toBeInArray = [[NSString alloc] initWithString:unescaped];
|
||||||
if (result == nil) {
|
if (result == nil) {
|
||||||
result = [NSMutableArray arrayWithObject:unescaped];
|
result = [[NSMutableArray alloc] initWithCapacity:1];
|
||||||
} else {
|
|
||||||
[result addObject:unescaped];
|
|
||||||
}
|
}
|
||||||
|
[result addObject:toBeInArray];
|
||||||
|
[toBeInArray release];
|
||||||
i = termRange.location + termRange.length;
|
i = termRange.location + termRange.length;
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[pool release];
|
||||||
|
|
||||||
return result;
|
return [result autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)fieldWithPrefix:(NSString *)prefix {
|
- (NSString *)fieldWithPrefix:(NSString *)prefix {
|
||||||
|
|
|
@ -46,7 +46,11 @@
|
||||||
result.note = [s fieldWithPrefix:@"NOTE:"];
|
result.note = [s fieldWithPrefix:@"NOTE:"];
|
||||||
result.urlString = [s fieldWithPrefix:@"URL:"];
|
result.urlString = [s fieldWithPrefix:@"URL:"];
|
||||||
result.address = [s fieldWithPrefix:@"ADR:"];
|
result.address = [s fieldWithPrefix:@"ADR:"];
|
||||||
|
|
||||||
|
//The following tags are not stricty parot of MECARD spec, but as their are standard in
|
||||||
|
//vcard, we honor them
|
||||||
result.organization = [s fieldWithPrefix:@"ORG:"];
|
result.organization = [s fieldWithPrefix:@"ORG:"];
|
||||||
|
result.jobTitle = [s fieldWithPrefix:@"TITLE:"];
|
||||||
|
|
||||||
return [result autorelease];
|
return [result autorelease];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1169,6 +1169,7 @@
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = ZXingWidget_Prefix.pch;
|
GCC_PREFIX_HEADER = ZXingWidget_Prefix.pch;
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
||||||
INSTALL_PATH = /usr/local/lib;
|
INSTALL_PATH = /usr/local/lib;
|
||||||
LD_GENERATE_MAP_FILE = YES;
|
LD_GENERATE_MAP_FILE = YES;
|
||||||
|
@ -1193,6 +1194,7 @@
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = ZXingWidget_Prefix.pch;
|
GCC_PREFIX_HEADER = ZXingWidget_Prefix.pch;
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
||||||
INSTALL_PATH = /usr/local/lib;
|
INSTALL_PATH = /usr/local/lib;
|
||||||
PRODUCT_NAME = ZXingWidget;
|
PRODUCT_NAME = ZXingWidget;
|
||||||
|
@ -1205,7 +1207,7 @@
|
||||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
GCC_C_LANGUAGE_STANDARD = c99;
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
GCC_VERSION = 4.2;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
||||||
|
|
|
@ -1517,7 +1517,7 @@
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = ZXing_Prefix.pch;
|
GCC_PREFIX_HEADER = ZXing_Prefix.pch;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
||||||
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
HEADER_SEARCH_PATHS = ../../../cpp/core/src;
|
||||||
INFOPLIST_FILE = Info.plist;
|
INFOPLIST_FILE = Info.plist;
|
||||||
PRODUCT_NAME = Barcodes;
|
PRODUCT_NAME = Barcodes;
|
||||||
};
|
};
|
||||||
|
@ -2005,7 +2005,7 @@
|
||||||
HEADER_SEARCH_PATHS = ../../../cpp/core/src;
|
HEADER_SEARCH_PATHS = ../../../cpp/core/src;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
PREBINDING = NO;
|
PREBINDING = NO;
|
||||||
SDKROOT = iphoneos4.2;
|
SDKROOT = iphoneos;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue