| Exiv2

Loading...
Searching...
No Matches
List of all members
Exiv2::Internal::TiffBinaryArray Class Reference

Composite to model an array of different tags. The tag types as well as other aspects of the array are configurable. The elements of this component are of type TiffBinaryElement. More...

`#include <tiffcomposite_int.hpp>`

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

## Public Member Functions
Creators
| TiffBinaryArray (uint16_t tag, IfdId group, const ArrayCfg &arrayCfg, const ArrayDef *arrayDef, size_t defSize)
| Constructor.
| TiffBinaryArray (uint16_t tag, IfdId group, const ArraySet *arraySet, size_t setSize, CfgSelFct cfgSelFct)
| Constructor for a complex binary array.
| ~TiffBinaryArray () override=default
| Virtual destructor.
TiffBinaryArray & | operator= (const TiffBinaryArray &)=delete
Manipulators
size_t | addElement (size_t idx, const ArrayDef &def)
| Add an element to the binary array, return the size of the element.
bool | initialize (IfdId group)
| Setup cfg and def for the component, in case of a complex binary array. Else do nothing. Return true if the initialization succeeded, else false.
bool | initialize (TiffComponent *pRoot)
| Setup cfg and def for the component, in case of a complex binary array. Else do nothing. Return true if the initialization succeeded, else false.
void | iniOrigDataBuf ()
| Initialize the original data buffer and its size from the base entry.
bool | updOrigDataBuf (const byte *pData, size_t size)
| Update the original data buffer and its size, return true if successful.
void | setDecoded (bool decoded)
| Set a flag to indicate if the array was decoded.
Accessors
const ArrayCfg * | cfg () const
| Return a pointer to the configuration.
const ArrayDef * | def () const
| Return a pointer to the definition.
size_t | defSize () const
| Return the number of elements in the definition.
bool | decoded () const
| Return the flag which indicates if the array was decoded.
Public Member Functions inherited from Exiv2::Internal::TiffEntryBase
constexpr | TiffEntryBase (uint16_t tag, IfdId group, TiffType tiffType=ttUndefined)
| Default constructor.
| ~TiffEntryBase () override=default
| Virtual destructor.
TiffEntryBase & | operator= (const TiffEntryBase &)=delete
| Assignment operator.
void | encode (TiffEncoder &encoder, const Exifdatum *datum)
| Encode a TIFF component from the metadatum provided and information from the encoder as needed.
void | setOffset (size_t offset)
| Set the offset.
void | setData (byte *pData, size_t size, std::shared_ptr< DataBuf > storage)
| Set pointer and size of the entry's data (not taking ownership of the data).
void | setData (std::shared_ptr< DataBuf > buf)
| Set the entry's data buffer. A shared_ptr is used to manage the DataBuf because TiffEntryBase has a clone method so it is possible (in theory) for the DataBuf to have multiple owners.
void | updateValue (Value::UniquePtr value, ByteOrder byteOrder)
| Update the value. Takes ownership of the pointer passed in.
void | setValue (Value::UniquePtr value)
| Set tag value. Takes ownership of the pointer passed in.
TiffType | tiffType () const
| Return the TIFF type.
size_t | offset () const
| Return the offset to the data area relative to the base for the component (usually the start of the TIFF header).
int | idx () const override
| Return the unique id of the entry in the image.
const byte * | pData () const
| Return a pointer to the binary representation of the value of this component.
const Value * | pValue () const
| Return a const pointer to the converted value of this component.
Public Member Functions inherited from Exiv2::Internal::TiffComponent
constexpr | TiffComponent (uint16_t tag, IfdId group)
| Constructor.
virtual | ~TiffComponent ()=default
| Virtual destructor.
| TiffComponent (const TiffComponent &)=default
TiffComponent & | operator= (const TiffComponent &)=default
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.
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().

## Protected Member Functions
Protected Creators
| TiffBinaryArray (const TiffBinaryArray &rhs)
| Copy constructor (used to implement clone()).
Protected Manipulators
TiffComponent * | doAddPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
| Implements addPath(). Todo: Document it!
TiffComponent * | doAddChild (TiffComponent::UniquePtr tiffComponent) override
| Implements addChild(). Todo: Document it!
void | doAccept (TiffVisitor &visitor) override
| Implements accept().
void | doEncode (TiffEncoder &encoder, const Exifdatum *datum) override
| Implements encode().
size_t | doWrite (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
| Implements write(). Todo: Document it!
Protected Member Functions inherited from Exiv2::Internal::TiffEntryBase
| TiffEntryBase (const TiffEntryBase &rhs)
| Copy constructor (used to implement clone()).
void | setCount (size_t count)
| Set the number of components in this entry.
void | setIdx (int idx)
| Set the unique id of the entry in the image.
size_t | doWrite (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
| Implements write(). Write the value of a standard TIFF entry to the ioWrapper, return the number of bytes written. Only the ioWrapper and byteOrder arguments are used.
size_t | doCount () const override
| Implements count().
size_t | doWriteData (IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
| Implements writeData(). Standard TIFF entries have no data: write nothing and return 0.
size_t | doWriteImage (IoWrapper &ioWrapper, ByteOrder byteOrder) const override
| Implements writeImage(). Standard TIFF entries have no image data: write nothing and return 0.
size_t | doSize () const override
| Implements size(). Return the size of a standard TIFF entry.
size_t | doSizeData () const override
| Implements sizeData(). Return 0.
size_t | doSizeImage () const override
| Implements sizeImage(). Return 0.
std::shared_ptr< DataBuf > | storage () const
| Used (internally) to create another reference to the DataBuf reference by storage_.
Protected Member Functions inherited from Exiv2::Internal::TiffComponent
virtual TiffComponent * | doAddNext (UniquePtr tiffComponent)
| Implements addNext(). The default implementation does nothing.

## Protected Accessors
TiffBinaryArray * | doClone () const override
| Internal virtual copy constructor, implements clone().
size_t | doCount () const override
| Implements count(). Todo: Document it!
size_t | doSize () const override
| Implements size(). Todo: Document it!

## Additional Inherited Members
Public Types inherited from Exiv2::Internal::TiffComponent
using | UniquePtr = std::unique_ptr<TiffComponent>
| TiffComponent auto_ptr type.
using | Components = std::vector<UniquePtr>
| Container type to hold all metadata.
static size_t | writeOffset (byte *buf, size_t offset, TiffType tiffType, ByteOrder byteOrder)
| Helper function to write an offset to a preallocated binary buffer.

## Detailed Description

Composite to model an array of different tags. The tag types as well as other aspects of the array are configurable. The elements of this component are of type TiffBinaryElement.

## Member Function Documentation

## ◆ doAccept()

void Exiv2::Internal::TiffBinaryArray::doAccept | ( | TiffVisitor & | visitor | ) |
| override protected virtual

Implements accept().

Implements Exiv2::Internal::TiffComponent.

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

## ◆ doAddChild()

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

Implements addChild(). Todo: Document it!

Reimplemented from Exiv2::Internal::TiffComponent.

References setDecoded().

## ◆ doAddPath()

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

Implements addPath(). Todo: Document it!

Reimplemented from Exiv2::Internal::TiffComponent.

References Exiv2::Internal::TiffComponent::addChild(), Exiv2::Internal::TiffCreator::create(), Exiv2::Internal::TiffPathItem::extendedTag(), Exiv2::Internal::TiffPathItem::group(), initialize(), Exiv2::Internal::TiffEntryBase::setCount(), and Exiv2::Internal::TiffComponent::tag().

## ◆ doClone()

TiffBinaryArray * Exiv2::Internal::TiffBinaryArray::doClone | ( |  | ) | const
| nodiscard override protected virtual

Internal virtual copy constructor, implements clone().

Implements Exiv2::Internal::TiffComponent.

References TiffBinaryArray().

## ◆ doCount()

size_t Exiv2::Internal::TiffBinaryArray::doCount | ( |  | ) | const
| nodiscard override protected virtual

Implements count(). Todo: Document it!

Implements Exiv2::Internal::TiffComponent.

References cfg(), decoded(), Exiv2::Internal::TiffEntryBase::doCount(), EXV_WARNING, Exiv2::Internal::TiffComponent::group(), Exiv2::Internal::groupName(), Exiv2::Internal::TiffComponent::size(), Exiv2::Internal::TiffComponent::tag(), Exiv2::Internal::TiffEntryBase::tiffType(), Exiv2::Internal::toTypeId(), and Exiv2::TypeInfo::typeSize().

## ◆ doEncode()

void Exiv2::Internal::TiffBinaryArray::doEncode | ( | TiffEncoder & | encoder,
|  | const Exifdatum * | datum )
| override protected virtual

Implements encode().

Implements Exiv2::Internal::TiffEntryBase.

References Exiv2::Internal::TiffEncoder::encodeBinaryArray().

## ◆ doSize()

size_t Exiv2::Internal::TiffBinaryArray::doSize | ( |  | ) | const
| nodiscard override protected virtual

Implements size(). Todo: Document it!

Implements Exiv2::Internal::TiffComponent.

References cfg(), decoded(), def(), defSize(), Exiv2::Internal::TiffEntryBase::doSize(), Exiv2::Internal::TiffEntryBase::idx(), Exiv2::Internal::ArrayDef::idx_, Exiv2::Internal::ArrayDef::size(), and Exiv2::Internal::ArrayCfg::tagStep().

## ◆ doWrite()

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

Implements write(). Todo: Document it!

Implements Exiv2::Internal::TiffComponent.

References Exiv2::Internal::ArrayCfg::byteOrder_, Exiv2::DataBuf::c_data(), cfg(), Exiv2::Internal::ArrayCfg::cryptFct_, decoded(), def(), defSize(), Exiv2::Internal::TiffEntryBase::doWrite(), Exiv2::Internal::TiffEntryBase::idx(), Exiv2::Internal::ArrayDef::idx_, Exiv2::MemIo::mmap(), Exiv2::Internal::TiffEntryBase::offset(), Exiv2::MemIo::seek(), Exiv2::Internal::ArrayDef::size(), Exiv2::Internal::TiffComponent::size(), Exiv2::MemIo::size(), Exiv2::Internal::TiffComponent::tag(), Exiv2::Internal::ArrayCfg::tagStep(), Exiv2::Internal::toTypeId(), Exiv2::TypeInfo::typeSize(), Exiv2::ul2Data(), Exiv2::us2Data(), Exiv2::Internal::IoWrapper::write(), and Exiv2::MemIo::write().

## ◆ initialize() [1/2]

bool Exiv2::Internal::TiffBinaryArray::initialize | ( | IfdId | group | ) |

Setup cfg and def for the component, in case of a complex binary array. Else do nothing. Return true if the initialization succeeded, else false.

This version of initialize() is used during intrusive writing. It determines the correct settings based on the group passed in (which is the group of the first tag that is added to the array). It doesn't require cfgSelFct_.

Parameters

  group | Group to setup the binary array for.

Returns
  true if the initialization succeeded, else false.

References Exiv2::Internal::TiffComponent::group(), and Exiv2::Internal::TiffEntryBase::idx().

Referenced by doAddPath(), Exiv2::Internal::TiffReader::visitBinaryArray(), and Exiv2::Internal::TiffEncoder::visitBinaryArrayEnd().

## ◆ initialize() [2/2]

bool Exiv2::Internal::TiffBinaryArray::initialize | ( | TiffComponent * | pRoot | ) |

Setup cfg and def for the component, in case of a complex binary array. Else do nothing. Return true if the initialization succeeded, else false.

This version of initialize() is used for reading and non-intrusive writing. It calls cfgSelFct_ to determine the correct settings.

Parameters

  pRoot | Pointer to the root component of the TIFF tree.

Returns
  true if the initialization succeeded, else false.

References Exiv2::Internal::TiffEntryBase::doSize(), Exiv2::Internal::TiffEntryBase::idx(), Exiv2::Internal::TiffEntryBase::pData(), and Exiv2::Internal::TiffComponent::tag().

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

- tiffcomposite_int.hpp
- tiffcomposite_int.cpp