metadatum.hpp
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#ifndef METADATUM_HPP_
#define METADATUM_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "value.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class declarations
class ExifData;
// *****************************************************************************
// class definitions
class EXIV2API Key {
public:
typedef std::auto_ptr<Key> AutoPtr;
virtual ~Key();
virtual std::string key() const =0;
virtual const char* familyName() const =0;
virtual std::string groupName() const =0;
virtual std::string tagName() const =0;
virtual std::string tagLabel() const =0;
virtual uint16_t tag() const =0;
AutoPtr clone() const;
std::ostream& write(std::ostream& os) const { return os << key(); }
protected:
Key& operator=(const Key& rhs);
private:
virtual Key* clone_() const =0;
}; // class Key
inline std::ostream& operator<<(std::ostream& os, const Key& key)
{
return key.write(os);
}
class EXIV2API Metadatum {
public:
Metadatum();
Metadatum(const Metadatum& rhs);
virtual ~Metadatum();
virtual void setValue(const Value* pValue) =0;
virtual int setValue(const std::string& buf) =0;
std::string print(const ExifData* pMetadata =0) const;
virtual long copy(byte* buf, ByteOrder byteOrder) const =0;
virtual std::ostream& write(
std::ostream& os,
const ExifData* pMetadata =0
) const =0;
virtual std::string key() const =0;
virtual const char* familyName() const =0;
virtual std::string groupName() const =0;
virtual std::string tagName() const =0;
virtual std::string tagLabel() const =0;
virtual uint16_t tag() const =0;
virtual TypeId typeId() const =0;
virtual const char* typeName() const =0;
virtual long typeSize() const =0;
virtual long count() const =0;
virtual long size() const =0;
virtual std::string toString() const =0;
virtual std::string toString(long n) const =0;
virtual long toLong(long n =0) const =0;
virtual float toFloat(long n =0) const =0;
virtual Rational toRational(long n =0) const =0;
virtual Value::AutoPtr getValue() const =0;
virtual const Value& value() const =0;
protected:
Metadatum& operator=(const Metadatum& rhs);
}; // class Metadatum
inline std::ostream& operator<<(std::ostream& os, const Metadatum& md)
{
return md.write(os);
}
EXIV2API bool cmpMetadataByTag(const Metadatum& lhs, const Metadatum& rhs);
EXIV2API bool cmpMetadataByKey(const Metadatum& lhs, const Metadatum& rhs);
} // namespace Exiv2
#endif // #ifndef METADATUM_HPP_
Exiv2::ExifData
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
Exiv2::Key
Abstract base class defining the Key of a metadatum. Keys are used to identify and group metadata.
Definition: metadatum.hpp:44
Exiv2::Key::groupName
virtual std::string groupName() const =0
Return the name of the group (the second part of the key)
Exiv2::Key::key
virtual std::string key() const =0
Return the key of the metadatum as a string. The key is of the form 'familyName.groupName....
Exiv2::Key::write
std::ostream & write(std::ostream &os) const
Write the key to an output stream. You do not usually have to use this function; it is used for the i...
Definition: metadatum.hpp:86
Exiv2::Key::tagLabel
virtual std::string tagLabel() const =0
Return a label for the tag.
Exiv2::Key::tag
virtual uint16_t tag() const =0
Return the tag number.
Exiv2::Key::AutoPtr
std::auto_ptr< Key > AutoPtr
Shortcut for a Key auto pointer.
Definition: metadatum.hpp:47
Exiv2::Key::familyName
virtual const char * familyName() const =0
Return an identifier for the type of metadata (the first part of the key)
Exiv2::Key::tagName
virtual std::string tagName() const =0
Return the name of the tag (which is also the third part of the key)
Exiv2::Metadatum
Abstract base class defining the interface to access information related to one metadata tag.
Definition: metadatum.hpp:115
Exiv2::Metadatum::size
virtual long size() const =0
Return the size of the value in bytes.
Exiv2::Metadatum::typeId
virtual TypeId typeId() const =0
Return the type id of the value.
Exiv2::Metadatum::typeSize
virtual long typeSize() const =0
Return the size in bytes of one component of this type.
Exiv2::Metadatum::getValue
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 ...
Exiv2::Metadatum::setValue
virtual int 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 ...
Exiv2::Metadatum::copy
virtual long copy(byte *buf, ByteOrder byteOrder) const =0
Write value to a data buffer and return the number of bytes written.
Exiv2::Metadatum::toString
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 undefine...
Exiv2::Metadatum::tag
virtual uint16_t tag() const =0
Return the tag.
Exiv2::Metadatum::tagLabel
virtual std::string tagLabel() const =0
Return a label for the tag.
Exiv2::Metadatum::write
virtual std::ostream & write(std::ostream &os, const ExifData *pMetadata=0) const =0
Write the interpreted value to an output stream, return the stream.
Exiv2::Metadatum::toLong
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 ...
Exiv2::Metadatum::value
virtual const Value & value() const =0
Return a constant reference to the value.
Exiv2::Metadatum::count
virtual long count() const =0
Return the number of components in the value.
Exiv2::Metadatum::tagName
virtual std::string tagName() const =0
Return the name of the tag (which is also the third part of the key)
Exiv2::Metadatum::familyName
virtual const char * familyName() const =0
Return the name of the metadata family (which is also the first part of the key)
Exiv2::Metadatum::toString
virtual std::string toString() const =0
Return the value as a string.
Exiv2::Metadatum::groupName
virtual std::string groupName() const =0
Return the name of the metadata group (which is also the second part of the key)
Exiv2::Metadatum::toFloat
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...
Exiv2::Metadatum::typeName
virtual const char * typeName() const =0
Return the name of the type.
Exiv2::Metadatum::toRational
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 i...
Exiv2::Metadatum::setValue
virtual void setValue(const Value *pValue)=0
Set the value. This method copies (clones) the value pointed to by pValue.
Exiv2::Metadatum::key
virtual std::string key() const =0
Return the key of the metadatum. The key is of the form 'familyName.groupName.tagName'....
Exiv2::Value
Common interface for all types of values used with metadata.
Definition: value.hpp:51
Exiv2::Value::AutoPtr
std::auto_ptr< Value > AutoPtr
Shortcut for a Value auto pointer.
Definition: value.hpp:54
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2::operator<<
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition: datasets.cpp:709
Exiv2::cmpMetadataByTag
EXIV2API bool cmpMetadataByTag(const Metadatum &lhs, const Metadatum &rhs)
Compare two metadata by tag. Return true if the tag of metadatum lhs is less than that of rhs.
Definition: metadatum.cpp:71
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:119
Exiv2::ByteOrder
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:102
Exiv2::Rational
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition: types.hpp:99
Exiv2::cmpMetadataByKey
EXIV2API bool cmpMetadataByKey(const Metadatum &lhs, const Metadatum &rhs)
Compare two metadata by key. Return true if the key of metadatum lhs is less than that of rhs.
Definition: metadatum.cpp:77