Exiv2
Loading...
Searching...
No Matches
Friends | List of all members
Exiv2::Internal::TiffEntryBase Class Referenceabstract

This abstract base class provides the common functionality of an IFD directory entry and defines an extended interface for derived concrete entries, which allows access to the attributes of the entry. More...

#include <tiffcomposite_int.hpp>

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

Public Member Functions

Creators
constexpr TiffEntryBase (uint16_t tag, IfdId group, TiffType tiffType=ttUndefined)
 Default constructor.
 
 ~TiffEntryBase () override=default
 Virtual destructor.
 
NOT implemented
TiffEntryBaseoperator= (const TiffEntryBase &)=delete
 Assignment operator.
 
Manipulators
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.
 
Accessors
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 bytepData () const
 Return a pointer to the binary representation of the value of this component.
 
const ValuepValue () 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
 
TiffComponentoperator= (const TiffComponent &)=default
 
TiffComponentaddPath (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.
 
TiffComponentaddChild (UniquePtr tiffComponent)
 Add a child to the component. Default is to do nothing.
 
TiffComponentaddNext (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.
 
bytestart () 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
 TiffEntryBase (const TiffEntryBase &rhs)
 Copy constructor (used to implement clone()).
 
Protected Manipulators
virtual void doEncode (TiffEncoder &encoder, const Exifdatum *datum)=0
 Implements encode().
 
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.
 
- Protected Member Functions inherited from Exiv2::Internal::TiffComponent
virtual TiffComponentdoAddPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object)
 Implements addPath(). The default implementation does nothing.
 
virtual TiffComponentdoAddChild (UniquePtr tiffComponent)
 Implements addChild(). The default implementation does nothing.
 
virtual TiffComponentdoAddNext (UniquePtr tiffComponent)
 Implements addNext(). The default implementation does nothing.
 
virtual void doAccept (TiffVisitor &visitor)=0
 Implements accept().
 
virtual TiffComponentdoClone () const =0
 Internal virtual copy constructor, implements clone().
 

Friends

class TiffReader
 
class TiffEncoder
 

Protected Accessors

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< DataBufstorage () const
 Used (internally) to create another reference to the DataBuf reference by storage_.
 
static size_t writeOffset (byte *buf, size_t offset, TiffType tiffType, ByteOrder byteOrder)
 Helper function to write an offset to a preallocated binary buffer.
 

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.
 

Detailed Description

This abstract base class provides the common functionality of an IFD directory entry and defines an extended interface for derived concrete entries, which allows access to the attributes of the entry.

Member Function Documentation

◆ doCount()

size_t Exiv2::Internal::TiffEntryBase::doCount ( ) const
overrideprotectedvirtual

◆ doEncode()

virtual void Exiv2::Internal::TiffEntryBase::doEncode ( TiffEncoder encoder,
const Exifdatum datum 
)
protectedpure virtual

◆ doSize()

size_t Exiv2::Internal::TiffEntryBase::doSize ( ) const
overrideprotectedvirtual

◆ doSizeData()

size_t Exiv2::Internal::TiffEntryBase::doSizeData ( ) const
overrideprotectedvirtual

◆ doSizeImage()

size_t Exiv2::Internal::TiffEntryBase::doSizeImage ( ) const
overrideprotectedvirtual

◆ doWrite()

size_t Exiv2::Internal::TiffEntryBase::doWrite ( IoWrapper ioWrapper,
ByteOrder  byteOrder,
size_t  offset,
size_t  valueIdx,
size_t  dataIdx,
size_t &  imageIdx 
)
overrideprotectedvirtual

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.

Implements Exiv2::Internal::TiffComponent.

Reimplemented in Exiv2::Internal::TiffImageEntry, Exiv2::Internal::TiffSubIfd, and Exiv2::Internal::TiffMnEntry.

References Exiv2::DataBuf::c_data(), Exiv2::DataBuf::data(), and Exiv2::Internal::IoWrapper::write().

Referenced by Exiv2::Internal::TiffMnEntry::doWrite(), and Exiv2::Internal::TiffBinaryArray::doWrite().

◆ doWriteData()

size_t Exiv2::Internal::TiffEntryBase::doWriteData ( IoWrapper ioWrapper,
ByteOrder  byteOrder,
size_t  offset,
size_t  dataIdx,
size_t &  imageIdx 
) const
overrideprotectedvirtual

Implements writeData(). Standard TIFF entries have no data: write nothing and return 0.

Implements Exiv2::Internal::TiffComponent.

Reimplemented in Exiv2::Internal::TiffImageEntry, and Exiv2::Internal::TiffSubIfd.

◆ doWriteImage()

size_t Exiv2::Internal::TiffEntryBase::doWriteImage ( IoWrapper ioWrapper,
ByteOrder  byteOrder 
) const
overrideprotectedvirtual

Implements writeImage(). Standard TIFF entries have no image data: write nothing and return 0.

Implements Exiv2::Internal::TiffComponent.

Reimplemented in Exiv2::Internal::TiffImageEntry, and Exiv2::Internal::TiffSubIfd.

◆ encode()

void Exiv2::Internal::TiffEntryBase::encode ( TiffEncoder encoder,
const Exifdatum datum 
)

Encode a TIFF component from the metadatum provided and information from the encoder as needed.

Implemented as double-dispatch calls back to one of the specific encoding functions at the encoder.

References doEncode().

◆ idx()

int Exiv2::Internal::TiffEntryBase::idx ( ) const
overridevirtual

◆ setData()

void Exiv2::Internal::TiffEntryBase::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).

Parameters
storageUsually, pData is a pointer into a copy of the image file, which means that it points to memory which is guaranteed to live longer than this class. However, sometimes pData is pointer into a DataBuf that was allocated by another node in the component tree. If so, we need to make sure that the DataBuf doesn't get freed too early. We use a std::shared_ptr to hold a reference to the DataBuf to ensure that it will be kept alive. The storage parameter is assigned to the storage_ field. In the more common scenario where pData points to a copy of the image, rather than a DataBuf, then you should pass std::shared_ptr<DataBuf>(), which is essentially a nullptr.

References pData(), Exiv2::Internal::TiffComponent::size(), and storage().

Referenced by updateValue().

◆ setValue()

void Exiv2::Internal::TiffEntryBase::setValue ( Value::UniquePtr  value)

Set tag value. Takes ownership of the pointer passed in.

Update type, count and the pointer to the value.

References Exiv2::Internal::toTiffType().

Referenced by updateValue().

◆ updateValue()

void Exiv2::Internal::TiffEntryBase::updateValue ( Value::UniquePtr  value,
ByteOrder  byteOrder 
)

Update the value. Takes ownership of the pointer passed in.

Update binary value data and call setValue().

References setData(), and setValue().


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