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.
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.
- Updated IfdByteEncoder tests to use it instead of hacking-together
their own BT's (makes for more standardized, consistent testing).
- Universally refactored all core IFD knowledge implemented upon a
single IFD name to instead work with IfdIdentity instances, instead,
in order to validate that we only recognize the IFDs only in the
context of the correct parents in the hierarchy.
- Implemented standard testing byte-order (assigned to
TestDefaultByteOrder).
- ifd_builder:
- We now validate that `builderTag` instances are either a byte array
or a child Ifd before allowing to add.
- Renamed `builderTag.valueBytes` to `builderTag.value` (it's not
necessarily bytes).
- `builderTag` now gets the child IFD name if representing a child
IFD.
- Added ability to dump structure to string slice.
- Added NewIfdBuilderFromExistingChain to reconstruct whole chain
from a read IFD chain (collection).
- Wrote IB dumper.
- Added structural tests.
- Moved ifd_tag_entry types to separate file.
- tags_unknown: Unknown-type tags can now satisfy the `UnknownTagValue`
interface to return `[]byte`.
- `IfdTagEntry.ValueBytes` automatically uses this. Else, error if not
`[]byte` or `string`.
- ifd_enumerate
- Now embed `ByteOrder` in `Ifd` (we otherwise require it to be passed
a bit too often).
- Renamed some occurences of "IFD" to "IB" where an actual IB in order
to not be confusing.