![]() |
Exiv2
|
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>
Public Member Functions | |
Creators | |
TiffBinaryArray (uint16_t tag, IfdId group, const ArrayCfg *arrayCfg, const ArrayDef *arrayDef, int defSize) | |
Constructor. | |
TiffBinaryArray (uint16_t tag, IfdId group, const ArraySet *arraySet, int setSize, CfgSelFct cfgSelFct) | |
Constructor for a complex binary array. | |
virtual | ~TiffBinaryArray () |
Virtual destructor. | |
Manipulators | |
uint32_t | addElement (uint32_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. More... | |
bool | initialize (TiffComponent *const 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. More... | |
void | iniOrigDataBuf () |
Initialize the original data buffer and its size from the base entry. | |
bool | updOrigDataBuf (const byte *pData, uint32_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. | |
int | defSize () const |
Return the number of elements in the definition. | |
bool | decoded () const |
Return the flag which indicates if the array was decoded. | |
![]() | |
TiffEntryBase (uint16_t tag, IfdId group, TiffType tiffType=ttUndefined) | |
Default constructor. | |
virtual | ~TiffEntryBase () |
Virtual destructor. | |
void | encode (TiffEncoder &encoder, const Exifdatum *datum) |
Encode a TIFF component from the metadatum provided and information from the encoder as needed. More... | |
void | setOffset (int32_t offset) |
Set the offset. | |
void | setData (byte *pData, int32_t size) |
Set pointer and size of the entry's data (not taking ownership of the data). | |
void | setData (DataBuf buf) |
Set the entry's data buffer, taking ownership of the data buffer passed in. | |
void | updateValue (Value::AutoPtr value, ByteOrder byteOrder) |
Update the value. Takes ownership of the pointer passed in. More... | |
void | setValue (Value::AutoPtr value) |
Set tag value. Takes ownership of the pointer passed in. More... | |
TiffType | tiffType () const |
Return the TIFF type. | |
int32_t | offset () const |
Return the offset to the data area relative to the base for the component (usually the start of the TIFF header) | |
virtual int | idx () const |
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. | |
![]() | |
TiffComponent (uint16_t tag, IfdId group) | |
Constructor. | |
virtual | ~TiffComponent () |
Virtual destructor. | |
TiffComponent * | addPath (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... | |
TiffComponent * | addChild (AutoPtr tiffComponent) |
Add a child to the component. Default is to do nothing. More... | |
TiffComponent * | addNext (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... | |
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. | |
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(). | |
Protected Member Functions | |
Protected Creators | |
TiffBinaryArray (const TiffBinaryArray &rhs) | |
Copy constructor (used to implement clone()). | |
Protected Manipulators | |
virtual TiffComponent * | doAddPath (uint16_t tag, TiffPath &tiffPath, TiffComponent *const pRoot, TiffComponent::AutoPtr object) |
Implements addPath(). Todo: Document it! | |
virtual TiffComponent * | doAddChild (TiffComponent::AutoPtr tiffComponent) |
Implements addChild(). Todo: Document it! | |
virtual void | doAccept (TiffVisitor &visitor) |
Implements accept(). | |
virtual void | doEncode (TiffEncoder &encoder, const Exifdatum *datum) |
Implements encode(). | |
virtual uint32_t | doWrite (IoWrapper &ioWrapper, ByteOrder byteOrder, int32_t offset, uint32_t valueIdx, uint32_t dataIdx, uint32_t &imageIdx) |
Implements write(). Todo: Document it! | |
Protected Accessors | |
virtual TiffBinaryArray * | doClone () const |
Internal virtual copy constructor, implements clone(). | |
virtual uint32_t | doCount () const |
Implements count(). Todo: Document it! | |
virtual uint32_t | doSize () const |
Implements size(). Todo: Document it! | |
![]() | |
TiffEntryBase (const TiffEntryBase &rhs) | |
Copy constructor (used to implement clone()). | |
void | setCount (uint32_t count) |
Set the number of components in this entry. | |
void | setIdx (int idx) |
Set the unique id of the entry in the image. | |
virtual uint32_t | doWriteData (IoWrapper &ioWrapper, ByteOrder byteOrder, int32_t offset, uint32_t dataIdx, uint32_t &imageIdx) const |
Implements writeData(). Standard TIFF entries have no data: write nothing and return 0. | |
virtual uint32_t | doWriteImage (IoWrapper &ioWrapper, ByteOrder byteOrder) const |
Implements writeImage(). Standard TIFF entries have no image data: write nothing and return 0. | |
virtual uint32_t | doSizeData () const |
Implements sizeData(). Return 0. | |
virtual uint32_t | doSizeImage () const |
Implements sizeImage(). Return 0. | |
![]() | |
virtual TiffComponent * | doAddNext (AutoPtr tiffComponent) |
Implements addNext(). The default implementation does nothing. | |
Additional Inherited Members | |
![]() | |
typedef std::auto_ptr< TiffComponent > | AutoPtr |
TiffComponent auto_ptr type. | |
typedef std::vector< TiffComponent * > | Components |
Container type to hold all metadata. | |
![]() | |
static uint32_t | writeOffset (byte *buf, int32_t offset, TiffType tiffType, ByteOrder byteOrder) |
Helper function to write an offset to a preallocated binary buffer. | |
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.
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_.
group | Group to setup the binary array for. |
References Exiv2::Internal::ArraySet::cfg_, Exiv2::Internal::ArraySet::def_, Exiv2::Internal::ArraySet::defSize_, Exiv2::Internal::TiffComponent::group(), and Exiv2::Internal::TiffEntryBase::idx().
Referenced by doAddPath(), Exiv2::Internal::TiffReader::visitBinaryArray(), and Exiv2::Internal::TiffEncoder::visitBinaryArrayEnd().
bool Exiv2::Internal::TiffBinaryArray::initialize | ( | TiffComponent *const | 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.
pRoot | Pointer to the root component of the TIFF tree. |
References Exiv2::Internal::ArraySet::cfg_, Exiv2::Internal::ArraySet::def_, Exiv2::Internal::ArraySet::defSize_, Exiv2::Internal::TiffEntryBase::doSize(), Exiv2::Internal::TiffEntryBase::idx(), Exiv2::Internal::TiffEntryBase::pData(), and Exiv2::Internal::TiffComponent::tag().