Loading...
Searching...
No Matches
datasets.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef DATASETS_HPP_
#define DATASETS_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "metadatum.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
struct EXIV2API RecordInfo {
uint16_t recordId_;
const char* name_;
const char* desc_;
};
struct EXIV2API DataSet {
uint16_t number_;
const char* name_;
const char* title_;
const char* desc_;
bool mandatory_;
bool repeatable_;
uint32_t minbytes_;
uint32_t maxbytes_;
TypeId type_;
uint16_t recordId_;
const char* photoshop_;
};
class EXIV2API IptcDataSets {
public:
static constexpr uint16_t invalidRecord = 0;
static constexpr uint16_t envelope = 1;
static constexpr uint16_t application2 = 2;
static constexpr uint16_t ModelVersion = 0;
static constexpr uint16_t Destination = 5;
static constexpr uint16_t FileFormat = 20;
static constexpr uint16_t FileVersion = 22;
static constexpr uint16_t ServiceId = 30;
static constexpr uint16_t EnvelopeNumber = 40;
static constexpr uint16_t ProductId = 50;
static constexpr uint16_t EnvelopePriority = 60;
static constexpr uint16_t DateSent = 70;
static constexpr uint16_t TimeSent = 80;
static constexpr uint16_t CharacterSet = 90;
static constexpr uint16_t UNO = 100;
static constexpr uint16_t ARMId = 120;
static constexpr uint16_t ARMVersion = 122;
static constexpr uint16_t RecordVersion = 0;
static constexpr uint16_t ObjectType = 3;
static constexpr uint16_t ObjectAttribute = 4;
static constexpr uint16_t ObjectName = 5;
static constexpr uint16_t EditStatus = 7;
static constexpr uint16_t EditorialUpdate = 8;
static constexpr uint16_t Urgency = 10;
static constexpr uint16_t Subject = 12;
static constexpr uint16_t Category = 15;
static constexpr uint16_t SuppCategory = 20;
static constexpr uint16_t FixtureId = 22;
static constexpr uint16_t Keywords = 25;
static constexpr uint16_t LocationCode = 26;
static constexpr uint16_t LocationName = 27;
static constexpr uint16_t ReleaseDate = 30;
static constexpr uint16_t ReleaseTime = 35;
static constexpr uint16_t ExpirationDate = 37;
static constexpr uint16_t ExpirationTime = 38;
static constexpr uint16_t SpecialInstructions = 40;
static constexpr uint16_t ActionAdvised = 42;
static constexpr uint16_t ReferenceService = 45;
static constexpr uint16_t ReferenceDate = 47;
static constexpr uint16_t ReferenceNumber = 50;
static constexpr uint16_t DateCreated = 55;
static constexpr uint16_t TimeCreated = 60;
static constexpr uint16_t DigitizationDate = 62;
static constexpr uint16_t DigitizationTime = 63;
static constexpr uint16_t Program = 65;
static constexpr uint16_t ProgramVersion = 70;
static constexpr uint16_t ObjectCycle = 75;
static constexpr uint16_t Byline = 80;
static constexpr uint16_t BylineTitle = 85;
static constexpr uint16_t City = 90;
static constexpr uint16_t SubLocation = 92;
static constexpr uint16_t ProvinceState = 95;
static constexpr uint16_t CountryCode = 100;
static constexpr uint16_t CountryName = 101;
static constexpr uint16_t TransmissionReference = 103;
static constexpr uint16_t Headline = 105;
static constexpr uint16_t Credit = 110;
static constexpr uint16_t Source = 115;
static constexpr uint16_t Copyright = 116;
static constexpr uint16_t Contact = 118;
static constexpr uint16_t Caption = 120;
static constexpr uint16_t Writer = 122;
static constexpr uint16_t RasterizedCaption = 125;
static constexpr uint16_t ImageType = 130;
static constexpr uint16_t ImageOrientation = 131;
static constexpr uint16_t Language = 135;
static constexpr uint16_t AudioType = 150;
static constexpr uint16_t AudioRate = 151;
static constexpr uint16_t AudioResolution = 152;
static constexpr uint16_t AudioDuration = 153;
static constexpr uint16_t AudioOutcue = 154;
static constexpr uint16_t PreviewFormat = 200;
static constexpr uint16_t PreviewVersion = 201;
static constexpr uint16_t Preview = 202;
static std::string dataSetName(uint16_t number, uint16_t recordId);
static const char* dataSetTitle(uint16_t number, uint16_t recordId);
static const char* dataSetDesc(uint16_t number, uint16_t recordId);
static const char* dataSetPsName(uint16_t number, uint16_t recordId);
static bool dataSetRepeatable(uint16_t number, uint16_t recordId);
static uint16_t dataSet(const std::string& dataSetName, uint16_t recordId);
static TypeId dataSetType(uint16_t number, uint16_t recordId);
static std::string recordName(uint16_t recordId);
static const char* recordDesc(uint16_t recordId);
static uint16_t recordId(const std::string& recordName);
static const DataSet* envelopeRecordList();
static const DataSet* application2RecordList();
static void dataSetList(std::ostream& os);
private:
static int dataSetIdx(uint16_t number, uint16_t recordId);
static int dataSetIdx(const std::string& dataSetName, uint16_t recordId);
static const DataSet* const records_[];
}; // class IptcDataSets
class EXIV2API IptcKey : public Key {
public:
using UniquePtr = std::unique_ptr<IptcKey>;
explicit IptcKey(std::string key);
IptcKey(uint16_t tag, uint16_t record);
[[nodiscard]] std::string key() const override;
[[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]] UniquePtr clone() const;
[[nodiscard]] std::string recordName() const;
[[nodiscard]] uint16_t record() const;
protected:
void makeKey();
void decomposeKey();
private:
[[nodiscard]] IptcKey* clone_() const override;
uint16_t tag_;
uint16_t record_;
std::string key_;
}; // class IptcKey
using Dictionary = std::map<std::string, std::string>;
// *****************************************************************************
// free functions
EXIV2API std::ostream& operator<<(std::ostream& os, const DataSet& dataSet);
} // namespace Exiv2
#endif // #ifndef DATASETS_HPP_
Exiv2::IptcDataSets
IPTC dataset reference, implemented as a static class.
Definition datasets.hpp:45
Exiv2::IptcDataSets::dataSetList
static void dataSetList(std::ostream &os)
Print a list of all dataSets to output stream.
Definition datasets.cpp:492
Exiv2::IptcDataSets::envelopeRecordList
static const DataSet * envelopeRecordList()
Return read-only list of built-in Envelope Record datasets.
Definition datasets.cpp:361
Exiv2::IptcDataSets::recordId
static uint16_t recordId(const std::string &recordName)
Return the Id number of a record.
Definition datasets.cpp:477
Exiv2::IptcDataSets::recordName
static std::string recordName(uint16_t recordId)
Return the name of the Record.
Definition datasets.cpp:460
Exiv2::IptcDataSets::recordDesc
static const char * recordDesc(uint16_t recordId)
Return the description of a record.
Definition datasets.cpp:470
Exiv2::IptcDataSets::dataSetPsName
static const char * dataSetPsName(uint16_t number, uint16_t recordId)
Return the Photoshop name of a given dataset.
Definition datasets.cpp:432
Exiv2::IptcDataSets::application2RecordList
static const DataSet * application2RecordList()
Return read-only list of built-in Application2 Record datasets.
Definition datasets.cpp:365
Exiv2::IptcDataSets::dataSetType
static TypeId dataSetType(uint16_t number, uint16_t recordId)
Return the type for dataSet number and Record id.
Definition datasets.cpp:402
Exiv2::IptcDataSets::dataSetDesc
static const char * dataSetDesc(uint16_t number, uint16_t recordId)
Return the description of the dataset.
Definition datasets.cpp:425
Exiv2::IptcDataSets::dataSetName
static std::string dataSetName(uint16_t number, uint16_t recordId)
Return the name of the dataset.
Definition datasets.cpp:409
Exiv2::IptcDataSets::dataSetTitle
static const char * dataSetTitle(uint16_t number, uint16_t recordId)
Return the title (label) of the dataset.
Definition datasets.cpp:418
Exiv2::IptcDataSets::dataSet
static uint16_t dataSet(const std::string &dataSetName, uint16_t recordId)
Return the dataSet number for dataset name and record id.
Definition datasets.cpp:446
Exiv2::IptcDataSets::dataSetRepeatable
static bool dataSetRepeatable(uint16_t number, uint16_t recordId)
Check if a given dataset is repeatable.
Definition datasets.cpp:439
Exiv2::IptcKey::recordName
std::string recordName() const
Return the name of the record.
Definition datasets.cpp:536
Exiv2::IptcKey::tag
uint16_t tag() const override
Return the tag number.
Definition datasets.cpp:532
Exiv2::IptcKey::tagName
std::string tagName() const override
Return the name of the tag (which is also the third part of the key).
Definition datasets.cpp:520
Exiv2::IptcKey::record
uint16_t record() const
Return the record id.
Definition datasets.cpp:540
Exiv2::IptcKey::IptcKey
IptcKey(std::string key)
Constructor to create an IPTC key from a key string.
Definition datasets.cpp:500
Exiv2::IptcKey::key
std::string key() const override
Return the key of the metadatum as a string. The key is of the form 'familyName.groupName....
Definition datasets.cpp:508
Exiv2::IptcKey::decomposeKey
void decomposeKey()
Parse and convert the key string into dataset and record id. Updates data members if the string can b...
Definition datasets.cpp:552
Exiv2::IptcKey::UniquePtr
std::unique_ptr< IptcKey > UniquePtr
Shortcut for an IptcKey auto pointer.
Definition datasets.hpp:240
Exiv2::IptcKey::tagDesc
std::string tagDesc() const override
Return a description for the tag.
Definition datasets.cpp:528
Exiv2::IptcKey::groupName
std::string groupName() const override
Return the name of the group (the second part of the key). For IPTC keys, the group name is the recor...
Definition datasets.cpp:516
Exiv2::IptcKey::tagLabel
std::string tagLabel() const override
Return a label for the tag.
Definition datasets.cpp:524
Exiv2::IptcKey::makeKey
void makeKey()
Set the key corresponding to the dataset and record id. The key is of the form 'Iptc....
Definition datasets.cpp:582
Exiv2::IptcKey::familyName
const char * familyName() const override
Return an identifier for the type of metadata (the first part of the key).
Definition datasets.cpp:512
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::operator<<
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition datasets.cpp:590
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition types.hpp:70
Exiv2::Dictionary
std::map< std::string, std::string > Dictionary
typedef for string:string map
Definition datasets.hpp:312
Exiv2::DataSet
Details of an IPTC dataset.
Definition datasets.hpp:30
Exiv2::DataSet::mandatory_
bool mandatory_
True if dataset is mandatory.
Definition datasets.hpp:35
Exiv2::DataSet::minbytes_
uint32_t minbytes_
Minimum number of bytes.
Definition datasets.hpp:37
Exiv2::DataSet::photoshop_
const char * photoshop_
Photoshop string.
Definition datasets.hpp:41
Exiv2::DataSet::maxbytes_
uint32_t maxbytes_
Maximum number of bytes.
Definition datasets.hpp:38
Exiv2::DataSet::recordId_
uint16_t recordId_
Record id.
Definition datasets.hpp:40
Exiv2::DataSet::name_
const char * name_
Dataset name.
Definition datasets.hpp:32
Exiv2::DataSet::repeatable_
bool repeatable_
True if dataset is repeatable.
Definition datasets.hpp:36
Exiv2::DataSet::title_
const char * title_
Dataset title or label.
Definition datasets.hpp:33
Exiv2::DataSet::type_
TypeId type_
Exiv2 default type.
Definition datasets.hpp:39
Exiv2::DataSet::number_
uint16_t number_
Dataset number.
Definition datasets.hpp:31
Exiv2::DataSet::desc_
const char * desc_
Dataset description.
Definition datasets.hpp:34
Exiv2::RecordInfo
Details of an IPTC record.
Definition datasets.hpp:23
Exiv2::RecordInfo::name_
const char * name_
Record name (one word).
Definition datasets.hpp:25
Exiv2::RecordInfo::recordId_
uint16_t recordId_
Record id.
Definition datasets.hpp:24
Exiv2::RecordInfo::desc_
const char * desc_
Record description.
Definition datasets.hpp:26