Exiv2::Entry Class Reference

Data structure for one IFD directory entry. See the description of class Ifd for an explanation of the supported modes for memory allocation. More...

#include <ifd.hpp>

List of all members.

Public Member Functions

Creators
 Entry (bool alloc=true)
 Default constructor. The entry allocates memory for its data if alloc is true (the default), otherwise it remembers just the pointers into a read and writeable data buffer which it doesn't allocate or delete.

 ~Entry ()
 Destructor.

 Entry (const Entry &rhs)
 Copy constructor.

Manipulators
Entryoperator= (const Entry &rhs)
 Assignment operator.

void setTag (uint16_t tag)
 Set the tag.

void setIfdId (IfdId ifdId)
 Set the IFD id.

void setIdx (int idx)
 Set the index (unique id of an entry within one IFD).

void setOffset (long offset)
 Set the offset. The offset is relative to the start of the IFD.

void setValue (uint32_t data, ByteOrder byteOrder)
 Set the value of the entry to a single unsigned long component, i.e., set the type of the entry to unsigned long, number of components to one and the value according to the data provided.

void setValue (uint16_t type, uint32_t count, const byte *data, long size, ByteOrder byteOrder=invalidByteOrder)
 Set type, count, the data buffer and its size.

void setDataArea (const byte *buf, long len)
 Set the data area. Memory management as for setValue(uint16_t, uint32_t, const byte*, long).

void setDataAreaOffsets (uint32_t offset, ByteOrder byteOrder)
 Set the offset(s) to the data area of an entry.

void updateBase (byte *pOldBase, byte *pNewBase)
 Update the base pointer of the Entry from pOldBase to pNewBase.

Accessors
uint16_t tag () const
 Return the tag.

uint16_t type () const
 Return the type id.

const char * typeName () const
 Return the name of the type.

long typeSize () const
 Return the size in bytes of one element of this type.

IfdId ifdId () const
 Return the IFD id.

int idx () const
 Return the index (unique id >0 of an entry within an IFD, 0 if not set).

uint32_t count () const
 Return the number of components in the value.

long size () const
 Return the size of the data buffer in bytes.

long offset () const
 Return the offset from the start of the IFD to the data of the entry.

const bytedata () const
 Return a pointer to the data buffer. Do not attempt to write to this pointer.

const bytecomponent (uint32_t n) const
 Return a pointer to the n-th component, 0 if there is no n-th component. Do not attempt to write to this pointer.

bool alloc () const
 Get the memory allocation mode.

long sizeDataArea () const
 Return the size of the data area.

const bytedataArea () const
 Return a pointer to the data area. Do not attempt to write to this pointer.

ByteOrder byteOrder () const
 Return the byte order of the entry. There should generally not be a need for this, it is only used in special cases (Minolta Makernote CameraSettings tags).


Detailed Description

Data structure for one IFD directory entry. See the description of class Ifd for an explanation of the supported modes for memory allocation.


Member Function Documentation

const byte* Exiv2::Entry::dataArea  )  const [inline]
 

Return a pointer to the data area. Do not attempt to write to this pointer.

For certain tags the regular value of an IFD entry is an offset to a data area outside of the IFD. Examples are Exif tag 0x8769 in IFD0 (Exif.Image.ExifTag) or tag 0x0201 in IFD1 (Exif.Thumbnail.JPEGInterchangeFormat). The offset of ExifTag points to a data area containing the Exif IFD. That of JPEGInterchangeFormat contains the JPEG thumbnail image. Use this method to access (read-only) the data area of a tag. Use setDataArea() to write to the data area.

Returns:
Return a pointer to the data area.

void Exiv2::Entry::setDataArea const byte buf,
long  len
 

Set the data area. Memory management as for setValue(uint16_t, uint32_t, const byte*, long).

For certain tags the regular value of an IFD entry is an offset to a data area outside of the IFD. Examples are Exif tag 0x8769 in IFD0 (Exif.Image.ExifTag) or tag 0x0201 in IFD1 (Exif.Thumbnail.JPEGInterchangeFormat). The offset of ExifTag points to a data area containing the Exif IFD. That of JPEGInterchangeFormat contains the JPEG thumbnail image. This method sets the data area of a tag in accordance with the memory allocation mode.

Parameters:
buf Pointer to the data area.
len Size of the data area.
Exceptions:
Error in non-alloc mode, if there already is a dataarea but the size of the existing dataarea is not large enough for the new buffer.

void Exiv2::Entry::setDataAreaOffsets uint32_t  offset,
ByteOrder  byteOrder
 

Set the offset(s) to the data area of an entry.

Add offset to each data component of the entry. This is used by Ifd::copy to convert the data components of an entry containing offsets relative to the data area to become offsets from the start of the TIFF header. Usually, entries with a data area have exactly one unsigned long data component, which is 0.

Parameters:
offset Offset
byteOrder Byte order
Exceptions:
Error if the offset is out of range for the data type of the tag or the data type is not supported.

void Exiv2::Entry::setValue uint16_t  type,
uint32_t  count,
const byte data,
long  size,
ByteOrder  byteOrder = invalidByteOrder
 

Set type, count, the data buffer and its size.

Copies the provided buffer when called in memory allocation mode.
In non-alloc mode, use this method to initialise the data of a newly created Entry. In this case, only the pointer to the buffer is copied, i.e., the buffer must remain valid throughout the life of the Entry. Subsequent calls in non-alloc mode will overwrite the data pointed to by this pointer with the data provided, i.e., the buffer provided in subsequent calls can be deleted after the call.
In either memory allocation mode, the data buffer provided must be large enough to hold count components of type. The size of the buffer will be as indicated in the size argument. I.e., it is possible to allocate (set) a data buffer larger than required to hold count components of the given type.

Parameters:
type The type of the data.
count Number of components in the buffer.
data Pointer to the data buffer.
size Size of the desired data buffer in bytes.
byteOrder Optional byte order.
Exceptions:
Error if no memory allocation is allowed and the size of the data buffer is larger than the existing data buffer of the entry or if size is not large enough to hold count components of the given type.

void Exiv2::Entry::setValue uint32_t  data,
ByteOrder  byteOrder
 

Set the value of the entry to a single unsigned long component, i.e., set the type of the entry to unsigned long, number of components to one and the value according to the data provided.

The size of the data buffer is set to at least four bytes, but is left unchanged if it can accomodate the pointer. This method can be used to set the value of a tag which contains a pointer (offset) to a location in the Exif data (like e.g., ExifTag, 0x8769 in IFD0, which contains a pointer to the Exif IFD).
This method cannot be used to set the value of a newly created Entry in non-alloc mode.

Note:
This method is now deprecated, use data area related methods instead.

long Exiv2::Entry::size  )  const [inline]
 

Return the size of the data buffer in bytes.

Note:
There is no minimum size for the data buffer, except that it must be large enough to hold the data.

void Exiv2::Entry::updateBase byte pOldBase,
byte pNewBase
 

Update the base pointer of the Entry from pOldBase to pNewBase.

Allows to re-locate the underlying data buffer to a new location pNewBase. This method only has an effect in non-alloc mode.

Parameters:
pOldBase Base pointer of the old data buffer
pNewBase Base pointer of the new data buffer


The documentation for this class was generated from the following file:
Generated on Thu Jan 10 01:59:44 2008 for Exiv2 by doxygen 1.3.5