Loading...
Searching...
No Matches
iptc.hpp
Go to the documentation of this file.
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef IPTC_HPP_
#define IPTC_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "datasets.hpp"
#include "metadatum.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class declarations
class ExifData;
// *****************************************************************************
// class definitions
class EXIV2API Iptcdatum : public Metadatum {
public:
explicit Iptcdatum(const IptcKey& key, const Value* pValue = nullptr);
Iptcdatum(const Iptcdatum& rhs);
~Iptcdatum() override = default;
Iptcdatum& operator=(const Iptcdatum& rhs);
Iptcdatum& operator=(const uint16_t& value);
Iptcdatum& operator=(const std::string& value);
Iptcdatum& operator=(const Value& value);
void setValue(const Value* pValue) override;
int setValue(const std::string& value) override;
size_t copy(byte* buf, ByteOrder byteOrder) const override;
std::ostream& write(std::ostream& os, const ExifData* pMetadata = nullptr) const override;
[[nodiscard]] std::string key() const override;
[[nodiscard]] std::string recordName() const;
[[nodiscard]] uint16_t record() const;
[[nodiscard]] const char* familyName() const override;
[[nodiscard]] std::string groupName() const override;
[[nodiscard]] std::string tagName() const override;
[[nodiscard]] std::string tagLabel() const override;
[[nodiscard]] std::string tagDesc() const override;
[[nodiscard]] uint16_t tag() const override;
[[nodiscard]] TypeId typeId() const override;
[[nodiscard]] const char* typeName() const override;
[[nodiscard]] size_t typeSize() const override;
[[nodiscard]] size_t count() const override;
[[nodiscard]] size_t size() const override;
[[nodiscard]] std::string toString() const override;
[[nodiscard]] std::string toString(size_t n) const override;
[[nodiscard]] int64_t toInt64(size_t n = 0) const override;
[[nodiscard]] float toFloat(size_t n = 0) const override;
[[nodiscard]] Rational toRational(size_t n = 0) const override;
[[nodiscard]] Value::UniquePtr getValue() const override;
[[nodiscard]] const Value& value() const override;
private:
// DATA
IptcKey::UniquePtr key_;
Value::UniquePtr value_;
}; // class Iptcdatum
using IptcMetadata = std::vector<Iptcdatum>;
class EXIV2API IptcData {
public:
using iterator = IptcMetadata::iterator;
using const_iterator = IptcMetadata::const_iterator;
// Use the compiler generated constructors and assignment operator
Iptcdatum& operator[](const std::string& key);
int add(const IptcKey& key, const Value* value);
int add(const Iptcdatum& iptcdatum);
iterator erase(iterator pos);
void clear() {
iptcMetadata_.clear();
}
void sortByKey();
void sortByTag();
iterator begin() {
return iptcMetadata_.begin();
}
iterator end() {
return iptcMetadata_.end();
}
iterator findKey(const IptcKey& key);
iterator findId(uint16_t dataset, uint16_t record = IptcDataSets::application2);
[[nodiscard]] const_iterator begin() const {
return iptcMetadata_.begin();
}
[[nodiscard]] const_iterator end() const {
return iptcMetadata_.end();
}
[[nodiscard]] const_iterator findKey(const IptcKey& key) const;
[[nodiscard]] const_iterator findId(uint16_t dataset, uint16_t record = IptcDataSets::application2) const;
[[nodiscard]] bool empty() const {
return iptcMetadata_.empty();
}
[[nodiscard]] size_t count() const {
return iptcMetadata_.size();
}
[[nodiscard]] size_t size() const;
[[nodiscard]] const char* detectCharset() const;
static void printStructure(std::ostream& out, const Slice<byte*>& bytes, size_t depth);
private:
// DATA
IptcMetadata iptcMetadata_;
}; // class IptcData
class EXIV2API IptcParser {
public:
static int decode(IptcData& iptcData, const byte* pData, size_t size);
static DataBuf encode(const IptcData& iptcData);
private:
// Constant data
static constexpr byte marker_ = 0x1C; // Dataset marker
}; // class IptcParser
} // namespace Exiv2
#endif // #ifndef IPTC_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:379
Exiv2::IptcData
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:153
Exiv2::IptcData::begin
iterator begin()
Begin of the metadata.
Definition iptc.hpp:206
Exiv2::IptcData::begin
const_iterator begin() const
Begin of the metadata.
Definition iptc.hpp:228
Exiv2::IptcData::empty
bool empty() const
Return true if there is no IPTC metadata.
Definition iptc.hpp:246
Exiv2::IptcData::end
const_iterator end() const
End of the metadata.
Definition iptc.hpp:232
Exiv2::IptcData::end
iterator end()
End of the metadata.
Definition iptc.hpp:210
Exiv2::IptcData::const_iterator
IptcMetadata::const_iterator const_iterator
IptcMetadata const iterator type.
Definition iptc.hpp:158
Exiv2::IptcData::iterator
IptcMetadata::iterator iterator
IptcMetadata iterator type.
Definition iptc.hpp:156
Exiv2::IptcData::count
size_t count() const
Get the number of metadata entries.
Definition iptc.hpp:251
Exiv2::IptcData::clear
void clear()
Delete all Iptcdatum instances resulting in an empty container.
Definition iptc.hpp:198
Exiv2::IptcKey
Concrete keys for IPTC metadata.
Definition datasets.hpp:237
Exiv2::IptcKey::UniquePtr
std::unique_ptr< IptcKey > UniquePtr
Shortcut for an IptcKey auto pointer.
Definition datasets.hpp:240
Exiv2::IptcParser
Stateless parser class for IPTC data. Images use this class to decode and encode binary IPTC data.
Definition iptc.hpp:274
Exiv2::Iptcdatum
An IPTC metadatum ("dataset"), consisting of an IptcKey and a Value and methods to manipulate these.
Definition iptc.hpp:33
Exiv2::Iptcdatum::~Iptcdatum
~Iptcdatum() override=default
Destructor.
Exiv2::Metadatum
Abstract base class defining the interface to access information related to one metadata tag.
Definition metadatum.hpp:103
Exiv2::Value
Common interface for all types of values used with metadata.
Definition value.hpp:33
Exiv2::Value::UniquePtr
std::unique_ptr< Value > UniquePtr
Shortcut for a Value auto pointer.
Definition value.hpp:36
Exiv2::Internal::groupName
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition tags_int.cpp:2477
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::Rational
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition types.hpp:31
Exiv2::getValue
T getValue(const byte *buf, ByteOrder byteOrder)
Read a value of type T from the data buffer.
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition types.hpp:70
Exiv2::IptcMetadata
std::vector< Iptcdatum > IptcMetadata
Container type to hold all metadata.
Definition iptc.hpp:141
Exiv2::ByteOrder
ByteOrder
Type to express the byte order (little or big endian)
Definition types.hpp:34
Exiv2::setValue
Exiv2::Exifdatum & setValue(Exiv2::Exifdatum &exifDatum, const T &value)
Set the value of exifDatum to value. If the object already has a value, it is replaced....
Definition exif.cpp:147
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Exiv2::Slice
Slice (= view) for STL containers.
Definition slice.hpp:421