Exiv2
Classes | Public Types | List of all members
Exiv2::Converter Class Reference

Metadata conversions. More...

Classes

struct  Conversion
 Structure to define conversions between two keys. More...
 

Public Types

typedef void(Converter::* ConvertFct) (const char *from, const char *to)
 Type for metadata converter functions, taking two key strings, from and to. More...
 

Public Member Functions

Creators
 Converter (ExifData &exifData, XmpData &xmpData)
 Constructor for Exif tags and XMP properties.
 
 Converter (IptcData &iptcData, XmpData &xmpData, const char *iptcCharset=0)
 Constructor for Iptc tags and XMP properties.
 
Manipulators
void cnvToXmp ()
 Convert Exif tags or IPTC datasets to XMP properties according to the conversion table.
 
void cnvFromXmp ()
 Convert XMP properties to Exif tags or IPTC datasets according to the conversion table.
 
void setErase (bool onoff=true)
 Set the erase flag. More...
 
void setOverwrite (bool onoff=true)
 Set the overwrite flag. More...
 
Conversion functions (manipulators)
void cnvNone (const char *, const char *)
 Do nothing conversion function. More...
 
void cnvExifValue (const char *from, const char *to)
 Simple Exif to XMP conversion function. More...
 
void cnvExifComment (const char *from, const char *to)
 Convert the tag Exif.Photo.UserComment to XMP. More...
 
void cnvExifArray (const char *from, const char *to)
 Converts Exif tag with multiple components to XMP array. More...
 
void cnvExifDate (const char *from, const char *to)
 Exif date to XMP conversion function. More...
 
void cnvExifVersion (const char *from, const char *to)
 Exif version to XMP conversion function. More...
 
void cnvExifGPSVersion (const char *from, const char *to)
 Exif GPS version to XMP conversion function. More...
 
void cnvExifFlash (const char *from, const char *to)
 Exif Flash to XMP conversion function. More...
 
void cnvExifGPSCoord (const char *from, const char *to)
 Exif GPS coordinate to XMP conversion function. More...
 
void cnvXmpValue (const char *from, const char *to)
 Simple XMP to Exif conversion function. More...
 
void cnvXmpComment (const char *from, const char *to)
 Convert the tag Xmp.exif.UserComment to Exif.
 
void cnvXmpArray (const char *from, const char *to)
 Converts XMP array to Exif tag with multiple components. More...
 
void cnvXmpDate (const char *from, const char *to)
 XMP to Exif date conversion function. More...
 
void cnvXmpVersion (const char *from, const char *to)
 XMP to Exif version conversion function. More...
 
void cnvXmpGPSVersion (const char *from, const char *to)
 XMP to Exif GPS version conversion function. More...
 
void cnvXmpFlash (const char *from, const char *to)
 XMP to Exif Flash conversion function. More...
 
void cnvXmpGPSCoord (const char *from, const char *to)
 XMP to Exif GPS coordinate conversion function. More...
 
void cnvIptcValue (const char *from, const char *to)
 IPTC dataset to XMP conversion function. More...
 
void cnvXmpValueToIptc (const char *from, const char *to)
 XMP to IPTC dataset conversion function. More...
 
void writeExifDigest ()
 Write exif:NativeDigest and tiff:NativeDigest properties to XMP. More...
 
void syncExifWithXmp ()
 Copies metadata in appropriate direction. More...
 
Accessors
bool erase () const
 Get the value of the erase flag, see also setErase(bool on).
 
bool overwrite () const
 Get the value of the overwrite flag, see also setOverwrite(bool on).
 

Detailed Description

Metadata conversions.

Member Typedef Documentation

◆ ConvertFct

typedef void(Converter::* Exiv2::Converter::ConvertFct) (const char *from, const char *to)

Type for metadata converter functions, taking two key strings, from and to.

These functions have access to both the source and destination metadata containers and store the result directly in the destination container.

