Loading...
Searching...
No Matches
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 (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.
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

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.
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(), Exiv2::ExifData::begin(), encodeTiffComponent(), Exiv2::ExifData::end(), Exiv2::Internal::TiffCreator::getPath(), Exiv2::Internal::groupId(), Exiv2::Internal::TiffFinder::result(), Exiv2::Internal::TiffIfdMakernote::setByteOrder(), and Exiv2::Internal::TiffComponent::tag().

Referenced by Exiv2::Internal::TiffParserWorker::encode(), and encodeIptc().

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

References add().

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

  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::ExifData::begin(), Exiv2::ExifData::end(), Exiv2::ExifData::erase(), 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().

## visitBinaryArray()

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

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

virtual

Re-encrypt binary array if necessary.

Reimplemented from Exiv2::Internal::TiffVisitor.

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

## visitBinaryElement()

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

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

virtual

Encode a TIFF data entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## visitDirectory()

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

virtual

Encode a TIFF directory.

Implements Exiv2::Internal::TiffVisitor.

## visitDirectoryNext()

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

virtual

Update directory entries.

Reimplemented from Exiv2::Internal::TiffVisitor.

References byteOrder().

## visitEntry()

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

virtual

Encode a TIFF entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## visitIfdMakernote()

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

virtual

Encode an IFD makernote.

Implements Exiv2::Internal::TiffVisitor.

References Exiv2::Internal::TiffIfdMakernote::byteOrder(), Exiv2::ExifData::end(), Exiv2::ExifData::erase(), Exiv2::ExifData::findKey(), and setDirty().

## visitIfdMakernoteEnd()

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

virtual

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

Reimplemented from Exiv2::Internal::TiffVisitor.

## visitImageEntry()

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

virtual

Encode a TIFF image entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## visitMnEntry()

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

virtual

Encode a TIFF makernote.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent(), Exiv2::ExifData::end(), Exiv2::ExifData::erase(), Exiv2::ExifData::findKey(), Exiv2::Internal::TiffComponent::group(), Exiv2::Internal::groupName(), and Exiv2::Internal::TiffComponent::tag().

## visitSizeEntry()

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

virtual

Encode a TIFF size entry.

Implements Exiv2::Internal::TiffVisitor.

References encodeTiffComponent().

## visitSubIfd()

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

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