Exiv2
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 tupel. 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:
Inheritance graph
[legend]

Public Types

typedef std::auto_ptr< TiffComponentAutoPtr
 TiffComponent auto_ptr type.
 
typedef std::vector< TiffComponent * > Components
 Container type to hold all metadata.
 

Public Member Functions

Creators
 TiffComponent (uint16_t tag, IfdId group)
 Constructor.
 
virtual ~TiffComponent ()
 Virtual destructor.
 
Manipulators
TiffComponentaddPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *const pRoot, AutoPtr object=AutoPtr(0))
 Add a TIFF entry tag to the component. Components on the path to the entry are added if they don't exist yet. More...
 
TiffComponentaddChild (AutoPtr tiffComponent)
 Add a child to the component. Default is to do nothing. More...
 
TiffComponentaddNext (AutoPtr tiffComponent)
 Add a "next" component to the component. Default is to do nothing. More...
 
void accept (TiffVisitor &visitor)
 Interface to accept visitors (Visitor pattern). Visitors can perform operations on all components of the composite. More...
 
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.
 
uint32_t write (IoWrapper &ioWrapper, ByteOrder byteOrder, int32_t offset, uint32_t valueIdx, uint32_t dataIdx, uint32_t &imageIdx)
 Write a TiffComponent to a binary image. More...
 
Accessors
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.
 
AutoPtr 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.
 
uint32_t writeData (IoWrapper &ioWrapper, ByteOrder byteOrder, int32_t offset, uint32_t dataIdx, uint32_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.
 
uint32_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.
 
uint32_t size () const
 Return the size in bytes of the IFD value of this component when written to a binary image.
 
uint32_t count () const
 Return the number of components in this component.
 
uint32_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().
 
uint32_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 TiffComponentdoAddPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *const pRoot, TiffComponent::AutoPtr object)
 Implements addPath(). The default implementation does nothing.
 
virtual TiffComponentdoAddChild (AutoPtr tiffComponent)
 Implements addChild(). The default implementation does nothing.
 
virtual TiffComponentdoAddNext (AutoPtr tiffComponent)
 Implements addNext(). The default implementation does nothing.
 
virtual void doAccept (TiffVisitor &visitor)=0
 Implements accept().
 
virtual uint32_t doWrite (IoWrapper &ioWrapper, ByteOrder byteOrder, int32_t offset, uint32_t valueIdx, uint32_t dataIdx, uint32_t &imageIdx)=0
 Implements write().
 
Protected Accessors
virtual TiffComponentdoClone () const =0
 Internal virtual copy constructor, implements clone().
 
virtual uint32_t doWriteData (IoWrapper &ioWrapper, ByteOrder byteOrder, int32_t offset, uint32_t dataIdx, uint32_t &imageIdx) const =0
 Implements writeData().
 
virtual uint32_t doWriteImage (IoWrapper &ioWrapper, ByteOrder byteOrder) const =0
 Implements writeImage().
 
virtual uint32_t doSize () const =0
 Implements size().
 
virtual uint32_t doCount () const =0
 Implements count().
 
virtual uint32_t doSizeData () const =0
 Implements sizeData().
 
virtual uint32_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 tupel. 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)

◆ addChild()

TiffComponent * Exiv2::Internal::TiffComponent::addChild ( TiffComponent::AutoPtr  tiffComponent)

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

Parameters
tiffComponentAuto pointer to the component to add.
Returns
Return a pointer to the newly added child element or 0.

References doAddChild().

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

◆ addNext()

TiffComponent * Exiv2::Internal::TiffComponent::addNext ( TiffComponent::AutoPtr  tiffComponent)

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

Parameters
tiffComponentAuto pointer to the component to add.
Returns
Return a pointer to the newly added "next" element or 0.

References doAddNext().

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

◆ addPath()

TiffComponent * Exiv2::Internal::TiffComponent::addPath ( uint16_t  tag,
TiffPath tiffPath,
TiffComponent *const  pRoot,
TiffComponent::AutoPtr  object = AutoPtr(0) 
)

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

Parameters
tagThe tag of the new entry
tiffPathA path from the TIFF root element to a TIFF entry.
pRootPointer to the root component of the TIFF composite.
objectTIFF component to add. If 0, the correct entry will be created.
Returns
A pointer to the newly added TIFF entry.

References doAddPath(), and tag().

Referenced by Exiv2::Internal::TiffEncoder::add(), Exiv2::Internal::TiffCopier::copyObject(), Exiv2::Internal::TiffDirectory::doAddPath(), Exiv2::Internal::TiffSubIfd::doAddPath(), Exiv2::Internal::TiffMnEntry::doAddPath(), and Exiv2::Internal::TiffIfdMakernote::doAddPath().

◆ write()

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

Write a TiffComponent to a binary image.

Parameters
ioWrapperIO wrapper to which the TiffComponent is written.
byteOrderApplicable byte order (little or big endian).
offsetOffset from the start of the image (TIFF header) to the component.
valueIdxIndex of the component to be written relative to offset.
dataIdxIndex of the data area of the component relative to offset.
imageIdxIndex of the image data area relative to offset.
Returns
Number of bytes written to the IO wrapper including all nested components.
Exceptions
ErrorIf the component cannot be written.

References doWrite().

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


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