Member Function Documentation

◆ cnvExifArray()

void Exiv2::Converter::cnvExifArray ( const char *  from,
const char *  to 
)

Converts Exif tag with multiple components to XMP array.

Converts Exif tag with multiple components to XMP array. This function is used for ComponentsConfiguration tag.

References Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_WARNING, Exiv2::ExifData::findKey(), and Exiv2::string.

◆ cnvExifComment()

void Exiv2::Converter::cnvExifComment ( const char *  from,
const char *  to 
)

Convert the tag Exif.Photo.UserComment to XMP.

Todo: Convert the Exif comment to UTF-8 if necessary.

References Exiv2::CommentValue::comment(), Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_WARNING, and Exiv2::ExifData::findKey().

◆ cnvExifDate()

void Exiv2::Converter::cnvExifDate ( const char *  from,
const char *  to 
)

Exif date to XMP conversion function.

Sets the XMP property to an XmpText value containing date and time. This function combines values from multiple Exif tags as described in XMP specification. It is used for DateTime, DateTimeOriginal, DateTimeDigitized and GPSTimeStamp.

References Exiv2::asciiString, Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_WARNING, Exiv2::ExifData::findKey(), and Exiv2::string.

◆ cnvExifFlash()

void Exiv2::Converter::cnvExifFlash ( const char *  from,
const char *  to 
)

Exif Flash to XMP conversion function.

Converts Flash tag to XMP structure.

References Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_WARNING, and Exiv2::ExifData::findKey().

◆ cnvExifGPSCoord()

void Exiv2::Converter::cnvExifGPSCoord ( const char *  from,
const char *  to 
)

Exif GPS coordinate to XMP conversion function.

Converts GPS coordinates tag to XmpText value. It combines multiple Exif tags as described in XMP specification.

References Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_WARNING, Exiv2::ExifData::findKey(), and Exiv2::string.

◆ cnvExifGPSVersion()

void Exiv2::Converter::cnvExifGPSVersion ( const char *  from,
const char *  to 
)

Exif GPS version to XMP conversion function.

Converts GPSVersionID tag to XmpText value.

References Exiv2::ExifData::end(), Exiv2::ExifData::erase(), and Exiv2::ExifData::findKey().

◆ cnvExifValue()

void Exiv2::Converter::cnvExifValue ( const char *  from,
const char *  to 
)

Simple Exif to XMP conversion function.

Sets the XMP property to an XmpText value containing the Exif value string.

References Exiv2::ExifData::end(), Exiv2::ExifData::erase(), EXV_WARNING, Exiv2::ExifData::findKey(), and Exiv2::string.

◆ cnvExifVersion()

void Exiv2::Converter::cnvExifVersion ( const char *  from,
const char *  to 
)

Exif version to XMP conversion function.

Converts ExifVersion tag to XmpText value.

References Exiv2::ExifData::end(), Exiv2::ExifData::erase(), and Exiv2::ExifData::findKey().

◆ cnvIptcValue()

void Exiv2::Converter::cnvIptcValue ( const char *  from,
const char *  to 
)

IPTC dataset to XMP conversion function.

Multiple IPTC datasets with the same key are converted to an XMP array.

References Exiv2::convertStringCharset(), Exiv2::IptcData::end(), Exiv2::IptcData::erase(), EXV_WARNING, Exiv2::IptcData::findKey(), and Exiv2::string.

◆ cnvNone()

void Exiv2::Converter::cnvNone ( const char *  ,
const char *   
)

Do nothing conversion function.

Use when, for example, a one-way conversion is needed.

◆ cnvXmpArray()

void Exiv2::Converter::cnvXmpArray ( const char *  from,
const char *  to 
)

Converts XMP array to Exif tag with multiple components.

Converts XMP array to Exif tag with multiple components. This function is used for ComponentsConfiguration tag.

References Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), and Exiv2::string.

◆ cnvXmpDate()

void Exiv2::Converter::cnvXmpDate ( const char *  from,
const char *  to 
)

XMP to Exif date conversion function.

Converts the XmpText value to Exif date and time. This function sets multiple Exif tags as described in XMP specification. It is used for DateTime, DateTimeOriginal, DateTimeDigitized and GPSTimeStamp.

References Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), Exiv2::string, and Exiv2::toString().

◆ cnvXmpFlash()

void Exiv2::Converter::cnvXmpFlash ( const char *  from,
const char *  to 
)

XMP to Exif Flash conversion function.

Converts XMP structure to Flash tag.

References Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), and Exiv2::string.

◆ cnvXmpGPSCoord()

void Exiv2::Converter::cnvXmpGPSCoord ( const char *  from,
const char *  to 
)

XMP to Exif GPS coordinate conversion function.

Converts XmpText value to GPS coordinates tags. It sets multiple Exif tags as described in XMP specification.

References Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), Exiv2::floatToRationalCast(), and Exiv2::string.

◆ cnvXmpGPSVersion()

void Exiv2::Converter::cnvXmpGPSVersion ( const char *  from,
const char *  to 
)

XMP to Exif GPS version conversion function.

Converts XmpText value to GPSVersionID tag.

References Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), and Exiv2::string.

◆ cnvXmpValue()

void Exiv2::Converter::cnvXmpValue ( const char *  from,
const char *  to 
)

Simple XMP to Exif conversion function.

Sets the Exif tag according to the XMP property. For LangAlt values, only the x-default entry is used.

Todo: Escape non-ASCII characters in XMP text values

References Exiv2::ExifData::add(), Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), Exiv2::Exifdatum::setValue, and Exiv2::string.

◆ cnvXmpValueToIptc()

void Exiv2::Converter::cnvXmpValueToIptc ( const char *  from,
const char *  to 
)

XMP to IPTC dataset conversion function.

Each array element of an XMP array value is added as one IPTC dataset.

References Exiv2::IptcData::add(), Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), Exiv2::langAlt, Exiv2::string, and Exiv2::xmpText.

◆ cnvXmpVersion()

void Exiv2::Converter::cnvXmpVersion ( const char *  from,
const char *  to 
)

XMP to Exif version conversion function.

Converts XmpText value to ExifVersion tag.

References Exiv2::XmpData::end(), EXV_WARNING, Exiv2::XmpData::findKey(), and Exiv2::string.

◆ setErase()

void Exiv2::Converter::setErase ( bool  onoff = true)
inline

Set the erase flag.

This flag indicates whether successfully converted source records are erased.

Referenced by Exiv2::moveExifToXmp(), Exiv2::moveIptcToXmp(), Exiv2::moveXmpToExif(), Exiv2::moveXmpToIptc(), and syncExifWithXmp().

◆ setOverwrite()

void Exiv2::Converter::setOverwrite ( bool  onoff = true)
inline

Set the overwrite flag.

This flag indicates whether existing target records are overwritten.

Referenced by syncExifWithXmp().

◆ syncExifWithXmp()

void Exiv2::Converter::syncExifWithXmp ( )

Copies metadata in appropriate direction.

From values of exif:NativeDigest and tiff:NativeDigest detects which of XMP and Exif was updated more recently and copies metadata in appropriate direction.

References cnvFromXmp(), cnvToXmp(), Exiv2::XmpData::end(), Exiv2::XmpData::findKey(), setErase(), setOverwrite(), and writeExifDigest().

Referenced by Exiv2::syncExifWithXmp().

◆ writeExifDigest()

void Exiv2::Converter::writeExifDigest ( )

Write exif:NativeDigest and tiff:NativeDigest properties to XMP.

Compute digests from Exif values and write them to exif:NativeDigest and tiff:NativeDigest properties. This should be compatible with XMP SDK.

Referenced by syncExifWithXmp().


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