Adds E-Expression writing APIs #1087
Draft
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.
Issue #, if available:
Description of changes:
This is an API that's safer than just calling the methods on
MacroAwareIonWriter
directly, and it works with theWriteAsIon
interface (ish). It automatically handles expression groups. It allows you to make "prepared" E-Expressions that you can then write later, and it also supports "direct" e-expressions where the macro invocation and arguments are written directly to an IonWriter.I know there's some junk in this PR, and there are no real tests for it yet. Ignore those parts.
The interesting bits that are worth looking at are
WriteAsIon
,IonManagedWriter_1_1
, and maybeArgumentBuilder
Maybe I over-designed this... I think i could probably build something workable directly into
IonManagedWriter_1_1
, or even into the raw writer, since the (binary) raw writer already needs to be aware of the encoding type in order to correctly write tagless arguments. ...yeah, I definitely over-designed this. If there's anything that you think is worth keeping, let me know.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.