We need this to not run unless we're in a testing context. This is prep
for module support, where the relative path required there only works in
this package but will fail if used in reads in an `init()` function upon
import from subpackages.
This reverts commit 4f2f9044e6.
Reintroduces errors from `UndefinedValue()` when the undefined-type is
unhandled.
- We now just return it rather than panic with it so that we can check
for it directly rather than use `log.Is()`.
- We've updated the checks across the code accordingly.
Per our recent change to deimplement ITEVRs.
- ifd_enumerate_test.go: Fixed some test naming.
- ifd_builder_test.go: Dropped some now-unnecessary implementations of
ITEVRs.
This was an early way of resolving tag values that is now obsolete.
`ValueContext` structs should be used, and these, in many cases, should
be able to be constructed from the current context without passing
additional arguments.
- ifd_builder_test.go: Refactors to several tests due to loss of ITEVR support.
- ifd_builder_encode_test.go: Moved test-IB populate to testing_common.go .
- ifd_builder.go: Fixed test naming (in most cases, omitted type name).
This allows us to add an API for accessing an undefined-value/structure
directly on ValueContext.
- ifd_tag_entry.go: Fixed several methods on `IfdTagEntry` to be by-
reference. It was a latent bug that they weren't.
- value_context.go: Added `newValueContextFromTag` to streamline
the changes above.
The upshot of this is that generating a list of type-correct slices or a
string from a tag's value is now stupidly easy.
- Broke parsing into an independent type (parser.go:Parser).
- Moved primary value-processing logic to `ValueContext` so that it
coexists with the actual data (though as much basic functionality as
possible is implemented independently and reused here). This
eliminates extremely ridiculously obtuse usage procedure.
- Deprecated almost all existing TagType functionality (in order to
distance us from this now-legacy usage pattern). Existing
functionality maintained for now. We'll drop it when we do the next
release major.
- `ValueContext` is now passed by reference.
Added a `Size()` method to it and decommissioned redundant
`TagTypeSize()` and `(TagType).Size()`.
- ifd_enumerate.go: Moved `ValueContext` definition to
value_context.go .
- ifd_builder.go
- `BuilderTag` now embeds `ByteOrder`.
- `BuilderTag` `String()` now prints value.
- type.go
- `TagType` `ValueIsEmbedded()` renamed to `valueIsEmbedded()`.
- Add `readRawEncoded()` method to `TagType`.
- Add `Format()` method to `TagType` to isolate code for processing
output strings for all types.
- This will also print a suffixing ellipsis when `justFirst` is
`true`.
- Important bugfix for embedded values always being presented as
four-bytes rather than being truncated to their reported unit-count
bytes first. We tripped over this when some of our corresponding
math was found to be wrong elsewhere.
- Minor reformatting.
- tags_unknown.go: Unhandled unknown values are now wrapped in a
TagUnknownType_UnknownValue rather than returning an error. This is
now used to print byte-counts and SHA1s for unhandled values.
- tags_unknown.go: UnparseableUnknownTagValuePlaceholder now has message
"!UNKNOWN" rather than "!UNPARSEABLE".
- For well-defined, high-level errors we prefer to not wrap them with
stacktraces if the stacktraces add little value. It just makes it more
labor-intensive to handle those errors effectively (especially
external ones).