mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Rename some methods so that they're not technically overloading one another -- maybe slightly better style-wise in Java but reduces complication in port to C++
git-svn-id: https://zxing.googlecode.com/svn/trunk@501 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
45ba99787e
commit
3feb56ece3
|
@ -28,11 +28,11 @@ package com.google.zxing.client.result;
|
|||
*/
|
||||
abstract class AbstractDoCoMoResultParser extends ResultParser {
|
||||
|
||||
static String[] matchPrefixedField(String prefix, String rawText) {
|
||||
static String[] matchDoCoMoPrefixedField(String prefix, String rawText) {
|
||||
return matchPrefixedField(prefix, rawText, ';');
|
||||
}
|
||||
|
||||
static String matchSinglePrefixedField(String prefix, String rawText) {
|
||||
static String matchSingleDoCoMoPrefixedField(String prefix, String rawText) {
|
||||
return matchSinglePrefixedField(prefix, rawText, ';');
|
||||
}
|
||||
|
||||
|
|
|
@ -35,16 +35,16 @@ public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultPar
|
|||
if (rawText == null || !rawText.startsWith("MECARD:")) {
|
||||
return null;
|
||||
}
|
||||
String[] rawName = matchPrefixedField("N:", rawText);
|
||||
String[] rawName = matchDoCoMoPrefixedField("N:", rawText);
|
||||
if (rawName == null) {
|
||||
return null;
|
||||
}
|
||||
String name = parseName(rawName[0]);
|
||||
String[] phoneNumbers = matchPrefixedField("TEL:", rawText);
|
||||
String email = matchSinglePrefixedField("EMAIL:", rawText);
|
||||
String note = matchSinglePrefixedField("NOTE:", rawText);
|
||||
String address = matchSinglePrefixedField("ADR:", rawText);
|
||||
String birthday = matchSinglePrefixedField("BDAY:", rawText);
|
||||
String[] phoneNumbers = matchDoCoMoPrefixedField("TEL:", rawText);
|
||||
String email = matchSingleDoCoMoPrefixedField("EMAIL:", rawText);
|
||||
String note = matchSingleDoCoMoPrefixedField("NOTE:", rawText);
|
||||
String address = matchSingleDoCoMoPrefixedField("ADR:", rawText);
|
||||
String birthday = matchSingleDoCoMoPrefixedField("BDAY:", rawText);
|
||||
if (birthday != null && !isStringOfDigits(birthday, 8)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -38,16 +38,16 @@ public final class BizcardResultParser extends AbstractDoCoMoResultParser {
|
|||
if (rawText == null || !rawText.startsWith("BIZCARD:")) {
|
||||
return null;
|
||||
}
|
||||
String firstName = matchSinglePrefixedField("N:", rawText);
|
||||
String lastName = matchSinglePrefixedField("X:", rawText);
|
||||
String firstName = matchSingleDoCoMoPrefixedField("N:", rawText);
|
||||
String lastName = matchSingleDoCoMoPrefixedField("X:", rawText);
|
||||
String fullName = buildName(firstName, lastName);
|
||||
String title = matchSinglePrefixedField("T:", rawText);
|
||||
String org = matchSinglePrefixedField("C:", rawText);
|
||||
String address = matchSinglePrefixedField("A:", rawText);
|
||||
String phoneNumber1 = matchSinglePrefixedField("B:", rawText);
|
||||
String phoneNumber2 = matchSinglePrefixedField("M:", rawText);
|
||||
String phoneNumber3 = matchSinglePrefixedField("F:", rawText);
|
||||
String email = matchSinglePrefixedField("E:", rawText);
|
||||
String title = matchSingleDoCoMoPrefixedField("T:", rawText);
|
||||
String org = matchSingleDoCoMoPrefixedField("C:", rawText);
|
||||
String address = matchSingleDoCoMoPrefixedField("A:", rawText);
|
||||
String phoneNumber1 = matchSingleDoCoMoPrefixedField("B:", rawText);
|
||||
String phoneNumber2 = matchSingleDoCoMoPrefixedField("M:", rawText);
|
||||
String phoneNumber3 = matchSingleDoCoMoPrefixedField("F:", rawText);
|
||||
String email = matchSingleDoCoMoPrefixedField("E:", rawText);
|
||||
|
||||
return new AddressBookParsedResult(maybeWrap(fullName),
|
||||
buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
|
||||
|
|
|
@ -31,8 +31,8 @@ public final class BookmarkDoCoMoResultParser extends AbstractDoCoMoResultParser
|
|||
if (rawText == null || !rawText.startsWith("MEBKM:")) {
|
||||
return null;
|
||||
}
|
||||
String title = matchSinglePrefixedField("TITLE:", rawText);
|
||||
String[] rawUri = matchPrefixedField("URL:", rawText);
|
||||
String title = matchSingleDoCoMoPrefixedField("TITLE:", rawText);
|
||||
String[] rawUri = matchDoCoMoPrefixedField("URL:", rawText);
|
||||
if (rawUri == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
|||
if (rawText == null || !rawText.startsWith("MATMSG:")) {
|
||||
return null;
|
||||
}
|
||||
String[] rawTo = matchPrefixedField("TO:", rawText);
|
||||
String[] rawTo = matchDoCoMoPrefixedField("TO:", rawText);
|
||||
if (rawTo == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
|||
if (!isBasicallyValidEmailAddress(to)) {
|
||||
return null;
|
||||
}
|
||||
String subject = matchSinglePrefixedField("SUB:", rawText);
|
||||
String body = matchSinglePrefixedField("BODY:", rawText);
|
||||
String subject = matchSingleDoCoMoPrefixedField("SUB:", rawText);
|
||||
String body = matchSingleDoCoMoPrefixedField("BODY:", rawText);
|
||||
return new EmailAddressParsedResult(to, subject, body, "mailto:" + to);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue