Exiv2
List of all members
Exiv2::Internal::TiffEncoder Class Reference

TIFF composite visitor to encode metadata from an image to the TIFF tree. The metadata containers and root element of the tree are supplied in the constructor. Used by TiffParserWorker to encode the metadata into a TIFF composite. More...

#include <tiffvisitor_int.hpp>

Inheritance diagram for Exiv2::Internal::TiffEncoder:
Inheritance graph
[legend]

Public Member Functions

Creators
 TiffEncoder (const ExifData &exifData, const IptcData &iptcData, const XmpData &xmpData, TiffComponent *pRoot, const bool isNewImage, const PrimaryGroups *pPrimaryGroups, const TiffHeaderBase *pHeader, FindEncoderFct findEncoderFct)
 Constructor, taking the root element of the composite to encode to, the image with the metadata to encode and a function to find special encoders.
 
virtual ~TiffEncoder ()
 Virtual destructor.
 
- Public Member Functions inherited from Exiv2::Internal::TiffVisitor
 TiffVisitor ()
 Default constructor. Initialises all stop/go flags to true.
 
virtual ~TiffVisitor ()
 Virtual destructor.
 
void setGo (GoEvent event, bool go)
 Set the stop/go flag: true for go, false for stop. More...
 
virtual void visitDirectoryEnd (TiffDirectory *object)
 Operation to perform for a TIFF directory, at the end of the processing.
 
bool go (GoEvent event) const
 Check if stop flag for event is clear, return true if it's clear.
 

Manipulators

virtual void visitEntry (TiffEntry *object)
 Encode a TIFF entry.
 
virtual void visitDataEntry (TiffDataEntry *object)
 Encode a TIFF data entry.
 
virtual void visitImageEntry (TiffImageEntry *object)
 Encode a TIFF image entry.
 
virtual void visitSizeEntry (TiffSizeEntry *object)
 Encode a TIFF size entry.
 
virtual void visitDirectory (TiffDirectory *object)
 Encode a TIFF directory.
 
virtual void visitDirectoryNext (TiffDirectory *object)
 Update directory entries.
 
virtual void visitSubIfd (TiffSubIfd *object)
 Encode a TIFF sub-IFD.
 
virtual void visitMnEntry (TiffMnEntry *object)
 Encode a TIFF makernote.
 
virtual void visitIfdMakernote (TiffIfdMakernote *object)
 Encode an IFD makernote.
 
virtual void visitIfdMakernoteEnd (TiffIfdMakernote *object)
 Reset encoder to its original state, undo makernote specific settings.
 
virtual void visitBinaryArray (TiffBinaryArray *object)
 Encode a binary array.
 
virtual void visitBinaryArrayEnd (TiffBinaryArray *object)
 Re-encrypt binary array if necessary.
 
virtual void visitBinaryElement (TiffBinaryElement *object)
 Encode an element of a binary array.
 
void encodeTiffComponent (TiffEntryBase *object, const Exifdatum *datum=0)
 Top level encoder function. Determines how to encode each TIFF component. This function is called by the visit methods of the encoder as well as the add() method. More...
 
void encodeBinaryElement (TiffBinaryElement *object, const Exifdatum *datum)
 Callback encoder function for an element of a binary array.
 
void encodeBinaryArray (TiffBinaryArray *object, const Exifdatum *datum)
 Callback encoder function for a binary array.
 
void encodeDataEntry (TiffDataEntry *object, const Exifdatum *datum)
 Callback encoder function for a data entry.
 
void encodeTiffEntry (TiffEntry *object, const Exifdatum *datum)
 Callback encoder function for a standard TIFF entry.
 
void encodeImageEntry (TiffImageEntry *object, const Exifdatum *datum)
 Callback encoder function for an image entry.
 
void encodeMnEntry (TiffMnEntry *object, const Exifdatum *datum)
 Callback encoder function for a Makernote entry.
 
void encodeSizeEntry (TiffSizeEntry *object, const Exifdatum *datum)
 Callback encoder function for a size entry.
 
void encodeSubIfd (TiffSubIfd *object, const Exifdatum *datum)
 Callback encoder function for a sub-IFD entry.
 
void encodeTiffEntryBase (TiffEntryBase *object, const Exifdatum *datum)
 Special encoder function for the base part of a TIFF entry.
 
void encodeOffsetEntry (TiffEntryBase *object, const Exifdatum *datum)
 Special encoder function for an offset entry.
 
void encodeIptc (TiffEntryBase *object, const Exifdatum *datum)
 Special encoder function to encode SubIFD contents to Image group if it contains primary image data. More...
 
void add (TiffComponent *pRootDir, TiffComponent *pSourceDir, uint32_t root)
 Add metadata from image to the TIFF composite. More...
 
void setDirty (bool flag=true)
 Set the dirty flag and end of traversing signal.
 

Accessors

ByteOrder byteOrder () const
 Return the applicable byte order. May be different for the Makernote and the rest of the TIFF entries.
 
bool dirty () const
 True if any tag was deleted or allocated in the process of visiting a TIFF composite tree.
 
WriteMethod writeMethod () const
 Return the write method used.
 

Additional Inherited Members

- Public Types inherited from Exiv2::Internal::TiffVisitor
enum  GoEvent { geTraverse = 0, geKnownMakernote = 1 }
 Events for the stop/go flag. See setGo(). More...
 

Detailed Description

TIFF composite visitor to encode metadata from an image to the TIFF tree. The metadata containers and root element of the tree are supplied in the constructor. Used by TiffParserWorker to encode the metadata into a TIFF composite.

For non-intrusive writing, the encoder is used as a visitor (by passing it to the accept() member of a TiffComponent). The composite tree is then traversed and metadata from the image is used to encode each existing component.

For intrusive writing, add() is called, which loops through the metadata and creates and populates corresponding TiffComponents as needed.

Member Function Documentation

◆ add()

void Exiv2::Internal::TiffEncoder::add ( TiffComponent pRootDir,
TiffComponent pSourceDir,
uint32_t  root 
)

Add metadata from image to the TIFF composite.

For each Exif metadatum, the corresponding TiffComponent is created if necessary and populated using encodeTiffComponent(). The add() function is used during intrusive writing, to create a new TIFF structure.

Note
For non-intrusive writing, the encoder is used as a visitor (by passing it to the accept() member of a TiffComponent). The composite tree is then traversed and metadata from the image is used to encode each existing component.

References Exiv2::Internal::TiffComponent::accept(), Exiv2::Internal::TiffComponent::addPath(), Exiv2::ExifData::begin(), encodeTiffComponent(), Exiv2::ExifData::end(), Exiv2::Internal::TiffCreator::getPath(), Exiv2::Internal::groupId(), Exiv2::Internal::TiffFinder::result(), Exiv2::Internal::Tag::root, Exiv2::Internal::TiffIfdMakernote::setByteOrder(), and Exiv2::Internal::TiffComponent::tag().

Referenced by Exiv2::Internal::TiffParserWorker::encode().

◆ encodeIptc()

void Exiv2::Internal::TiffEncoder::encodeIptc ( TiffEntryBase object,
const Exifdatum datum 
)

Special encoder function to encode SubIFD contents to Image group if it contains primary image data.

Special encoder function to encode IPTC data to an IPTCNAA or Photoshop ImageResources tag.

Referenced by TiffEncoder().

◆ encodeTiffComponent()

void Exiv2::Internal::TiffEncoder::encodeTiffComponent ( TiffEntryBase object,
const Exifdatum datum = 0 
)

Top level encoder function. Determines how to encode each TIFF component. This function is called by the visit methods of the encoder as well as the add() method.

If no datum is provided, search the metadata based on tag and group of the object. This is the case if the function is called from a visit method.

Then check if a special encoder function is registered for the tag, and if so use it to encode the object. Else use the callback encoder function at the object (which results in a double-dispatch to the appropriate encoding function of the encoder.

Parameters
objectObject in the TIFF component tree to encode.
datumThe corresponding metadatum with the updated value.
Note
Encoder functions may use metadata other than datum.

References Exiv2::ExifData::begin(), Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_CALL_MEMBER_FN, Exiv2::ExifData::findKey(), Exiv2::Internal::TiffComponent::group(), Exiv2::Internal::groupName(), Exiv2::Exifdatum::idx(), Exiv2::ExifKey::idx(), Exiv2::Internal::TiffEntryBase::idx(), Exiv2::ExifKey::key(), setDirty(), and Exiv2::Internal::TiffComponent::tag().

Referenced by add(), visitBinaryArray(), visitBinaryElement(), visitDataEntry(), visitEntry(), visitImageEntry(), visitMnEntry(), visitSizeEntry(), and visitSubIfd().


The documentation for this class was generated from the following files: