exiv2._metadatum
Exiv2 metadatum base class.
Classes


Abstract base class defining the |
|
Abstract base class defining the interface to access information related to one metadata tag. |
- class Key
Bases:
SwigPyObjectAbstract base class defining the
Keyof a metadatum. Keys are used to identify and group metadata.- clone()
Return an auto-pointer to a copy of itself (deep copy). The caller owns this copy and the auto-pointer ensures that it will be deleted.
- familyName()
Return an identifier for the type of metadata (the first part of the key)
- groupName()
Return the name of the group (the second part of the key)
- key()
Return the key of the metadatum as a string. The key is of the form ‘familyName.groupName.tagName’. Note however that the key is not necessarily unique, e.g., an ExifData may contain multiple metadata with the same key.
- tag()
Return the tag number
- tagDesc()
Return a description for the tag
- tagLabel()
Return a label for the tag
- tagName()
Return the name of the tag (which is also the third part of the key)
- write()
Write the key to an output stream. You do not usually have to use this function; it is used for the implementation of the output operator for
Key, operator<<(std::ostream &os, const Key &key).
- class Metadatum
Bases:
SwigPyObjectAbstract base class defining the interface to access information related to one metadata tag.
- copy()
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 (writeable bytes-like object) – Data buffer to write to.
byteOrder (
ByteOrder) – Applicable byte order (little or big endian).
- Return type:
- Returns:
Number of characters written.
- count()
Return the number of components in the value
- familyName()
Return the name of the metadata family (which is also the first part of the key)
- getValue()
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.
- Return type:
- Returns:
An auto-pointer containing a pointer to a copy (clone) of the value, 0 if the value is not set.
- groupName()
Return the name of the metadata group (which is also the second part of the key)
- key()
Return the key of the metadatum. The key is of the form ‘familyName.groupName.tagName’. Note however that the key is not necessarily unique, e.g., an ExifData object may contain multiple metadata with the same key.
- print()
Write the interpreted value to a string.
Implemented in terms of write(), see there.
- setValue()
Overload 1:
Set the value. This method copies (clones) the value pointed to by pValue.
Overload 2:
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. Return 0 if the value was read successfully.
- size()
Return the size of the value in bytes
- tag()
Return the tag
- tagDesc()
Return a description for the tag
- tagLabel()
Return a label for the tag
- tagName()
Return the name of the tag (which is also the third part of the key)
- toFloat()
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.
- toInt64()
Return the n-th component of the value converted to int64_t. 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.
- toRational()
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.
- toString()
Overload 1:
Return the value as a string.
Overload 2:
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.
- toUint32()
Return the n-th component of the value converted to uint32_t.
- typeId()
Return the type id of the value
- typeName()
Return the name of the type
- typeSize()
Return the size in bytes of one component of this type
- value()
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. An Error is thrown if the value is not set; as an alternative to catching it, one can use count() to check if there is any data before calling this method.
- Return type:
- Returns:
A constant reference to the value.
- Raises:
Exiv2Errorif the value is not set.
- write()
Write the interpreted value to an output stream, return the stream.
The method takes an optional pointer to a metadata container. Pretty-print functions may use that to refer to other metadata as it is sometimes not sufficient to know only the value of the metadatum that should be interpreted. Thus, it is advisable to always call this method with a pointer to the metadata container if possible.
This functionality is currently only implemented for Exif tags. The pointer is ignored when used to write IPTC datasets or XMP properties.
Without the optional metadata pointer, you do not usually have to use this function; it is used for the implementation of the output operator for
Metadatum, operator<<(std::ostream &os, const Metadatum &md).See also print(), which prints the interpreted value to a string.