mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Add default.pbxuser to ZXingWidget so tests build. Remove no-longer-needed DoCoMoResultParser.m (moved to ArrayAndStringCategories.m).
git-svn-id: https://zxing.googlecode.com/svn/trunk@1871 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
4a6a759e85
commit
20f18f6301
|
@ -1,144 +0,0 @@
|
||||||
//
|
|
||||||
// DoCoMoResultParser.m
|
|
||||||
// ZXing
|
|
||||||
//
|
|
||||||
// Created by Christian Brunschen on 25/06/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 "DoCoMoResultParser.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation NSString (DoCoMoFieldParsing)
|
|
||||||
|
|
||||||
- (NSString *)backslashUnescaped {
|
|
||||||
NSRange backslashRange = [self rangeOfString:@"\\"];
|
|
||||||
if (backslashRange.location == NSNotFound) {
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
int max = [self length];
|
|
||||||
int startLocation = 0;
|
|
||||||
NSMutableString *result = [NSMutableString stringWithCapacity:[self length]];
|
|
||||||
while (backslashRange.location != NSNotFound) {
|
|
||||||
[result appendString:[self substringWithRange:NSMakeRange(startLocation,
|
|
||||||
backslashRange.location - startLocation)]];
|
|
||||||
[result appendFormat:@"%c", [self characterAtIndex:backslashRange.location + 1]];
|
|
||||||
startLocation = backslashRange.location + 2;
|
|
||||||
NSRange searchRange = NSMakeRange(startLocation, max - startLocation);
|
|
||||||
backslashRange = [self rangeOfString:@"\\" options:0 range:searchRange];
|
|
||||||
}
|
|
||||||
if (startLocation < max) {
|
|
||||||
[result appendString:[self substringWithRange:NSMakeRange(startLocation, max - startLocation)]];
|
|
||||||
}
|
|
||||||
return [NSString stringWithString:result];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *)fieldsWithPrefix:(NSString *)prefix {
|
|
||||||
return [self fieldsWithPrefix:prefix terminator:@";"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray *)fieldsWithPrefix:(NSString *)prefix terminator:(NSString *)term {
|
|
||||||
NSMutableArray *result = nil;
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
int max = [self length];
|
|
||||||
NSRange searchRange;
|
|
||||||
NSRange foundRange;
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
while (i < max) {
|
|
||||||
searchRange = NSMakeRange(i, max - i);
|
|
||||||
foundRange = [self rangeOfString:prefix options:0 range:searchRange];
|
|
||||||
if(foundRange.location == NSNotFound) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int start = i = foundRange.location + foundRange.length;
|
|
||||||
bool done = false;
|
|
||||||
while (!done) {
|
|
||||||
searchRange = NSMakeRange(i, max - i);
|
|
||||||
NSRange termRange = [self rangeOfString:term options:0 range:searchRange];
|
|
||||||
if (termRange.location == NSNotFound) {
|
|
||||||
i = max;
|
|
||||||
done = true;
|
|
||||||
} else if ([self characterAtIndex:termRange.location-1] == (unichar)'\\') {
|
|
||||||
i++;
|
|
||||||
} else {
|
|
||||||
NSAutoreleasePool *secondaryPool = [[NSAutoreleasePool alloc] init];
|
|
||||||
NSString *substring = [self substringWithRange:NSMakeRange(start, termRange.location - start)];
|
|
||||||
NSString *unescaped = [substring backslashUnescaped];
|
|
||||||
NSString *toBeInArray = [[NSString alloc] initWithString:unescaped];
|
|
||||||
[secondaryPool release];
|
|
||||||
if (result == nil) {
|
|
||||||
result = [[NSMutableArray alloc] initWithCapacity:1];
|
|
||||||
}
|
|
||||||
[result addObject:toBeInArray];
|
|
||||||
[toBeInArray release];
|
|
||||||
i = termRange.location + termRange.length;
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
return [result autorelease];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)fieldWithPrefix:(NSString *)prefix {
|
|
||||||
return [self fieldWithPrefix:prefix terminator:@";"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)fieldWithPrefix:(NSString *)prefix terminator:(NSString *)term {
|
|
||||||
NSArray *fields = [self fieldsWithPrefix:prefix terminator:term];
|
|
||||||
if (fields.count == 0) {
|
|
||||||
return nil;
|
|
||||||
} else {
|
|
||||||
return [fields lastObject];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)stringWithTrimmedWhitespace {
|
|
||||||
return [self stringByTrimmingCharactersInSet:
|
|
||||||
[NSCharacterSet whitespaceCharacterSet]];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation NSArray (DoCoMoStringArray)
|
|
||||||
|
|
||||||
- (NSArray*)stringArrayWithTrimmedWhitespace {
|
|
||||||
NSMutableArray* trimmed = [NSMutableArray arrayWithCapacity:[self count]];
|
|
||||||
for (NSString* s in self) {
|
|
||||||
[trimmed addObject:[s stringWithTrimmedWhitespace]];
|
|
||||||
}
|
|
||||||
return trimmed;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSArray*)arrayWithStringIfNotNil:(NSString *)string {
|
|
||||||
if (string != nil) {
|
|
||||||
return [NSArray arrayWithObject:string];
|
|
||||||
} else {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@implementation DoCoMoResultParser
|
|
||||||
|
|
||||||
@end
|
|
78
iphone/ZXingWidget/ZXingWidget.xcodeproj/default.pbxuser
Normal file
78
iphone/ZXingWidget/ZXingWidget.xcodeproj/default.pbxuser
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||||
|
activeArchitecturePreference = armv6;
|
||||||
|
activeBuildConfigurationName = Debug;
|
||||||
|
activeExecutable = 1D6039CA13DF7EA1006F4B51 /* otest */;
|
||||||
|
activeSDKPreference = iphonesimulator4.2;
|
||||||
|
activeTarget = 1D60398C13DF7CAD006F4B51 /* ZXingTests */;
|
||||||
|
addToTargets = (
|
||||||
|
D2AAC07D0554694100DB518D /* ZXingWidget */,
|
||||||
|
);
|
||||||
|
breakpoints = (
|
||||||
|
);
|
||||||
|
codeSenseManager = 1DFA08E013CE19C800599044 /* Code sense */;
|
||||||
|
executables = (
|
||||||
|
1D6039CA13DF7EA1006F4B51 /* otest */,
|
||||||
|
);
|
||||||
|
sourceControlManager = 1DFA08DF13CE19C800599044 /* Source Control */;
|
||||||
|
userBuildSettings = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
1D6039CA13DF7EA1006F4B51 /* otest */ = {
|
||||||
|
isa = PBXExecutable;
|
||||||
|
activeArgIndices = (
|
||||||
|
YES,
|
||||||
|
YES,
|
||||||
|
);
|
||||||
|
argumentStrings = (
|
||||||
|
"-SenTest Self",
|
||||||
|
"$(BUILT_PRODUCTS_DIR)/ZXingTests.octest",
|
||||||
|
);
|
||||||
|
autoAttachOnCrash = 1;
|
||||||
|
breakpointsEnabled = 1;
|
||||||
|
configStateDict = {
|
||||||
|
"PBXLSLaunchAction-0" = {
|
||||||
|
PBXLSLaunchAction = 0;
|
||||||
|
PBXLSLaunchStartAction = 1;
|
||||||
|
PBXLSLaunchStdioStyle = 2;
|
||||||
|
PBXLSLaunchStyle = 0;
|
||||||
|
class = PBXLSRunLaunchConfig;
|
||||||
|
commandLineArgs = (
|
||||||
|
);
|
||||||
|
displayName = "Executable Runner";
|
||||||
|
environment = {
|
||||||
|
};
|
||||||
|
identifier = com.apple.Xcode.launch.runConfig;
|
||||||
|
remoteHostInfo = "";
|
||||||
|
startActionInfo = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
customDataFormattersEnabled = 1;
|
||||||
|
dataTipCustomDataFormattersEnabled = 1;
|
||||||
|
dataTipShowTypeColumn = 1;
|
||||||
|
dataTipSortType = 0;
|
||||||
|
debuggerPlugin = GDBDebugging;
|
||||||
|
disassemblyDisplayState = 0;
|
||||||
|
dylibVariantSuffix = "";
|
||||||
|
enableDebugStr = 1;
|
||||||
|
environmentEntries = (
|
||||||
|
);
|
||||||
|
executableSystemSymbolLevel = 0;
|
||||||
|
executableUserSymbolLevel = 0;
|
||||||
|
launchableReference = 1D6039CB13DF7EA1006F4B51 /* otest */;
|
||||||
|
libgmallocEnabled = 0;
|
||||||
|
name = otest;
|
||||||
|
savedGlobals = {
|
||||||
|
};
|
||||||
|
showTypeColumn = 0;
|
||||||
|
sourceDirectories = (
|
||||||
|
);
|
||||||
|
};
|
||||||
|
1D6039CB13DF7EA1006F4B51 /* otest */ = {
|
||||||
|
isa = PBXFileReference;
|
||||||
|
name = otest;
|
||||||
|
path = Developer/usr/bin/otest;
|
||||||
|
sourceTree = SDKROOT;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue