| Exiv2

Loading...
Searching...
No Matches
Public Types | List of all members
Exiv2::Internal::TiffComponent Class Referenceabstract

Interface class for components of a TIFF directory hierarchy (Composite pattern). Both TIFF directories as well as entries implement this interface. A component can be uniquely identified by a tag, group tuple. This class is implemented as a NVI (Non-Virtual Interface) and it has an interface for visitors (Visitor pattern) to perform operations on all components. More...

`#include <tiffcomposite_int.hpp>`

Inheritance diagram for Exiv2::Internal::TiffComponent:
[legend]

## Public Types
using | UniquePtr = std::unique_ptr<TiffComponent>
| TiffComponent auto_ptr type.
using | Components = std::vector<UniquePtr>
| Container type to hold all metadata.

## Public Member Functions
Creators
constexpr | TiffComponent (uint16_t tag, IfdId group)
| Constructor.
virtual | ~TiffComponent ()=default
| Virtual destructor.
| TiffComponent (const TiffComponent &)=default
TiffComponent & | operator= (const TiffComponent &)=default
Manipulators
TiffComponent * | addPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, UniquePtr object=nullptr)
| Add a TIFF entry tag to the component. Components on the path to the entry are added if they don't exist yet.
TiffComponent * | addChild (UniquePtr tiffComponent)
| Add a child to the component. Default is to do nothing.
TiffComponent * | addNext (UniquePtr tiffComponent)
| Add a "next" component to the component. Default is to do nothing.
void | accept (TiffVisitor &visitor)
| Interface to accept visitors (Visitor pattern). Visitors can perform operations on all components of the composite.
void | setStart (const byte *pStart)
| Set a pointer to the start of the binary representation of the component in a memory buffer. The buffer must be allocated and freed outside of this class.
size_t | write (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx)
| Write a TiffComponent to a binary image.
Accessors
uint16_t | tag () const
| Return the tag of this entry.
IfdId | group () const
| Return the group id of this component.
byte * | start () const
| Return a pointer to the start of the binary representation of the component.
UniquePtr | clone () const
| Return an auto-pointer to a copy of itself (deep copy, but without any children). The caller owns this copy and the auto-pointer ensures that it will be deleted.
size_t | writeData (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const
| Write the IFD data of this component to a binary image. Return the number of bytes written. Components derived from TiffEntryBase implement this method if needed.
size_t | writeImage (IoWrapper &ioWrapper, ByteOrder byteOrder) const
| Write the image data of this component to a binary image. Return the number of bytes written. TIFF components implement this method if needed.
size_t | size () const
| Return the size in bytes of the IFD value of this component when written to a binary image.
size_t | count () const
| Return the number of components in this component.
size_t | sizeData () const
| Return the size in bytes of the IFD data of this component when written to a binary image. This is a support function for write(). Components derived from TiffEntryBase implement this method corresponding to their implementation of writeData().
size_t | sizeImage () const
| Return the size in bytes of the image data of this component when written to a binary image. This is a support function for write(). TIFF components implement this method corresponding to their implementation of writeImage().
virtual int | idx () const
| Return the unique id of the entry in the image.

## Protected Member Functions
Protected Manipulators
virtual TiffComponent * | doAddPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object)
| Implements addPath(). The default implementation does nothing.
virtual TiffComponent * | doAddChild (UniquePtr tiffComponent)
| Implements addChild(). The default implementation does nothing.
virtual TiffComponent * | doAddNext (UniquePtr tiffComponent)
| Implements addNext(). The default implementation does nothing.
virtual void | doAccept (TiffVisitor &visitor)=0
| Implements accept().
virtual size_t | doWrite (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx)=0
| Implements write().

## Protected Accessors
virtual TiffComponent * | doClone () const =0
| Internal virtual copy constructor, implements clone().
virtual size_t | doWriteData (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const =0
| Implements writeData().
virtual size_t | doWriteImage (IoWrapper &ioWrapper, ByteOrder byteOrder) const =0
| Implements writeImage().
virtual size_t | doSize () const =0
| Implements size().
virtual size_t | doCount () const =0
| Implements count().
virtual size_t | doSizeData () const =0
| Implements sizeData().
virtual size_t | doSizeImage () const =0
| Implements sizeImage().

## Detailed Description

Interface class for components of a TIFF directory hierarchy (Composite pattern). Both TIFF directories as well as entries implement this interface. A component can be uniquely identified by a tag, group tuple. This class is implemented as a NVI (Non-Virtual Interface) and it has an interface for visitors (Visitor pattern) to perform operations on all components.

## Member Function Documentation

## ◆ accept()

void Exiv2::Internal::TiffComponent::accept | ( | TiffVisitor & | visitor | ) |

Interface to accept visitors (Visitor pattern). Visitors can perform operations on all components of the composite.

Parameters

  visitor | The visitor.

References doAccept(), Exiv2::Internal::TiffVisitor::geTraverse, and Exiv2::Internal::TiffVisitor::go().

Referenced by Exiv2::Internal::TiffEncoder::add(), and Exiv2::Internal::nikonCrypt().

## ◆ addChild()

TiffComponent * Exiv2::Internal::TiffComponent::addChild | ( | TiffComponent::UniquePtr | tiffComponent | ) |

Add a child to the component. Default is to do nothing.

Parameters

  tiffComponent | Auto pointer to the component to add.

Returns
  Return a pointer to the newly added child element or 0.

References doAddChild(), and TiffComponent().

Referenced by Exiv2::Internal::TiffBinaryArray::addElement(), Exiv2::Internal::TiffIfdMakernote::doAddChild(), Exiv2::Internal::TiffMnEntry::doAddChild(), Exiv2::Internal::TiffBinaryArray::doAddPath(), Exiv2::Internal::TiffDirectory::doAddPath(), and Exiv2::Internal::TiffSubIfd::doAddPath().

## ◆ addNext()

TiffComponent * Exiv2::Internal::TiffComponent::addNext | ( | TiffComponent::UniquePtr | tiffComponent | ) |

Add a "next" component to the component. Default is to do nothing.

Parameters

  tiffComponent | Auto pointer to the component to add.

Returns
  Return a pointer to the newly added "next" element or 0.

References doAddNext(), and TiffComponent().

Referenced by Exiv2::Internal::TiffIfdMakernote::doAddNext(), Exiv2::Internal::TiffMnEntry::doAddNext(), and Exiv2::Internal::TiffDirectory::doAddPath().

## ◆ addPath()

TiffComponent * Exiv2::Internal::TiffComponent::addPath | ( | uint16_t | tag,
|  | TiffPath & | tiffPath,
|  | TiffComponent * | pRoot,
|  | TiffComponent::UniquePtr | object = nullptr )

Add a TIFF entry tag to the component. Components on the path to the entry are added if they don't exist yet.

Parameters

  tag | The tag of the new entry
  tiffPath | A path from the TIFF root element to a TIFF entry.
  pRoot | Pointer to the root component of the TIFF composite.
  object | TIFF component to add. If 0, the correct entry will be created.

Returns
  A pointer to the newly added TIFF entry.

References doAddPath(), tag(), and TiffComponent().

Referenced by Exiv2::Internal::TiffEncoder::add(), Exiv2::Internal::TiffDirectory::doAddPath(), and Exiv2::Internal::TiffIfdMakernote::doAddPath().

## ◆ doAccept()

virtual void Exiv2::Internal::TiffComponent::doAccept | ( | TiffVisitor & | visitor | ) |
| protected pure virtual

Implements accept().

Implemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffBinaryElement, Exiv2::Internal::TiffDataEntry, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntry, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, Exiv2::Internal::TiffMnEntry, Exiv2::Internal::TiffSizeEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by accept().

## ◆ doAddChild()

TiffComponent * Exiv2::Internal::TiffComponent::doAddChild | ( | UniquePtr | tiffComponent | ) |
| protected virtual

Implements addChild(). The default implementation does nothing.

Reimplemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffMnEntry, and Exiv2::Internal::TiffSubIfd.

References TiffComponent().

Referenced by addChild().

## ◆ doAddNext()

TiffComponent * Exiv2::Internal::TiffComponent::doAddNext | ( | UniquePtr | tiffComponent | ) |
| protected virtual

Implements addNext(). The default implementation does nothing.

Reimplemented in Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffIfdMakernote, and Exiv2::Internal::TiffMnEntry.

References TiffComponent().

Referenced by addNext().

## ◆ doAddPath()

TiffComponent * Exiv2::Internal::TiffComponent::doAddPath | ( | uint16_t | tag,
|  | TiffPath & | tiffPath,
|  | TiffComponent * | pRoot,
|  | TiffComponent::UniquePtr | object )
| protected virtual

Implements addPath(). The default implementation does nothing.

Reimplemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffMnEntry, and Exiv2::Internal::TiffSubIfd.

References TiffComponent().

Referenced by addPath().

## ◆ doClone()

virtual TiffComponent * Exiv2::Internal::TiffComponent::doClone | ( |  | ) | const
| nodiscard protected pure virtual

Internal virtual copy constructor, implements clone().

Implemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffBinaryElement, Exiv2::Internal::TiffDataEntry, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntry, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, Exiv2::Internal::TiffMnEntry, Exiv2::Internal::TiffSizeEntry, and Exiv2::Internal::TiffSubIfd.

References TiffComponent().

Referenced by clone().

## ◆ doCount()

virtual size_t Exiv2::Internal::TiffComponent::doCount | ( |  | ) | const
| nodiscard protected pure virtual

Implements count().

Implemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffBinaryElement, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, and Exiv2::Internal::TiffMnEntry.

Referenced by count().

## ◆ doSize()

virtual size_t Exiv2::Internal::TiffComponent::doSize | ( |  | ) | const
| nodiscard protected pure virtual

Implements size().

Implemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffBinaryElement, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, Exiv2::Internal::TiffMnEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by size().

## ◆ doSizeData()

virtual size_t Exiv2::Internal::TiffComponent::doSizeData | ( |  | ) | const
| nodiscard protected pure virtual

Implements sizeData().

Implemented in Exiv2::Internal::TiffDataEntry, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by sizeData().

## ◆ doSizeImage()

virtual size_t Exiv2::Internal::TiffComponent::doSizeImage | ( |  | ) | const
| nodiscard protected pure virtual

Implements sizeImage().

Implemented in Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by sizeImage().

## ◆ doWrite()

virtual size_t Exiv2::Internal::TiffComponent::doWrite | ( | IoWrapper & | ioWrapper,
|  | ByteOrder | byteOrder,
|  | size_t | offset,
|  | size_t | valueIdx,
|  | size_t | dataIdx,
|  | size_t & | imageIdx )
| protected pure virtual

Implements write().

Implemented in Exiv2::Internal::TiffBinaryArray, Exiv2::Internal::TiffBinaryElement, Exiv2::Internal::TiffDataEntry, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, Exiv2::Internal::TiffMnEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by write().

## ◆ doWriteData()

virtual size_t Exiv2::Internal::TiffComponent::doWriteData | ( | IoWrapper & | ioWrapper,
|  | ByteOrder | byteOrder,
|  | size_t | offset,
|  | size_t | dataIdx,
|  | size_t & | imageIdx ) const
| protected pure virtual

Implements writeData().

Implemented in Exiv2::Internal::TiffDataEntry, Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by writeData().

## ◆ doWriteImage()

virtual size_t Exiv2::Internal::TiffComponent::doWriteImage | ( | IoWrapper & | ioWrapper,
|  | ByteOrder | byteOrder ) const
| protected pure virtual

Implements writeImage().

Implemented in Exiv2::Internal::TiffDirectory, Exiv2::Internal::TiffEntryBase, Exiv2::Internal::TiffIfdMakernote, Exiv2::Internal::TiffImageEntry, and Exiv2::Internal::TiffSubIfd.

Referenced by writeImage().

## ◆ idx()

int Exiv2::Internal::TiffComponent::idx | ( |  | ) | const
| nodiscard virtual

Return the unique id of the entry in the image.

Reimplemented in Exiv2::Internal::TiffEntryBase.

Referenced by Exiv2::Internal::TiffDirectory::doWrite().

## ◆ write()

size_t Exiv2::Internal::TiffComponent::write | ( | IoWrapper & | ioWrapper,
|  | ByteOrder | byteOrder,
|  | size_t | offset,
|  | size_t | valueIdx,
|  | size_t | dataIdx,
|  | size_t & | imageIdx )

Write a TiffComponent to a binary image.

Parameters

  ioWrapper | IO wrapper to which the TiffComponent is written.
  byteOrder | Applicable byte order (little or big endian).
  offset | Offset from the start of the image (TIFF header) to the component.
  valueIdx | Index of the component to be written relative to offset.
  dataIdx | Index of the data area of the component relative to offset.
  imageIdx | Index of the image data area relative to offset.

Returns
  Number of bytes written to the IO wrapper including all nested components.

Exceptions

  Error | If the component cannot be written.

References doWrite().

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

- tiffcomposite_int.hpp
- tiffcomposite_int.cpp