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 {
|
abstract class AbstractDoCoMoResultParser extends ResultParser {
|
||||||
|
|
||||||
static String[] matchPrefixedField(String prefix, String rawText) {
|
static String[] matchDoCoMoPrefixedField(String prefix, String rawText) {
|
||||||
return matchPrefixedField(prefix, rawText, ';');
|
return matchPrefixedField(prefix, rawText, ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
static String matchSinglePrefixedField(String prefix, String rawText) {
|
static String matchSingleDoCoMoPrefixedField(String prefix, String rawText) {
|
||||||
return matchSinglePrefixedField(prefix, rawText, ';');
|
return matchSinglePrefixedField(prefix, rawText, ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,16 +35,16 @@ public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultPar
|
||||||
if (rawText == null || !rawText.startsWith("MECARD:")) {
|
if (rawText == null || !rawText.startsWith("MECARD:")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String[] rawName = matchPrefixedField("N:", rawText);
|
String[] rawName = matchDoCoMoPrefixedField("N:", rawText);
|
||||||
if (rawName == null) {
|
if (rawName == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String name = parseName(rawName[0]);
|
String name = parseName(rawName[0]);
|
||||||
String[] phoneNumbers = matchPrefixedField("TEL:", rawText);
|
String[] phoneNumbers = matchDoCoMoPrefixedField("TEL:", rawText);
|
||||||
String email = matchSinglePrefixedField("EMAIL:", rawText);
|
String email = matchSingleDoCoMoPrefixedField("EMAIL:", rawText);
|
||||||
String note = matchSinglePrefixedField("NOTE:", rawText);
|
String note = matchSingleDoCoMoPrefixedField("NOTE:", rawText);
|
||||||
String address = matchSinglePrefixedField("ADR:", rawText);
|
String address = matchSingleDoCoMoPrefixedField("ADR:", rawText);
|
||||||
String birthday = matchSinglePrefixedField("BDAY:", rawText);
|
String birthday = matchSingleDoCoMoPrefixedField("BDAY:", rawText);
|
||||||
if (birthday != null && !isStringOfDigits(birthday, 8)) {
|
if (birthday != null && !isStringOfDigits(birthday, 8)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,16 +38,16 @@ public final class BizcardResultParser extends AbstractDoCoMoResultParser {
|
||||||
if (rawText == null || !rawText.startsWith("BIZCARD:")) {
|
if (rawText == null || !rawText.startsWith("BIZCARD:")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String firstName = matchSinglePrefixedField("N:", rawText);
|
String firstName = matchSingleDoCoMoPrefixedField("N:", rawText);
|
||||||
String lastName = matchSinglePrefixedField("X:", rawText);
|
String lastName = matchSingleDoCoMoPrefixedField("X:", rawText);
|
||||||
String fullName = buildName(firstName, lastName);
|
String fullName = buildName(firstName, lastName);
|
||||||
String title = matchSinglePrefixedField("T:", rawText);
|
String title = matchSingleDoCoMoPrefixedField("T:", rawText);
|
||||||
String org = matchSinglePrefixedField("C:", rawText);
|
String org = matchSingleDoCoMoPrefixedField("C:", rawText);
|
||||||
String address = matchSinglePrefixedField("A:", rawText);
|
String address = matchSingleDoCoMoPrefixedField("A:", rawText);
|
||||||
String phoneNumber1 = matchSinglePrefixedField("B:", rawText);
|
String phoneNumber1 = matchSingleDoCoMoPrefixedField("B:", rawText);
|
||||||
String phoneNumber2 = matchSinglePrefixedField("M:", rawText);
|
String phoneNumber2 = matchSingleDoCoMoPrefixedField("M:", rawText);
|
||||||
String phoneNumber3 = matchSinglePrefixedField("F:", rawText);
|
String phoneNumber3 = matchSingleDoCoMoPrefixedField("F:", rawText);
|
||||||
String email = matchSinglePrefixedField("E:", rawText);
|
String email = matchSingleDoCoMoPrefixedField("E:", rawText);
|
||||||
|
|
||||||
return new AddressBookParsedResult(maybeWrap(fullName),
|
return new AddressBookParsedResult(maybeWrap(fullName),
|
||||||
buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
|
buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
|
||||||
|
|
|
@ -31,8 +31,8 @@ public final class BookmarkDoCoMoResultParser extends AbstractDoCoMoResultParser
|
||||||
if (rawText == null || !rawText.startsWith("MEBKM:")) {
|
if (rawText == null || !rawText.startsWith("MEBKM:")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String title = matchSinglePrefixedField("TITLE:", rawText);
|
String title = matchSingleDoCoMoPrefixedField("TITLE:", rawText);
|
||||||
String[] rawUri = matchPrefixedField("URL:", rawText);
|
String[] rawUri = matchDoCoMoPrefixedField("URL:", rawText);
|
||||||
if (rawUri == null) {
|
if (rawUri == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||||
if (rawText == null || !rawText.startsWith("MATMSG:")) {
|
if (rawText == null || !rawText.startsWith("MATMSG:")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String[] rawTo = matchPrefixedField("TO:", rawText);
|
String[] rawTo = matchDoCoMoPrefixedField("TO:", rawText);
|
||||||
if (rawTo == null) {
|
if (rawTo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||||
if (!isBasicallyValidEmailAddress(to)) {
|
if (!isBasicallyValidEmailAddress(to)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String subject = matchSinglePrefixedField("SUB:", rawText);
|
String subject = matchSingleDoCoMoPrefixedField("SUB:", rawText);
|
||||||
String body = matchSinglePrefixedField("BODY:", rawText);
|
String body = matchSingleDoCoMoPrefixedField("BODY:", rawText);
|
||||||
return new EmailAddressParsedResult(to, subject, body, "mailto:" + to);
|
return new EmailAddressParsedResult(to, subject, body, "mailto:" + to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue