History log of /frameworks/opt/vcard/tests/src/com/android/vcard/tests/testutils/PropertyNodesVerifier.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1de396f6df89363169d3a2e61a61fa98d12c1ef8 23-Mar-2011 Daisuke Miyakawa <dmiyakawa@google.com> Refactor code

1) introduce VCardProperty and make use of it everywhere

Previously we had had two structures for it:
VCardParserImpl_V21.PropertyData and VCardEntry#Property.
The former was for holding raw data for property, while
the latter was for holding resultant (encoded) values.
Apparently we can share same structure.

To do so, we need to let VCardInterpreter pass the
structure to interpreter side, instead of splitting them
into smaller pieces by using several propertyXXX() calls.
Thus this change introduces onPropertyCreated(VCardProperty)
in lieu of propertyXXX().

Now vCard parser side is responsible for encoding
Quoted-Printable, BASE64, and several charsets.
Users are still able to do them manually by using
VCardEntry#getRawValue().

2) add better handling for data inside VCardEntry

Now VCardEntry has so many fields that it is harder to
iterate those data, while the iteration itself is common
use case for it. At least three functionalities are
now using iteration: toString(), isEmpty(), and
constructInsertOperations().

This change introduces inner iterator functionality.
VCardEntry.EntryElementIterator allows users to implement
their own iteration logic.
VCardEntry#iterateAllData(VCardEntry.EntryElementIterator)
iterates all data inside VCardEntry and pass them into
the inner iterator.

3) make VCardParser abstract class

VCardParser should provide some utility functionality like
VCardParser#getInstance(), while currently users have to
choose one of inherited classes like VCardParser_V21, which
is hindering encapsulation.

Currently no external library implements VCardParser,
so this change isn't so harmful.

Bug: 4167593
Bug: 4066223
Change-Id: Ic6bb453cf733cf1de356789b36dd90521dceff56
/frameworks/opt/vcard/tests/src/com/android/vcard/tests/testutils/PropertyNodesVerifier.java
48dd8e86a81d2ab40eb762975c8211c225002bf0 22-Mar-2011 Daisuke Miyakawa <dmiyakawa@google.com> Tolerate nested vCard.

vCard 2.1 requires to handle nest (or grouping) while our
parser has not supported it well.

One support we have had is ignoring top element when
FLAG_TORELATE_NEST is specified, which isn't appropriate.

e.g.
BEGIN:VCARD
X-VENDER-SPECIFIC-META-INFO:XXXX
...
BEGIN:VCARD
(Actual content)
END:VCARD
END:VCARD

This change lets the vCard lib import nested vCard.

One problem around handling the case above is that, after
having this change, we'll get two vCard elements instead of
one, as the top element isn't ignored on parser level any more,
while we don't want the top-level data. To solve the problem,
this change also makes vCard importer ignore such empty data.

This changes just flattens nested vCard. Caller needs to take
care of grouping/nest case using VCardEntry#getChildren()
if it wants to support grouping feature.

- introduce "children" into VCardEntry, which enables users to
handle nested vCard on their side.
- make vCard parsers accept nest cases.
- make vCard interpreters handle nest cases.
- make VCardEntry ignore empty data during constructing insert
opertions.
- make tests accept nest cases.
- add additional test cases for verifying more details.
- add debug string capability.
- remove codes for performance measurement.

Bug: 4066223
Change-Id: Id8af659c2cc0bb0db59c8de239d9d95e9d440089
/frameworks/opt/vcard/tests/src/com/android/vcard/tests/testutils/PropertyNodesVerifier.java
677ef21613a9d35053ec098444832ce4125a847e 08-Mar-2011 Daisuke Miyakawa <dmiyakawa@google.com> Reorganize codes, especially around vCard composition.

- suppress misc warnings
- stop using VCardException in vCard composer which has been
used only in test context
- add VCardComposer#createOneEntryNew(). I'm planning to replace
this with old VCardComposer#createOneEntry()
I don't understand why we have callback mechanism for this kind of
simple stuff. I could have been better on this.
- add some documentation
- mark initWithRawContacsEntityUri() (introduced recently) as
deprecated. That was not a good idea =(

Bug: 4066223
Change-Id: Ib533a435cac3b4e4fa31527d02b0657fc4bd0377
/frameworks/opt/vcard/tests/src/com/android/vcard/tests/testutils/PropertyNodesVerifier.java