Exiv2: Exiv2::Xmpdatum Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exiv2::Xmpdatum Class Reference

Information related to an XMP property. An XMP metadatum consists of an XmpKey and a Value and provides methods to manipulate these. More...

`#include <xmp.hpp>`

Inheritance diagram for Exiv2::Xmpdatum:

[legend]
Collaboration diagram for Exiv2::Xmpdatum:

[legend]

List of all members.

## Public Member Functions
Creators
| Xmpdatum (const XmpKey &key, const Value *pValue=0)
| Constructor for new tags created by an application. The Xmpdatum is created from a key / value pair. Xmpdatum copies (clones) the value if one is provided. Alternatively, a program can create an 'empty' Xmpdatum with only a key and set the value using setValue().
| Xmpdatum (const Xmpdatum &rhs)
| Copy constructor.
virtual | ~Xmpdatum ()
| Destructor.
Manipulators
Xmpdatum & | operator= (const Xmpdatum &rhs)
| Assignment operator.
Xmpdatum & | operator= (const std::string &value)
| Assign std::string value to the Xmpdatum. Calls setValue(const std::string&).
Xmpdatum & | operator= (const char *value)
| Assign const char* value to the Xmpdatum. Calls operator=(const std::string&).
Xmpdatum & | operator= (const bool &value)
| Assign a boolean value to the Xmpdatum. Translates the value to a string "true" or "false".
template<typename T>
Xmpdatum & | operator= (const T &value)
| Assign a value of any type with an output operator to the Xmpdatum. Calls operator=(const std::string&).
Xmpdatum & | operator= (const Value &value)
| Assign Value value to the Xmpdatum. Calls setValue(const Value*).
void | setValue (const Value *pValue)
| Set the value. This method copies (clones) the value pointed to by pValue.
void | setValue (const std::string &value)
| Set the value to the string value. Uses Value::read(const std::string&). If the Xmpdatum does not have a Value yet, then a Value of the correct type for this Xmpdatum is created. If the key is unknown, a XmpTextValue is used as default.
Accessors
long | copy (byte *buf, ByteOrder byteOrder) const
| Not implemented. Calling this method will raise an exception.
std::string | key () const
| Return the key of the Xmpdatum. The key is of the form 'Xmp.prefix.property'. Note however that the key is not necessarily unique, i.e., an XmpData object may contain multiple metadata with the same key.
std::string | groupName () const
| Return the (preferred) schema namespace prefix.
std::string | tagName () const
| Return the property name.
std::string | tagLabel () const
| Return a label for the tag.
uint16_t | tag () const
| Properties don't have a tag number. Return 0.
TypeId | typeId () const
| Return the type id of the value.
const char * | typeName () const
| Return the name of the type.
long | typeSize () const
| The Exif typeSize doesn't make sense here. Return 0.
long | count () const
| Return the number of components in the value.
long | size () const
| Return the size of the value in bytes.
std::string | toString () const
| Return the value as a string.
std::string | toString (long n) const
| Return the n-th component of the value converted to a string. The behaviour of the method is undefined if there is no n-th component.
long | toLong (long n=0) const
| Return the n-th component of the value converted to long. The return value is -1 if the value is not set and the behaviour of the method is undefined if there is no n-th component.
float | toFloat (long n=0) const
| Return the n-th component of the value converted to float. The return value is -1 if the value is not set and the behaviour of the method is undefined if there is no n-th component.
Rational | toRational (long n=0) const
| Return the n-th component of the value converted to Rational. The return value is -1/1 if the value is not set and the behaviour of the method is undefined if there is no n-th component.
Value::AutoPtr | getValue () const
| Return an auto-pointer to a copy (clone) of the value. The caller owns this copy and the auto-poiner ensures that it will be deleted.
const Value & | value () const
| Return a constant reference to the value.
## Classes
struct | Impl
| Internal Pimpl structure of class Xmpdatum. More...

## Detailed Description

Information related to an XMP property. An XMP metadatum consists of an XmpKey and a Value and provides methods to manipulate these.

## Constructor & Destructor Documentation

Exiv2::Xmpdatum::Xmpdatum | ( | const XmpKey & | key,
|  | const Value * | pValue = `0` |
| ) |  |  | `[explicit]`

Constructor for new tags created by an application. The Xmpdatum is created from a key / value pair. Xmpdatum copies (clones) the value if one is provided. Alternatively, a program can create an 'empty' Xmpdatum with only a key and set the value using setValue().

Parameters:

  | key | The key of the Xmpdatum.
  | pValue | Pointer to a Xmpdatum value.

Exceptions:

  | Error | if the key cannot be parsed and converted to a known schema namespace prefix and property name.

## Member Function Documentation

Value::AutoPtr Exiv2::Xmpdatum::getValue | ( |  | ) | const`[virtual]`

Return an auto-pointer to a copy (clone) of the value. The caller owns this copy and the auto-poiner ensures that it will be deleted.

This method is provided for users who need full control over the value. A caller may, e.g., downcast the pointer to the appropriate subclass of Value to make use of the interface of the subclass to set or modify its contents.

Returns:
  An auto-pointer containing a pointer to a copy (clone) of the value, 0 if the value is not set.

Implements Exiv2::Metadatum.

const Value & Exiv2::Xmpdatum::value | ( |  | ) | const`[virtual]`

Return a constant reference to the value.

This method is provided mostly for convenient and versatile output of the value which can (to some extent) be formatted through standard stream manipulators. Do not attempt to write to the value through this reference.

Example:

              ExifData::const_iterator i = exifData.findKey(key);
              if (i != exifData.end()) {
                  std::cout << i->key() << " " << std::hex << i->value() << "\n";
              }

Returns:
  A constant reference to the value.

Exceptions:

  | Error | if the value is not set.

Implements Exiv2::Metadatum.

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

- xmp.hpp
- xmp.cpp