Loading...
Searching...
No Matches
Exiv2::Converter Class Reference

Metadata conversions. More...

## Classes

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

## Public Types

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

## Public Member Functions

Creators
| Converter (ExifData &exifData, XmpData &xmpData)
| Constructor for Exif tags and XMP properties.
| Converter (IptcData &iptcData, XmpData &xmpData, const char *iptcCharset=nullptr)
| 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.
void | setOverwrite (bool onoff=true)
| Set the overwrite flag.
Conversion functions (manipulators)
void | cnvNone (const char *, const char *)
| Do nothing conversion function.
void | cnvExifValue (const char *from, const char *to)
| Simple Exif to XMP conversion function.
void | cnvExifComment (const char *from, const char *to)
| Convert the tag Exif.Photo.UserComment to XMP.
void | cnvExifArray (const char *from, const char *to)
| Converts Exif tag with multiple components to XMP array.
void | cnvExifDate (const char *from, const char *to)
| Exif date to XMP conversion function.
void | cnvExifVersion (const char *from, const char *to)
| Exif version to XMP conversion function.
void | cnvExifGPSVersion (const char *from, const char *to)
| Exif GPS version to XMP conversion function.
void | cnvExifFlash (const char *from, const char *to)
| Exif Flash to XMP conversion function.
void | cnvExifGPSCoord (const char *from, const char *to)
| Exif GPS coordinate to XMP conversion function.
void | cnvXmpValue (const char *from, const char *to)
| Simple XMP to Exif conversion function.
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.
void | cnvXmpDate (const char *from, const char *to)
| XMP to Exif date conversion function.
void | cnvXmpVersion (const char *from, const char *to)
| XMP to Exif version conversion function.
void | cnvXmpGPSVersion (const char *from, const char *to)
| XMP to Exif GPS version conversion function.
void | cnvXmpFlash (const char *from, const char *to)
| XMP to Exif Flash conversion function.
void | cnvXmpGPSCoord (const char *from, const char *to)
| XMP to Exif GPS coordinate conversion function.
void | cnvIptcValue (const char *from, const char *to)
| IPTC dataset to XMP conversion function.
void | cnvXmpValueToIptc (const char *from, const char *to)
| XMP to IPTC dataset conversion function.
void | writeExifDigest ()
| Write exif:NativeDigest and tiff:NativeDigest properties to XMP.
void | syncExifWithXmp ()
| Copies metadata in appropriate direction.

## Accessors

bool | erase () const
| Get the value of the erase flag, see also setErase(bool on).

## Detailed Description

Metadata conversions.

## Member Typedef Documentation

## ConvertFct

using Exiv2::Converter::ConvertFct = void (Converter::*)(const char*, const char*)

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, and Exiv2::ExifData::findKey().

## 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, and Exiv2::ExifData::findKey().

## 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, and Exiv2::ExifData::findKey().

## 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, and Exiv2::ExifData::findKey().

## 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, and Exiv2::IptcData::findKey().

## 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, and Exiv2::XmpData::findKey().

## 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, and Exiv2::XmpData::findKey().

## 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, and Exiv2::XmpData::findKey().

## 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(), and Exiv2::floatToRationalCast().

## 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, and Exiv2::XmpData::findKey().

## 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(), and Exiv2::Exifdatum::setValue.

## 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, 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, and Exiv2::XmpData::findKey().

## 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:

- convert.cpp