Exiv2: Exiv2::IptcData Class Reference

# Exiv2::IptcData Class Reference

A container for IPTC data. This is a top-level class of the Exiv2 library. More...

`#include <iptc.hpp>`

List of all members.

## Public Types
typedef IptcMetadata::iterator | iterator
| IptcMetadata iterator type.
typedef IptcMetadata::const_iterator | const_iterator
| IptcMetadata const iterator type.
## Public Member Functions
Manipulators
int | load (const byte *buf, long len)
| Load the IPTC data from a byte buffer. The format must follow the IPTC IIM4 standard.
Iptcdatum & | operator[] (const std::string &key)
| Returns a reference to the Iptcdatum that is associated with a particular key. If IptcData does not already contain such an Iptcdatum, operator[] adds object Iptcdatum(key).
int | add (const IptcKey &key, Value *value)
| Add an Iptcdatum from the supplied key and value pair. This method copies (clones) the value. A check for non-repeatable datasets is performed.
int | add (const Iptcdatum &iptcdatum)
| Add a copy of the Iptcdatum to the IPTC metadata. A check for non-repeatable datasets is performed.
iterator | erase (iterator pos)
| Delete the Iptcdatum at iterator position pos, return the position of the next Iptcdatum. Note that iterators into the metadata, including pos, are potentially invalidated by this call.
void | clear ()
| Delete all Iptcdatum instances resulting in an empty container.
void | sortByKey ()
| Sort metadata by key.
void | sortByTag ()
| Sort metadata by tag (aka dataset).
iterator | begin ()
| Begin of the metadata.
iterator | end ()
| End of the metadata.
iterator | findKey (const IptcKey &key)
| Find the first Iptcdatum with the given key, return an iterator to it.
iterator | findId (uint16_t dataset, uint16_t record=IptcDataSets::application2)
| Find the first Iptcdatum with the given record and dataset it, return a const iterator to it.
Accessors
const_iterator | begin () const
| Begin of the metadata.
const_iterator | end () const
| End of the metadata.
DataBuf | copy () const
| Write the IPTC data to a data buffer and return the data buffer. Caller owns this buffer. The copied data follows the IPTC IIM4 standard.
const_iterator | findKey (const IptcKey &key) const
| Find the first Iptcdatum with the given key, return a const iterator to it.
const_iterator | findId (uint16_t dataset, uint16_t record=IptcDataSets::application2) const
| Find the first Iptcdatum with the given record and dataset number, return a const iterator to it.
bool | empty () const
| Return true if there is no IPTC metadata.
long | count () const
| Get the number of metadata entries.
long | size () const
| Return the exact size of all contained IPTC metadata.

## Detailed Description

A container for IPTC data. This is a top-level class of the Exiv2 library.

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

- read IPTC information from JPEG files
- access metadata through keys and standard C++ iterators
- add, modify and delete metadata
- write IPTC data to JPEG files
- extract IPTC metadata to files, insert from these files

Examples:

  iptceasy.cpp, and iptcprint.cpp.

## Member Function Documentation

int Exiv2::IptcData::load | ( | const byte * | buf,
|  | long | len |
| ) |  |  |

Load the IPTC data from a byte buffer. The format must follow the IPTC IIM4 standard.

Parameters:

  | buf | Pointer to the data buffer to read from
  | len | Number of bytes in the data buffer

Returns:
  0 if successful;
  5 if IPTC data is invalid or corrupt;

Iptcdatum& Exiv2::IptcData::operator[] | ( | const std::string & | key | ) |

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

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

int Exiv2::IptcData::add | ( | const IptcKey & | key,
|  | Value * | value |
| ) |  |  |

Add an Iptcdatum from the supplied key and value pair. This method copies (clones) the value. A check for non-repeatable datasets is performed.

Returns:
  0 if successful;
  6 if the dataset already exists and is not repeatable

int Exiv2::IptcData::add | ( | const Iptcdatum & | iptcdatum | ) |

Add a copy of the Iptcdatum to the IPTC metadata. A check for non-repeatable datasets is performed.

Returns:
  0 if successful;
  6 if the dataset already exists and is not repeatable;

DataBuf Exiv2::IptcData::copy | ( |  | ) | const

Write the IPTC data to a data buffer and return the data buffer. Caller owns this buffer. The copied data follows the IPTC IIM4 standard.

Returns:
  Data buffer containing the IPTC data.

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

- iptc.hpp