![]() |
Exiv2
|
Interface class for components of the CIFF directory hierarchy of a CRW (Canon Raw data) image. Both CIFF directories as well as entries implement this interface. This class is implemented as NVI (non-virtual interface). More...
#include <crwimage_int.hpp>

Public Types | |
| using | UniquePtr = std::unique_ptr<CiffComponent> |
| CiffComponent auto_ptr type. | |
| using | Components = std::vector<CiffComponent*> |
| Container type to hold all metadata. | |
Public Member Functions | |
Creators | |
| CiffComponent ()=default | |
| Default constructor. | |
| CiffComponent (uint16_t tag, uint16_t dir) | |
| Constructor taking a tag and directory. | |
| CiffComponent (const CiffComponent &)=delete | |
| CiffComponent & | operator= (const CiffComponent &)=delete |
| virtual | ~CiffComponent ()=default |
| Virtual destructor. | |
Accessors | |
| void | decode (Image &image, ByteOrder byteOrder) const |
| Decode metadata from the component and add it to image. | |
| void | print (std::ostream &os, ByteOrder byteOrder, const std::string &prefix="") const |
| Print debug info about a component to os. | |
| void | writeDirEntry (Blob &blob, ByteOrder byteOrder) const |
| Write a directory entry for the component to the blob. If the size of the data is not larger than 8 bytes, the data is written to the directory entry. | |
| uint16_t | dir () const |
| Return the tag of the directory containing this component. | |
| uint16_t | tag () const |
| Return the tag of this component. | |
| bool | empty () const |
| Return true if the component is empty, else false. | |
| size_t | size () const |
| Return the data size of this component. | |
| size_t | offset () const |
| Return the offset to the data from the start of the directory. | |
| const byte * | pData () const |
| Return a pointer to the data area of this component. | |
| uint16_t | tagId () const |
| Return the tag id of this component. | |
| TypeId | typeId () const |
| Return the type id of this component. | |
| DataLocId | dataLocation () const |
| Return the data location for this component. | |
| CiffComponent * | findComponent (uint16_t crwTagId, uint16_t crwDir) const |
| Finds crwTagId in directory crwDir, returning a pointer to the component or 0 if not found. | |
| virtual void | doDecode (Image &image, ByteOrder byteOrder) const =0 |
| Implements decode(). | |
| virtual void | doPrint (std::ostream &os, ByteOrder byteOrder, const std::string &prefix) const |
| Implements print(). The default implementation prints the entry. | |
| virtual bool | doEmpty () const |
| Implements empty(). Default implementation returns true if size is 0. | |
| virtual CiffComponent * | doFindComponent (uint16_t crwTagId, uint16_t crwDir) const |
| Implements findComponent(). The default implementation checks the entry. | |
Manipulators | |
| void | add (UniquePtr component) |
| Add a component to the composition. | |
| CiffComponent * | add (CrwDirs &crwDirs, uint16_t crwTagId) |
| Add crwTagId to the parse tree, if it doesn't exist yet. crwDirs contains the path of subdirectories, starting with the root directory, leading to crwTagId. Directories that don't exist yet are added along the way. Returns a pointer to the newly added component. | |
| void | remove (CrwDirs &crwDirs, uint16_t crwTagId) |
| Remove crwTagId from the parse tree, if it exists yet. crwDirs contains the path of subdirectories, starting with the root directory, leading to crwTagId. | |
| void | read (const byte *pData, size_t size, uint32_t start, ByteOrder byteOrder) |
| Read a component from a data buffer. | |
| size_t | write (Blob &blob, ByteOrder byteOrder, size_t offset) |
| Write the metadata from the raw metadata component to the binary image blob. This method may append to the blob. | |
| size_t | writeValueData (Blob &blob, size_t offset) |
| Writes the entry's value if size is larger than eight bytes. If needed, the value is padded with one 0 byte to make the number of bytes written to the blob even. The offset of the component is set to the offset passed in. | |
| void | setDir (uint16_t dir) |
| Set the directory tag for this component. | |
| void | setValue (DataBuf &&buf) |
| Set the data value of the entry. | |
| static TypeId | typeId (uint16_t tag) |
| Return the type id for a tag. | |
| static DataLocId | dataLocation (uint16_t tag) |
| Return the data location id for a tag. | |
| virtual void | doAdd (UniquePtr component)=0 |
| Implements add(). | |
| virtual CiffComponent * | doAdd (CrwDirs &crwDirs, uint16_t crwTagId) |
| Implements add(). The default implementation does nothing. | |
| virtual void | doRemove (CrwDirs &crwDirs, uint16_t crwTagId) |
| Implements remove(). The default implementation does nothing. | |
| virtual void | doRead (const byte *pData, size_t size, uint32_t start, ByteOrder byteOrder) |
| Implements read(). The default implementation reads a directory entry. | |
| virtual size_t | doWrite (Blob &blob, ByteOrder byteOrder, size_t offset)=0 |
| Implements write(). | |
| void | setSize (size_t size) |
| Set the size of the data area. | |
| void | setOffset (size_t offset) |
| Set the offset for this component. | |
Interface class for components of the CIFF directory hierarchy of a CRW (Canon Raw data) image. Both CIFF directories as well as entries implement this interface. This class is implemented as NVI (non-virtual interface).
|
default |
Default constructor.
References CiffComponent(), dir(), and tag().
Referenced by add(), CiffComponent(), CiffComponent(), doAdd(), doAdd(), doDecode(), doFindComponent(), findComponent(), and ~CiffComponent().
| Exiv2::Internal::CiffComponent::CiffComponent | ( | uint16_t | tag, |
| uint16_t | dir ) |
Constructor taking a tag and directory.
References CiffComponent(), dir(), and tag().
|
virtualdefault |
Virtual destructor.
References add(), CiffComponent(), offset(), pData(), read(), remove(), size(), write(), and writeValueData().
| CiffComponent * Exiv2::Internal::CiffComponent::add | ( | CrwDirs & | crwDirs, |
| uint16_t | crwTagId ) |
Add crwTagId to the parse tree, if it doesn't exist yet. crwDirs contains the path of subdirectories, starting with the root directory, leading to crwTagId. Directories that don't exist yet are added along the way. Returns a pointer to the newly added component.
| crwDirs | Subdirectory path from root to the subdirectory containing the tag to be added. |
| crwTagId | Tag to be added. |
References CiffComponent(), and doAdd().
| void Exiv2::Internal::CiffComponent::add | ( | UniquePtr | component | ) |
Add a component to the composition.
References doAdd().
Referenced by Exiv2::Internal::CiffHeader::add(), Exiv2::Internal::CiffDirectory::readDirectory(), and ~CiffComponent().
|
inlinenodiscard |
Return the data location for this component.
References dataLocation().
|
static |
Return the data location id for a tag.
References Exiv2::Error::Error(), and tag().
Referenced by dataLocation(), doRead(), setValue(), writeDirEntry(), and writeValueData().
Decode metadata from the component and add it to image.
| image | Image to add metadata to |
| byteOrder | Byte order |
References doDecode().
|
inlinenodiscard |
Return the tag of the directory containing this component.
Referenced by CiffComponent(), CiffComponent(), Exiv2::Internal::CrwMap::decode(), doFindComponent(), doPrint(), and setDir().
|
protectedvirtual |
Implements add(). The default implementation does nothing.
References CiffComponent().
|
protectedpure virtual |
Implements add().
References CiffComponent(), doAdd(), doRead(), doRemove(), pData(), and size().
|
protectedpure virtual |
Implements decode().
References CiffComponent(), doEmpty(), doFindComponent(), and doPrint().
Referenced by decode().
|
nodiscardprotectedvirtual |
Implements empty(). Default implementation returns true if size is 0.
Referenced by doDecode(), and empty().
|
nodiscardprotectedvirtual |
Implements findComponent(). The default implementation checks the entry.
References CiffComponent(), dir(), and tagId().
Referenced by doDecode(), and findComponent().
|
protectedvirtual |
Implements print(). The default implementation prints the entry.
References Exiv2::Value::create(), dir(), Exiv2::directory, tagId(), typeId(), and Exiv2::TypeInfo::typeName().
Referenced by doDecode(), and print().
|
protectedvirtual |
Implements read(). The default implementation reads a directory entry.
References dataLocation(), Exiv2::Internal::enforce(), Exiv2::getULong(), Exiv2::getUShort(), pData(), size(), tag(), and tagId().
|
protectedvirtual |
|
nodiscard |
Return true if the component is empty, else false.
References doEmpty().
|
nodiscard |
Finds crwTagId in directory crwDir, returning a pointer to the component or 0 if not found.
References CiffComponent(), and doFindComponent().
Referenced by Exiv2::Internal::CiffHeader::findComponent().
|
inlinenodiscard |
Return the offset to the data from the start of the directory.
Referenced by doWrite(), setOffset(), write(), writeValueData(), and ~CiffComponent().
|
inlinenodiscard |
Return a pointer to the data area of this component.
Referenced by doAdd(), doRead(), read(), Exiv2::Internal::CiffDirectory::readDirectory(), and ~CiffComponent().
| void Exiv2::Internal::CiffComponent::print | ( | std::ostream & | os, |
| ByteOrder | byteOrder, | ||
| const std::string & | prefix = "" ) const |
Print debug info about a component to os.
| os | Output stream to write to |
| byteOrder | Byte order |
| prefix | Prefix to be written before each line of output |
References doPrint().
| void Exiv2::Internal::CiffComponent::read | ( | const byte * | pData, |
| size_t | size, | ||
| uint32_t | start, | ||
| ByteOrder | byteOrder ) |
Read a component from a data buffer.
| pData | Pointer to the data buffer. |
| size | Number of bytes in the data buffer. |
| start | Component starts at pData + start. |
| byteOrder | Applicable byte order (little or big endian). |
| Error | If the component cannot be parsed. |
References doRead(), pData(), and size().
Referenced by ~CiffComponent().
| void Exiv2::Internal::CiffComponent::remove | ( | CrwDirs & | crwDirs, |
| uint16_t | crwTagId ) |
Remove crwTagId from the parse tree, if it exists yet. crwDirs contains the path of subdirectories, starting with the root directory, leading to crwTagId.
| crwDirs | Subdirectory path from root to the subdirectory containing the tag to be removed. |
| crwTagId | Tag to be removed. |
References doRemove().
Referenced by ~CiffComponent().
|
inline |
Set the directory tag for this component.
References dir().
|
inlineprotected |
Set the offset for this component.
References offset().
|
inlineprotected |
Set the size of the data area.
References size().
| void Exiv2::Internal::CiffComponent::setValue | ( | DataBuf && | buf | ) |
Set the data value of the entry.
References dataLocation().
Referenced by Exiv2::Internal::CiffHeader::add().
|
inlinenodiscard |
Return the data size of this component.
Referenced by doAdd(), doRead(), read(), Exiv2::Internal::CiffDirectory::readDirectory(), setSize(), and ~CiffComponent().
|
inlinenodiscard |
Return the tag of this component.
Referenced by CiffComponent(), CiffComponent(), dataLocation(), doRead(), Exiv2::Internal::CiffDirectory::readDirectory(), typeId(), and writeDirEntry().
|
inlinenodiscard |
Return the tag id of this component.
Referenced by Exiv2::Internal::CrwMap::decode(), doFindComponent(), doPrint(), doRead(), writeDirEntry(), and writeValueData().
|
inlinenodiscard |
Return the type id of this component.
References typeId().
|
static |
Return the type id for a tag.
References Exiv2::asciiString, Exiv2::directory, Exiv2::invalidTypeId, tag(), Exiv2::undefined, Exiv2::unsignedByte, Exiv2::unsignedLong, and Exiv2::unsignedShort.
Referenced by doPrint(), Exiv2::Internal::CiffDirectory::readDirectory(), and typeId().
Write the metadata from the raw metadata component to the binary image blob. This method may append to the blob.
| blob | Binary image to add metadata to |
| byteOrder | Byte order |
| offset | Current offset |
References doWrite(), and offset().
Referenced by ~CiffComponent().
Write a directory entry for the component to the blob. If the size of the data is not larger than 8 bytes, the data is written to the directory entry.
References Exiv2::append(), dataLocation(), tag(), tagId(), Exiv2::ul2Data(), and Exiv2::us2Data().
| size_t Exiv2::Internal::CiffComponent::writeValueData | ( | Blob & | blob, |
| size_t | offset ) |
Writes the entry's value if size is larger than eight bytes. If needed, the value is padded with one 0 byte to make the number of bytes written to the blob even. The offset of the component is set to the offset passed in.
| blob | The binary image to write to. |
| offset | Offset from the start of the directory for this entry. |
References Exiv2::append(), dataLocation(), offset(), and tagId().
Referenced by ~CiffComponent().