Exiv2::ExifData Class Reference

A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifdatum objects. More...

#include <exif.hpp>

Public Types

using iterator = ExifMetadata::iterator
 ExifMetadata iterator type.
 
using const_iterator = ExifMetadata::const_iterator
 ExifMetadata const iterator type.
 

Public Member Functions

Manipulators
Exifdatumoperator[] (const std::string &key)
 Returns a reference to the Exifdatum that is associated with a particular key. If ExifData does not already contain such an Exifdatum, operator[] adds object Exifdatum(key). More...
 
void add (const ExifKey &key, const Value *pValue)
 Add an Exifdatum from the supplied key and value pair. This method copies (clones) key and value. No duplicate checks are performed, i.e., it is possible to add multiple metadata with the same key.
 
void add (const Exifdatum &exifdatum)
 Add a copy of the exifdatum to the Exif metadata. No duplicate checks are performed, i.e., it is possible to add multiple metadata with the same key. More...
 
iterator erase (iterator pos)
 Delete the Exifdatum at iterator position pos, return the position of the next exifdatum. Note that iterators into the metadata, including pos, are potentially invalidated by this call.
 
iterator erase (iterator beg, iterator end)
 Remove all elements of the range beg, end, return the position of the next element. Note that iterators into the metadata are potentially invalidated by this call.
 
void clear ()
 Delete all Exifdatum instances resulting in an empty container. Note that this also removes thumbnails.
 
void sortByKey ()
 Sort metadata by key.
 
void sortByTag ()
 Sort metadata by tag.
 
iterator begin ()
 Begin of the metadata.
 
iterator end ()
 End of the metadata.
 
iterator findKey (const ExifKey &key)
 Find the first Exifdatum with the given key, return an iterator to it.
 

Accessors

const_iterator begin () const
 Begin of the metadata.
 
const_iterator end () const
 End of the metadata.
 
const_iterator findKey (const ExifKey &key) const
 Find the first Exifdatum with the given key, return a const iterator to it.
 
bool empty () const
 Return true if there is no Exif metadata.
 
size_t count () const
 Get the number of metadata entries.
 

Detailed Description

A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifdatum objects.

Provide high-level access to the Exif data of an image:

  • read Exif information from JPEG files
  • access metadata through keys and standard C++ iterators
  • add, modify and delete metadata
  • write Exif data to JPEG files
  • extract Exif metadata to files, insert from these files
  • extract and delete Exif thumbnail (JPEG and TIFF thumbnails)
Examples
addmoddel.cpp, exifcomment.cpp, exifdata.cpp, exifprint.cpp, exifvalue.cpp, geotag.cpp, and mrwthumb.cpp.

Member Function Documentation

◆ add()

void Exiv2::ExifData::add ( const Exifdatum exifdatum)

Add a copy of the exifdatum to the Exif metadata. No duplicate checks are performed, i.e., it is possible to add multiple metadata with the same key.

Exceptions
Errorif the makernote cannot be created

◆ operator[]()

Exifdatum& Exiv2::ExifData::operator[] ( const std::string &  key)

Returns a reference to the Exifdatum that is associated with a particular key. If ExifData does not already contain such an Exifdatum, operator[] adds object Exifdatum(key).

Note
Since operator[] might insert a new element, it can't be a const member function.

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