| Exiv2

Loading...
Searching...
No Matches
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:
[legend]

## Public Member Functions
Creators
| TiffEncoder (ExifData &exifData, IptcData &iptcData, XmpData &xmpData, TiffComponent *pRoot, 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.
| TiffEncoder (const TiffEncoder &)=delete
TiffEncoder & | operator= (const TiffEncoder &)=delete
| ~TiffEncoder () override=default
| Virtual destructor.
Public Member Functions inherited from Exiv2::Internal::TiffVisitor
virtual | ~TiffVisitor ()=default
| Virtual destructor.
void | setGo (GoEvent event, bool go)
| Set the stop/go flag: true for go, false for stop.
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.

## 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.

## Manipulators
void | visitEntry (TiffEntry *object) override
| Encode a TIFF entry.
void | visitDataEntry (TiffDataEntry *object) override
| Encode a TIFF data entry.
void | visitImageEntry (TiffImageEntry *object) override
| Encode a TIFF image entry.
void | visitSizeEntry (TiffSizeEntry *object) override
| Encode a TIFF size entry.
void | visitDirectory (TiffDirectory *object) override
| Encode a TIFF directory.
void | visitDirectoryNext (TiffDirectory *object) override
| Update directory entries.
void | visitSubIfd (TiffSubIfd *object) override
| Encode a TIFF sub-IFD.
void | visitMnEntry (TiffMnEntry *object) override
| Encode a TIFF makernote.
void | visitIfdMakernote (TiffIfdMakernote *object) override
| Encode an IFD makernote.
void | visitIfdMakernoteEnd (TiffIfdMakernote *object) override
| Reset encoder to its original state, undo makernote specific settings.
void | visitBinaryArray (TiffBinaryArray *object) override
| Encode a binary array.
void | visitBinaryArrayEnd (TiffBinaryArray *object) override
| Re-encrypt binary array if necessary.
void | visitBinaryElement (TiffBinaryElement *object) override
| Encode an element of a binary array.
void | encodeTiffComponent (TiffEntryBase *object, const Exifdatum *datum=nullptr)
| 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.
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.
void | add (TiffComponent *pRootDir, TiffComponent *pSourceDir, uint32_t root)
| Add metadata from image to the TIFF composite.
void | setDirty (bool flag=true)
| Set the dirty flag and end of traversing signal.

## 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(), encodeTiffComponent(), Exiv2::Internal::TiffCreator::getPath(), Exiv2::Internal::groupId(), and Exiv2::Internal::TiffFinder::result().

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 = nullptr )

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

  object | Object in the TIFF component tree to encode.
  datum | The corresponding metadatum with the updated value.

Note
  Encoder functions may use metadata other than datum.

References 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().

## ◆ visitBinaryArray()

void Exiv2::Internal::TiffEncoder::visitBinaryArray | ( | TiffBinaryArray * | object | ) |
| override virtual

Encode a binary array.

Implements Exiv2::Internal::TiffVisitor.

References Exiv2::Internal::TiffBinaryArray::cfg(), Exiv2::Internal::TiffBinaryArray::decoded(), and encodeTiffComponent().

## ◆ visitBinaryArrayEnd()

void Exiv2::Internal::TiffEncoder::visitBinaryArrayEnd | ( | TiffBinaryArray * | object | ) |
| override virtual

Re-encrypt binary array if necessary.

Reimplemented from Exiv2::Internal::TiffVisitor.

References Exiv2::DataBuf::c_data(), Exiv2::Internal::TiffBinaryArray::cfg(), Exiv2::Internal::TiffBinaryArray::decoded(), Exiv2::Internal::TiffBinaryArray::initialize(), setDirty(), Exiv2::Internal::TiffComponent::tag(), and Exiv2::Internal::TiffBinaryArray::updOrigDataBuf().

## ◆ visitBinaryElement()

void Exiv2::Internal::TiffEncoder::visitBinaryElement | ( | TiffBinaryElement * | object | ) |
| override virtual

Encode an element of a binary array.

Implements Exiv2::Internal::TiffVisitor.

References Exiv2::Internal::TiffBinaryElement::elByteOrder(), and encodeTiffComponent().

## ◆ visitDataEntry()

void Exiv2::Internal::TiffEncoder::visitDataEntry | ( | TiffDataEntry * | object | ) |
| override virtual

Encode a TIFF data entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## ◆ visitDirectory()

void Exiv2::Internal::TiffEncoder::visitDirectory | ( | TiffDirectory * | object | ) |
| override virtual

Encode a TIFF directory.

Implements Exiv2::Internal::TiffVisitor.

## ◆ visitDirectoryNext()

void Exiv2::Internal::TiffEncoder::visitDirectoryNext | ( | TiffDirectory * | object | ) |
| override virtual

Update directory entries.

Reimplemented from Exiv2::Internal::TiffVisitor.

References byteOrder().

## ◆ visitEntry()

void Exiv2::Internal::TiffEncoder::visitEntry | ( | TiffEntry * | object | ) |
| override virtual

Encode a TIFF entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## ◆ visitIfdMakernote()

void Exiv2::Internal::TiffEncoder::visitIfdMakernote | ( | TiffIfdMakernote * | object | ) |
| override virtual

Encode an IFD makernote.

Implements Exiv2::Internal::TiffVisitor.

References Exiv2::Internal::TiffIfdMakernote::byteOrder(), and setDirty().

## ◆ visitIfdMakernoteEnd()

void Exiv2::Internal::TiffEncoder::visitIfdMakernoteEnd | ( | TiffIfdMakernote * | object | ) |
| override virtual

Reset encoder to its original state, undo makernote specific settings.

Reimplemented from Exiv2::Internal::TiffVisitor.

## ◆ visitImageEntry()

void Exiv2::Internal::TiffEncoder::visitImageEntry | ( | TiffImageEntry * | object | ) |
| override virtual

Encode a TIFF image entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## ◆ visitMnEntry()

void Exiv2::Internal::TiffEncoder::visitMnEntry | ( | TiffMnEntry * | object | ) |
| override virtual

Encode a TIFF makernote.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent(), Exiv2::Internal::TiffComponent::group(), Exiv2::Internal::groupName(), and Exiv2::Internal::TiffComponent::tag().

## ◆ visitSizeEntry()

void Exiv2::Internal::TiffEncoder::visitSizeEntry | ( | TiffSizeEntry * | object | ) |
| override virtual

Encode a TIFF size entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## ◆ visitSubIfd()

void Exiv2::Internal::TiffEncoder::visitSubIfd | ( | TiffSubIfd * | object | ) |
| override virtual

Encode a TIFF sub-IFD.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

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

- tiffvisitor_int.hpp
- tiffvisitor_int.cpp