Exiv2: Exiv2::XmpParser Class Reference

# Exiv2::XmpParser Class Reference

Stateless parser class for XMP packets. Images use this class to parse and serialize XMP packets. The parser uses the XMP toolkit to do the job. More...

`#include <xmp.hpp>`

List of all members.

## Static Public Member Functions
static int | decode (XmpData &xmpData, const std::string &xmpPacket)
| Decode XMP metadata from an XMP packet xmpPacket into xmpData. The format of the XMP packet must follow the XMP specification. This method clears any previous contents of xmpData.
static int | encode (std::string &xmpPacket, const XmpData &xmpData)
| Encode (serialize) XMP metadata from xmpData into a string xmpPacket. The XMP packet returned in the string follows the XMP specification. This method only modifies xmpPacket if the operations succeeds (return code 0).
static bool | initialize ()
| Initialize the XMP Toolkit.
static void | terminate ()
| Terminate the XMP Toolkit.
## Friends
void | XmpProperties::registerNs (const std::string &, const std::string &)

## Detailed Description

Stateless parser class for XMP packets. Images use this class to parse and serialize XMP packets. The parser uses the XMP toolkit to do the job.

## Member Function Documentation

int Exiv2::XmpParser::decode | ( | XmpData & | xmpData,
|  | const std::string & | xmpPacket |
| ) |  |  | `[static]`

Decode XMP metadata from an XMP packet xmpPacket into xmpData. The format of the XMP packet must follow the XMP specification. This method clears any previous contents of xmpData.

Parameters:

  | xmpData | Container for the decoded XMP properties
  | xmpPacket | The raw XMP packet to decode

Returns:
  0 if successful;
  1 if XMP support has not been compiled-in;
  2 if the XMP toolkit failed to initialize;
  3 if the XMP toolkit failed and raised an XMP_Error

References Exiv2::XmpData::add(), Exiv2::XmpData::clear(), initialize(), Exiv2::XmpProperties::prefix(), and Exiv2::XmpProperties::registerNs().

int Exiv2::XmpParser::encode | ( | std::string & | xmpPacket,
|  | const XmpData & | xmpData |
| ) |  |  | `[static]`

Encode (serialize) XMP metadata from xmpData into a string xmpPacket. The XMP packet returned in the string follows the XMP specification. This method only modifies xmpPacket if the operations succeeds (return code 0).

Parameters:

  | xmpPacket | Reference to a string to hold the encoded XMP packet.
  | xmpData | XMP properties to encode.

Returns:
  0 if successful;
  1 if XMP support has not been compiled-in;
  2 if the XMP toolkit failed to initialize;
  3 if the XMP toolkit failed and raised an XMP_Error

Examples:
  xmpsample.cpp.

References Exiv2::XmpData::begin(), Exiv2::XmpData::empty(), Exiv2::XmpData::end(), initialize(), Exiv2::XmpProperties::ns(), Exiv2::toString(), Exiv2::TypeInfo::typeName(), Exiv2::LangAltValue::value_, Exiv2::XmpValue::xmpArrayType(), and Exiv2::XmpValue::xmpStruct().

bool Exiv2::XmpParser::initialize | ( |  | ) | `[static]`

Initialize the XMP Toolkit.

Calling this method is usually not needed, as encode() and decode() will initialize the XMP Toolkit if necessary.

Returns:
  True if the initialization was successful, else false.

Referenced by decode(), and encode().

void Exiv2::XmpParser::terminate | ( |  | ) | `[static]`

Terminate the XMP Toolkit.

Call this method when the XmpParser is no longer needed to allow the XMP Toolkit to cleanly shutdown.

Examples:
  xmpsample.cpp.

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

- xmp.hpp
- xmp.cpp