refinery
RAW file processor
Public Member Functions

refinery::Exiv2ExifData Class Reference

Uses Exiv2 to supply Exif data. More...

#include <licensed/gpl/refinery/exif_exiv2.h>

Inheritance diagram for refinery::Exiv2ExifData:
Inheritance graph
[legend]
Collaboration diagram for refinery::Exiv2ExifData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Exiv2ExifData (Exiv2::ExifData &exiv2ExifData)
 constructor.
 ~Exiv2ExifData ()
 destructor.
virtual bool hasKey (const char *key) const
 True iff the Exif data contains the given key.
virtual std::string getString (const char *key) const
 Returns the specified Exif value as a string.
virtual void getBytes (const char *key, std::vector< byte > &outBytes) const
 Copies the specified Exif value into a byte-array.
virtual int getInt (const char *key) const
 Returns the specified Exif value as an int.
virtual float getFloat (const char *key) const
 Returns the specified Exif value as a float.

Detailed Description

Uses Exiv2 to supply Exif data.

Exiv2 is complete and has a useful API, but its license is GPL and so any code that links to it must use a GPL-compatible license.

This is a shallow wrapper around the Exiv2 data, so the original Exiv2 data must exist for the lifetime of this object.

When the header is included, Exiv2ExifData can be initialized automatically where an ExifData is expected, as in the following example:

 Exiv2::Image::AutoPtr exivImage(Exiv2::ImageFactory::open("image.NEF"));
 // assert exivImage.get() != 0
 exivImage->readMetadata();
 const Exiv2::ExifData& exivData(exivImage->exifData());
 // assert !exivData.empty()
 refinery::ImageReader reader;
 std::auto_ptr<GrayImage> grayImagePtr(
   reader.readGrayImage(fb, exivData)); // exivData converts to an ExifData

Definition at line 55 of file exif_exiv2.h.


Constructor & Destructor Documentation

refinery::Exiv2ExifData::Exiv2ExifData ( Exiv2::ExifData &  exiv2ExifData)

constructor.

Parameters:
exiv2ExifDataThe Exiv2 data.
refinery::Exiv2ExifData::~Exiv2ExifData ( )

destructor.


Member Function Documentation

virtual void refinery::Exiv2ExifData::getBytes ( const char *  key,
std::vector< byte > &  outBytes 
) const [virtual]

Copies the specified Exif value into a byte-array.

Existing data will be erased.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Nikon3.LinearizationTable".
[out]outBytesByte-array to fill.

Implements refinery::ExifData.

virtual float refinery::Exiv2ExifData::getFloat ( const char *  key) const [virtual]

Returns the specified Exif value as a float.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Image.XResolution".
Returns:
A float representation of the Exif value.

Implements refinery::ExifData.

virtual int refinery::Exiv2ExifData::getInt ( const char *  key) const [virtual]

Returns the specified Exif value as an int.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Image.Orientation".
Returns:
An int representation of the Exif value.

Implements refinery::ExifData.

virtual std::string refinery::Exiv2ExifData::getString ( const char *  key) const [virtual]

Returns the specified Exif value as a string.

This throws an error if the Exif data doesn't exist. Use hasKey() to verify that it does before calling this method.

Parameters:
[in]keyExif key, for instance "Exif.Image.Model".
Returns:
A string representation of the Exif value.

Implements refinery::ExifData.

virtual bool refinery::Exiv2ExifData::hasKey ( const char *  key) const [virtual]

True iff the Exif data contains the given key.

Parameters:
[in]keyExif key, for instance "Exif.Image.Orientation".
Returns:
True iff the Exif data contains the key.

Implements refinery::ExifData.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator