Exiv2: Exiv2::Metadatum Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Examples

- Search for |

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

# Exiv2::Metadatum Class Reference

Abstract base class defining the interface to access information related to one metadata tag. More...

`#include <metadatum.hpp>`

Inheritance diagram for Exiv2::Metadatum:

[legend]

List of all members.

## Public Member Functions
Creators
| Metadatum ()
| Default Constructor.
| Metadatum (const Metadatum &rhs)
| Copy constructor.
virtual | ~Metadatum ()
| Destructor.
Manipulators
virtual void | setValue (const Value *pValue)=0
| Set the value. This method copies (clones) the value pointed to by pValue.
virtual void | setValue (const std::string &buf)=0
| Set the value to the string buf. Uses Value::read(const std::string& buf). If the metadatum does not have a value yet, then one is created. See subclasses for more details.
Accessors
virtual long | copy (byte *buf, ByteOrder byteOrder) const =0
| Write value to a data buffer and return the number of bytes written.
virtual std::string | key () const =0
| Return the key of the metadatum. The key is of the form 'familyName.ifdItem.tagName'. Note however that the key is not necessarily unique, i.e., an ExifData object may contain multiple metadata with the same key.
virtual std::string | tagName () const =0
| Return the name of the tag (which is also the third part of the key).
virtual std::string | tagLabel () const =0
| Return a label for the tag.
virtual uint16_t | tag () const =0
| Return the tag.
virtual TypeId | typeId () const =0
| Return the type id of the value.
virtual const char * | typeName () const =0
| Return the name of the type.
virtual long | typeSize () const =0
| Return the size in bytes of one component of this type.
virtual long | count () const =0
| Return the number of components in the value.
virtual long | size () const =0
| Return the size of the value in bytes.
virtual std::string | toString () const =0
| Return the value as a string.
virtual std::string | toString (long n) const =0
| 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.
virtual long | toLong (long n=0) const =0
| 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.
virtual float | toFloat (long n=0) const =0
| 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.
virtual Rational | toRational (long n=0) const =0
| 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.
virtual Value::AutoPtr | getValue () const =0
| 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.
virtual const Value & | value () const =0
| Return a constant reference to the value.
## Protected Member Functions
Manipulators
Metadatum & | operator= (const Metadatum &rhs)
| Assignment operator. Protected so that it can only be used by subclasses but not directly.

## Detailed Description

Abstract base class defining the interface to access information related to one metadata tag.

## Member Function Documentation

virtual long Exiv2::Metadatum::copy | ( | byte * | buf,
|  | ByteOrder | byteOrder |
| ) |  |  | const`[pure virtual]`

Write value to a data buffer and return the number of bytes written.

The user must ensure that the buffer has enough memory. Otherwise the call results in undefined behaviour.

Parameters:

  | buf | Data buffer to write to.
  | byteOrder | Applicable byte order (little or big endian).

Returns:
  Number of characters written.

Implemented in Exiv2::Exifdatum, Exiv2::Iptcdatum, and Exiv2::Xmpdatum.

virtual Value::AutoPtr Exiv2::Metadatum::getValue | ( |  | ) | const`[pure 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.

Implemented in Exiv2::Exifdatum, Exiv2::Iptcdatum, and Exiv2::Xmpdatum.

virtual const Value& Exiv2::Metadatum::value | ( |  | ) | const`[pure 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.

Implemented in Exiv2::Exifdatum, Exiv2::Iptcdatum, and Exiv2::Xmpdatum.

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

- metadatum.hpp