3#ifndef TIFFVISITOR_INT_HPP_
4#define TIFFVISITOR_INT_HPP_
9#include "tifffwd_int.hpp"
51 static const int events_ = 2;
52 std::array<bool, events_> go_{
true,
true};
117 [[nodiscard]]
bool go(
GoEvent event)
const;
177 return tiffComponent_;
314 void getObjData(
const byte*& pData,
size_t& size, uint16_t tag,
IfdId group,
const TiffEntryBase*
object);
324 bool decodedIptc_{
false};
467 [[nodiscard]]
bool dirty()
const;
507 [[nodiscard]]
bool isImageTag(uint16_t tag,
IfdId group)
const;
664 using DirList = std::map<const byte*, IfdId>;
665 using IdxSeq = std::map<IfdId, int>;
666 using PostList = std::vector<TiffComponent*>;
679 bool postProc_{
false};
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition exif.hpp:379
An Exif metadatum, consisting of an ExifKey and a Value and methods to manipulate these.
Definition exif.hpp:41
Composite to model an array of different tags. The tag types as well as other aspects of the array ar...
Definition tiffcomposite_int.hpp:1263
Element of a TiffBinaryArray.
Definition tiffcomposite_int.hpp:1394
Interface class for components of a TIFF directory hierarchy (Composite pattern). Both TIFF directori...
Definition tiffcomposite_int.hpp:152
Copy all image tags from the source tree (the tree that is traversed) to a target tree,...
Definition tiffvisitor_int.hpp:192
~TiffCopier() override=default
Virtual destructor.
void visitMnEntry(TiffMnEntry *object) override
Copy a TIFF makernote if it is an image tag.
Definition tiffvisitor_int.cpp:170
void visitDataEntry(TiffDataEntry *object) override
Copy a TIFF data entry if it is an image tag.
Definition tiffvisitor_int.cpp:150
void visitImageEntry(TiffImageEntry *object) override
Copy a TIFF image entry if it is an image tag.
Definition tiffvisitor_int.cpp:154
void visitDirectory(TiffDirectory *object) override
Copy a TIFF directory if it is an image tag.
Definition tiffvisitor_int.cpp:162
void visitIfdMakernote(TiffIfdMakernote *object) override
Copy an IFD makernote if it is an image tag.
Definition tiffvisitor_int.cpp:174
void visitEntry(TiffEntry *object) override
Copy a TIFF entry if it is an image tag.
Definition tiffvisitor_int.cpp:146
void visitBinaryElement(TiffBinaryElement *object) override
Copy an element of a binary array if it is an image tag.
Definition tiffvisitor_int.cpp:182
void visitSizeEntry(TiffSizeEntry *object) override
Copy a TIFF size entry if it is an image tag.
Definition tiffvisitor_int.cpp:158
void copyObject(const TiffComponent *object)
Check if object is an image tag and if so, copy it to the target tree.
Definition tiffvisitor_int.cpp:133
void visitBinaryArray(TiffBinaryArray *object) override
Copy a binary array if it is an image tag.
Definition tiffvisitor_int.cpp:178
void visitSubIfd(TiffSubIfd *object) override
Copy a TIFF sub-IFD if it is an image tag.
Definition tiffvisitor_int.cpp:166
Interface for a standard TIFF IFD entry consisting of a value which is a set of offsets to a data are...
Definition tiffcomposite_int.hpp:598
A standard TIFF IFD entry consisting of a value which is an offset to a data area and the data area....
Definition tiffcomposite_int.hpp:649
TIFF composite visitor to decode metadata from the TIFF tree and add it to an Image,...
Definition tiffvisitor_int.hpp:251
void visitMnEntry(TiffMnEntry *object) override
Decode a TIFF makernote.
Definition tiffvisitor_int.cpp:229
void visitImageEntry(TiffImageEntry *object) override
Decode a TIFF image entry.
Definition tiffvisitor_int.cpp:213
void visitBinaryArray(TiffBinaryArray *object) override
Decode a binary array.
Definition tiffvisitor_int.cpp:434
void visitDataEntry(TiffDataEntry *object) override
Decode a TIFF data entry.
Definition tiffvisitor_int.cpp:209
void visitSubIfd(TiffSubIfd *object) override
Decode a TIFF sub-IFD.
Definition tiffvisitor_int.cpp:225
void decodeStdTiffEntry(const TiffEntryBase *object)
Decode a standard TIFF entry.
Definition tiffvisitor_int.cpp:427
void decodeIptc(const TiffEntryBase *object)
Decode IPTC data from an IPTCNAA tag or Photoshop ImageResources.
Definition tiffvisitor_int.cpp:289
void decodeCanonAFInfo(const TiffEntryBase *object)
Decode Exif.Canon.AFInfo.
Definition tiffvisitor_int.cpp:345
void visitIfdMakernote(TiffIfdMakernote *object) override
Decode an IFD makernote.
Definition tiffvisitor_int.cpp:234
~TiffDecoder() override=default
Virtual destructor.
void visitSizeEntry(TiffSizeEntry *object) override
Decode a TIFF size entry.
Definition tiffvisitor_int.cpp:217
void decodeTiffEntry(const TiffEntryBase *object)
Entry function, determines how to decode each tag.
Definition tiffvisitor_int.cpp:417
void visitBinaryElement(TiffBinaryElement *object) override
Decode an element of a binary array.
Definition tiffvisitor_int.cpp:440
void visitEntry(TiffEntry *object) override
Decode a TIFF entry.
Definition tiffvisitor_int.cpp:205
void decodeXmp(const TiffEntryBase *object)
Decode XMP packet from an XMLPacket tag.
Definition tiffvisitor_int.cpp:264
void visitDirectory(TiffDirectory *object) override
Decode a TIFF directory.
Definition tiffvisitor_int.cpp:221
This class models a TIFF directory (Ifd). It is a composite component of the TIFF tree.
Definition tiffcomposite_int.hpp:823
TIFF composite visitor to encode metadata from an image to the TIFF tree. The metadata containers and...
Definition tiffvisitor_int.hpp:343
void visitSizeEntry(TiffSizeEntry *object) override
Encode a TIFF size entry.
Definition tiffvisitor_int.cpp:574
void encodeMnEntry(TiffMnEntry *object, const Exifdatum *datum)
Callback encoder function for a Makernote entry.
Definition tiffvisitor_int.cpp:861
void encodeSubIfd(TiffSubIfd *object, const Exifdatum *datum)
Callback encoder function for a sub-IFD entry.
Definition tiffvisitor_int.cpp:871
void visitDirectory(TiffDirectory *object) override
Encode a TIFF directory.
Definition tiffvisitor_int.cpp:578
void visitIfdMakernoteEnd(TiffIfdMakernote *object) override
Reset encoder to its original state, undo makernote specific settings.
Definition tiffvisitor_int.cpp:653
~TiffEncoder() override=default
Virtual destructor.
void visitMnEntry(TiffMnEntry *object) override
Encode a TIFF makernote.
Definition tiffvisitor_int.cpp:612
void encodeTiffEntryBase(TiffEntryBase *object, const Exifdatum *datum)
Special encoder function for the base part of a TIFF entry.
Definition tiffvisitor_int.cpp:875
void encodeTiffComponent(TiffEntryBase *object, const Exifdatum *datum=nullptr)
Top level encoder function. Determines how to encode each TIFF component. This function is called by ...
Definition tiffvisitor_int.cpp:705
void setDirty(bool flag=true)
Set the dirty flag and end of traversing signal.
Definition tiffvisitor_int.cpp:553
void encodeImageEntry(TiffImageEntry *object, const Exifdatum *datum)
Callback encoder function for an image entry.
Definition tiffvisitor_int.cpp:793
void visitDirectoryNext(TiffDirectory *object) override
Update directory entries.
Definition tiffvisitor_int.cpp:582
void visitIfdMakernote(TiffIfdMakernote *object) override
Encode an IFD makernote.
Definition tiffvisitor_int.cpp:625
void encodeTiffEntry(TiffEntry *object, const Exifdatum *datum)
Callback encoder function for a standard TIFF entry.
Definition tiffvisitor_int.cpp:789
void encodeBinaryArray(TiffBinaryArray *object, const Exifdatum *datum)
Callback encoder function for a binary array.
Definition tiffvisitor_int.cpp:753
void encodeOffsetEntry(TiffEntryBase *object, const Exifdatum *datum)
Special encoder function for an offset entry.
Definition tiffvisitor_int.cpp:895
void encodeIptc(TiffEntryBase *object, const Exifdatum *datum)
Special encoder function to encode SubIFD contents to Image group if it contains primary image data.
void visitBinaryArray(TiffBinaryArray *object) override
Encode a binary array.
Definition tiffvisitor_int.cpp:659
void visitImageEntry(TiffImageEntry *object) override
Encode a TIFF image entry.
Definition tiffvisitor_int.cpp:570
void encodeBinaryElement(TiffBinaryElement *object, const Exifdatum *datum)
Callback encoder function for an element of a binary array.
Definition tiffvisitor_int.cpp:757
bool dirty() const
True if any tag was deleted or allocated in the process of visiting a TIFF composite tree.
Definition tiffvisitor_int.cpp:558
void add(TiffComponent *pRootDir, TiffComponent *pSourceDir, uint32_t root)
Add metadata from image to the TIFF composite.
Definition tiffvisitor_int.cpp:915
void encodeDataEntry(TiffDataEntry *object, const Exifdatum *datum)
Callback encoder function for a data entry.
Definition tiffvisitor_int.cpp:761
void encodeSizeEntry(TiffSizeEntry *object, const Exifdatum *datum)
Callback encoder function for a size entry.
Definition tiffvisitor_int.cpp:867
void visitEntry(TiffEntry *object) override
Encode a TIFF entry.
Definition tiffvisitor_int.cpp:562
void visitDataEntry(TiffDataEntry *object) override
Encode a TIFF data entry.
Definition tiffvisitor_int.cpp:566
void visitBinaryArrayEnd(TiffBinaryArray *object) override
Re-encrypt binary array if necessary.
Definition tiffvisitor_int.cpp:665
void visitBinaryElement(TiffBinaryElement *object) override
Encode an element of a binary array.
Definition tiffvisitor_int.cpp:692
void visitSubIfd(TiffSubIfd *object) override
Encode a TIFF sub-IFD.
Definition tiffvisitor_int.cpp:608
ByteOrder byteOrder() const
Return the applicable byte order. May be different for the Makernote and the rest of the TIFF entries...
Definition tiffvisitor_int.hpp:460
WriteMethod writeMethod() const
Return the write method used.
Definition tiffvisitor_int.hpp:469
This abstract base class provides the common functionality of an IFD directory entry and defines an e...
Definition tiffcomposite_int.hpp:380
A standard TIFF IFD entry.
Definition tiffcomposite_int.hpp:568
Search the composite for a component with tag and group. Return a pointer to the component or 0,...
Definition tiffvisitor_int.hpp:128
void visitIfdMakernote(TiffIfdMakernote *object) override
Find tag and group in an IFD makernote.
Definition tiffvisitor_int.cpp:116
void visitEntry(TiffEntry *object) override
Find tag and group in a TIFF entry.
Definition tiffvisitor_int.cpp:88
void visitSizeEntry(TiffSizeEntry *object) override
Find tag and group in a TIFF size entry.
Definition tiffvisitor_int.cpp:100
void visitSubIfd(TiffSubIfd *object) override
Find tag and group in a TIFF sub-IFD.
Definition tiffvisitor_int.cpp:108
void visitBinaryArray(TiffBinaryArray *object) override
Find tag and group in a binary array.
Definition tiffvisitor_int.cpp:120
~TiffFinder() override=default
Virtual destructor.
void visitDataEntry(TiffDataEntry *object) override
Find tag and group in a TIFF data entry.
Definition tiffvisitor_int.cpp:92
constexpr TiffFinder(uint16_t tag, IfdId group)
Constructor, taking tag and group of the component to find.
Definition tiffvisitor_int.hpp:133
void visitDirectory(TiffDirectory *object) override
Find tag and group in a TIFF directory.
Definition tiffvisitor_int.cpp:104
void visitMnEntry(TiffMnEntry *object) override
Find tag and group in a TIFF makernote.
Definition tiffvisitor_int.cpp:112
TiffComponent * result() const
Return the search result. 0 if no TIFF component was found for the tag and group combination.
Definition tiffvisitor_int.hpp:176
void visitImageEntry(TiffImageEntry *object) override
Find tag and group in a TIFF image entry.
Definition tiffvisitor_int.cpp:96
void init(uint16_t tag, IfdId group)
Initialize the Finder for a new search.
Definition tiffvisitor_int.cpp:74
void visitBinaryElement(TiffBinaryElement *object) override
Find tag and group in an element of a binary array.
Definition tiffvisitor_int.cpp:124
void findObject(TiffComponent *object)
Check if object matches tag and group.
Definition tiffvisitor_int.cpp:81
Tiff IFD Makernote. This is a concrete class suitable for all IFD makernotes.
Definition tiffcomposite_int.hpp:1067
A standard TIFF IFD entry consisting of a value which is an array of offsets to image data areas....
Definition tiffcomposite_int.hpp:714
This class is the basis for Makernote support in TIFF. It contains a pointer to a concrete Makernote....
Definition tiffcomposite_int.hpp:1006
TIFF composite visitor to read the TIFF structure from a block of memory and build the composite from...
Definition tiffvisitor_int.hpp:579
void visitEntry(TiffEntry *object) override
Read a TIFF entry from the data buffer.
Definition tiffvisitor_int.cpp:1017
size_t baseOffset() const
Return the base offset. See class TiffRwState for details.
Definition tiffvisitor_int.cpp:1003
void visitIfdMakernoteEnd(TiffIfdMakernote *object) override
Reset reader to its original state, undo makernote specific settings.
Definition tiffvisitor_int.cpp:1222
void readDataEntryBase(TiffDataEntryBase *object)
Read a TiffDataEntryBase from the data buffer.
Definition tiffvisitor_int.cpp:1007
void visitDirectory(TiffDirectory *object) override
Read a TIFF directory from the data buffer.
Definition tiffvisitor_int.cpp:1065
ByteOrder byteOrder() const
Return the byte order.
Definition tiffvisitor_int.cpp:999
void setMnState(const TiffRwState *state=nullptr)
Set the state of the reader to one suitable for the Makernote.
Definition tiffvisitor_int.cpp:987
void visitSubIfd(TiffSubIfd *object) override
Read a TIFF sub-IFD from the data buffer.
Definition tiffvisitor_int.cpp:1139
int nextIdx(IfdId group)
Return the next idx sequence number for group.
Definition tiffvisitor_int.cpp:1051
void visitDataEntry(TiffDataEntry *object) override
Read a TIFF data entry from the data buffer.
Definition tiffvisitor_int.cpp:1021
void readTiffEntry(TiffEntryBase *object)
Read a standard TIFF entry from the data buffer.
Definition tiffvisitor_int.cpp:1227
void visitImageEntry(TiffImageEntry *object) override
Read a TIFF image entry from the data buffer.
Definition tiffvisitor_int.cpp:1025
~TiffReader() override=default
Virtual destructor.
void setOrigState()
Set the state to the original state as set in the constructor.
Definition tiffvisitor_int.cpp:983
void visitSizeEntry(TiffSizeEntry *object) override
Read a TIFF size entry from the data buffer.
Definition tiffvisitor_int.cpp:1029
bool circularReference(const byte *start, IfdId group)
Check IFD directory pointer start for circular reference.
Definition tiffvisitor_int.cpp:1039
void visitBinaryElement(TiffBinaryElement *object) override
Read an element of a binary array from the data buffer.
Definition tiffvisitor_int.cpp:1408
void visitMnEntry(TiffMnEntry *object) override
Read a TIFF makernote entry from the data buffer.
Definition tiffvisitor_int.cpp:1179
void visitIfdMakernote(TiffIfdMakernote *object) override
Read an IFD makernote from the data buffer.
Definition tiffvisitor_int.cpp:1197
void visitBinaryArray(TiffBinaryArray *object) override
Read a binary array from the data buffer.
Definition tiffvisitor_int.cpp:1330
void postProcess()
Read deferred components.
Definition tiffvisitor_int.cpp:1055
Simple state class containing relevant state information for the TIFF reader. This is in a separate c...
Definition tiffvisitor_int.hpp:535
ByteOrder byteOrder() const
Return the applicable byte order. May be different for the Makernote and the rest of the TIFF entries...
Definition tiffvisitor_int.hpp:550
size_t baseOffset() const
Return the base offset.
Definition tiffvisitor_int.hpp:564
constexpr TiffRwState(ByteOrder byteOrder, size_t baseOffset)
Constructor.
Definition tiffvisitor_int.hpp:540
A TIFF IFD entry containing the size of a data area of a related TiffDataEntry. This component is use...
Definition tiffcomposite_int.hpp:778
This class models a TIFF sub-directory (sub-IFD). A sub-IFD is an entry with one or more values that ...
Definition tiffcomposite_int.hpp:932
Abstract base class defining the interface for TIFF composite visitors (Visitor pattern)
Definition tiffvisitor_int.hpp:39
virtual void visitDataEntry(TiffDataEntry *object)=0
Operation to perform for a TIFF data entry.
bool go(GoEvent event) const
Check if stop flag for event is clear, return true if it's clear.
Definition tiffvisitor_int.cpp:58
virtual void visitDirectoryNext(TiffDirectory *object)
Operation to perform for a TIFF directory, after all components and before the next entry is processe...
Definition tiffvisitor_int.cpp:62
virtual void visitBinaryArrayEnd(TiffBinaryArray *object)
Operation to perform for a TIFF binary array, at the end of the processing.
Definition tiffvisitor_int.cpp:71
virtual void visitBinaryElement(TiffBinaryElement *object)=0
Operation to perform for an element of a binary array.
GoEvent
Events for the stop/go flag. See setGo().
Definition tiffvisitor_int.hpp:42
@ geTraverse
Signal to control traversing of the composite tree.
Definition tiffvisitor_int.hpp:44
@ geKnownMakernote
Signal used by TiffReader to signal an unknown makernote.
Definition tiffvisitor_int.hpp:46
virtual void visitBinaryArray(TiffBinaryArray *object)=0
Operation to perform for a binary array.
virtual void visitSubIfd(TiffSubIfd *object)=0
Operation to perform for a TIFF sub-IFD.
virtual void visitDirectory(TiffDirectory *object)=0
Operation to perform for a TIFF directory.
virtual void visitImageEntry(TiffImageEntry *object)=0
Operation to perform for a TIFF image entry.
virtual void visitMnEntry(TiffMnEntry *object)=0
Operation to perform for the makernote component.
virtual void visitIfdMakernote(TiffIfdMakernote *object)=0
Operation to perform for an IFD makernote.
virtual ~TiffVisitor()=default
Virtual destructor.
virtual void visitSizeEntry(TiffSizeEntry *object)=0
Operation to perform for a TIFF size entry.
void setGo(GoEvent event, bool go)
Set the stop/go flag: true for go, false for stop.
Definition tiffvisitor_int.cpp:54
virtual void visitEntry(TiffEntry *object)=0
Operation to perform for a TIFF entry.
virtual void visitIfdMakernoteEnd(TiffIfdMakernote *object)
Operation to perform after processing an IFD makernote.
Definition tiffvisitor_int.cpp:68
virtual void visitDirectoryEnd(TiffDirectory *object)
Operation to perform for a TIFF directory, at the end of the processing.
Definition tiffvisitor_int.cpp:65
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:153
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition xmp_exiv2.hpp:138
Encoding and decoding of Exif data.
EncoderFct(*)(const std::string &make, uint32_t extendedTag, IfdId group) FindEncoderFct
Type for a function pointer for a function to encode a TIFF component.
Definition tifffwd_int.hpp:68
DecoderFct(*)(const std::string &make, uint32_t extendedTag, IfdId group) FindDecoderFct
Type for a function pointer for a function to decode a TIFF component.
Definition tifffwd_int.hpp:64
std::vector< IfdId > PrimaryGroups
Type for a list of primary image groups.
Definition tifffwd_int.hpp:80
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
IfdId
Type to specify the IFD to which a metadata belongs.
Definition tags.hpp:34
ByteOrder
Type to express the byte order (little or big endian)
Definition types.hpp:34
WriteMethod
Type to indicate write method used by TIFF parsers.
Definition types.hpp:41