Exiv2
Loading...
Searching...
No Matches
Public Types | List of all members
Exiv2::Internal::CiffHeader Class Reference

This class models the header of a CRW (Canon Raw data) image. It is the head of a CIFF parse tree, consisting of CiffDirectory and CiffEntry objects. Most of its methods will walk the parse tree to perform the requested action. More...

#include <crwimage_int.hpp>

Public Types

using UniquePtr = std::unique_ptr< CiffHeader >
 CiffHeader auto_ptr type.
 

Public Member Functions

Creators
 CiffHeader ()=default
 Default constructor.
 
virtual ~CiffHeader ()=default
 Virtual destructor.
 

Accessors

void write (Blob &blob) const
 Write the CRW image to the binary image blob, starting with the Ciff header. This method appends to the blob.
 
void decode (Image &image) const
 Decode the CRW image and add it to image.
 
ByteOrder byteOrder () const
 Return the byte order (little or big endian).
 
CiffComponentfindComponent (uint16_t crwTagId, uint16_t crwDir) const
 Finds crwTagId in directory crwDir in the parse tree, returning a pointer to the component or 0 if not found.
 

Manipulators

void read (const byte *pData, size_t size)
 Read the CRW image from a data buffer, starting with the Ciff header.
 
void add (uint16_t crwTagId, uint16_t crwDir, DataBuf &&buf)
 Set the value of entry crwTagId in directory crwDir to buf. If this tag doesn't exist, it is added along with all directories needed.
 
void remove (uint16_t crwTagId, uint16_t crwDir) const
 Remove entry crwTagId in directory crwDir from the parse tree. If it's the last entry in the directory, the directory is removed as well, etc.
 
static const char * signature ()
 Return a pointer to the Canon CRW signature.
 

Detailed Description

This class models the header of a CRW (Canon Raw data) image. It is the head of a CIFF parse tree, consisting of CiffDirectory and CiffEntry objects. Most of its methods will walk the parse tree to perform the requested action.

Member Function Documentation

◆ add()

void Exiv2::Internal::CiffHeader::add ( uint16_t  crwTagId,
uint16_t  crwDir,
DataBuf &&  buf 
)

Set the value of entry crwTagId in directory crwDir to buf. If this tag doesn't exist, it is added along with all directories needed.

Parameters
crwTagIdTag to be added.
crwDirParent directory of the tag.
bufValue to be set.

References Exiv2::Internal::CrwMap::loadStack(), and Exiv2::Internal::CiffComponent::setValue().

◆ decode()

void Exiv2::Internal::CiffHeader::decode ( Image image) const

Decode the CRW image and add it to image.

Walk the parse tree and convert CIFF entries to metadata entries which are added to image.

Parameters
imageImage to add metadata to

Referenced by Exiv2::CrwParser::decode().

◆ findComponent()

CiffComponent * Exiv2::Internal::CiffHeader::findComponent ( uint16_t  crwTagId,
uint16_t  crwDir 
) const

Finds crwTagId in directory crwDir in the parse tree, returning a pointer to the component or 0 if not found.

Finds crwTagId in directory crwDir, returning a pointer to the component or 0 if not found.

Referenced by Exiv2::CrwParser::decode().

◆ read()

void Exiv2::Internal::CiffHeader::read ( const byte pData,
size_t  size 
)

Read the CRW image from a data buffer, starting with the Ciff header.

Parameters
pDataPointer to the data buffer.
sizeNumber of bytes in the data buffer.
Exceptions
ErrorIf the image cannot be parsed.

References Exiv2::getULong(), and signature().

Referenced by Exiv2::CrwParser::decode(), and Exiv2::CrwParser::encode().

◆ remove()

void Exiv2::Internal::CiffHeader::remove ( uint16_t  crwTagId,
uint16_t  crwDir 
) const

Remove entry crwTagId in directory crwDir from the parse tree. If it's the last entry in the directory, the directory is removed as well, etc.

Parameters
crwTagIdTag id to be removed.
crwDirParent directory of the tag.

References Exiv2::Internal::CrwMap::loadStack().

◆ write()

void Exiv2::Internal::CiffHeader::write ( Blob blob) const

Write the CRW image to the binary image blob, starting with the Ciff header. This method appends to the blob.

Parameters
blobBinary image to add to.
Exceptions
ErrorIf the image cannot be written.

References Exiv2::append(), and Exiv2::ul2Data().

Referenced by Exiv2::CrwParser::encode().


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