Repository navigation
feat!: Pass the encoder target per call - #23
Merged
Merged
Conversation
The address book a vCard is written for is known at encoding time, not when the encoder is built: VCardEncoder::encode() and convert() now take a Target, the vCard version and the dialects that address book reads, instead of a VCardVersion. Target::apple() and Target::android() are ready-made. Dialects now write in the order given. The reverse order only served to share one list between the decoder and the encoder; the decoder reads with every dialect instead, through Dialects::all(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The vCard version and the dialects both depend on the address book the vCard is written for, which is known when encoding, not when building the encoder. The version was already passed per call, the dialects were not.
Changes
Target: the vCard version and the dialectsVCardEncoderwrites for, with ready-madeTarget::apple()(3.0, LegacyMessaging + Apple) andTarget::android()(3.0, LegacyMessaging + Android; Android exports 2.1, which the encoder does not write).Dialects::all(): every dialect, forVCardDecoder. Each dialect reads only its own vendor properties, so reading with all of them is safe when the source is unknown.VCardEncoder::encode()/convert()take aTargetinstead of aVCardVersion, and the constructor no longer takesdialects.Usage
Tests
make qapasses (340 tests). The fixture round trips now decode withDialects::all()and encode with the preset of the address book each fixture comes from.🤖 Generated with Claude Code