| Exiv2

Loading...
Searching...
No Matches
datasets.hpp
1// SPDX-License-Identifier: GPL-2.0-or-later
7#ifndef DATASETS_HPP_
8#define DATASETS_HPP_
9
10// *****************************************************************************
11#include "exiv2lib_export.h"
12
13// included header files
14#include "metadatum.hpp"
15
16// *****************************************************************************
17// namespace extensions
18 namespace Exiv2 {
19// *****************************************************************************
20// class definitions
21
23 struct EXIV2API RecordInfo {
24 uint16_t recordId_;
25 const char* name_;
26 const char* desc_;
27};
28
30 struct EXIV2API DataSet {
31 uint16_t number_;
32 const char* name_;
33 const char* title_;
34 const char* desc_;
35 bool mandatory_;
36 bool repeatable_;
37 uint32_t minbytes_;
38 uint32_t maxbytes_;
39 TypeId type_;
40 uint16_t recordId_;
41 const char* photoshop_;
42};
43
45 class EXIV2API IptcDataSets {
46 public:
54 static constexpr uint16_t invalidRecord = 0;
55 static constexpr uint16_t envelope = 1;
56 static constexpr uint16_t application2 = 2;
58
60
61 static constexpr uint16_t ModelVersion = 0;
62 static constexpr uint16_t Destination = 5;
63 static constexpr uint16_t FileFormat = 20;
64 static constexpr uint16_t FileVersion = 22;
65 static constexpr uint16_t ServiceId = 30;
66 static constexpr uint16_t EnvelopeNumber = 40;
67 static constexpr uint16_t ProductId = 50;
68 static constexpr uint16_t EnvelopePriority = 60;
69 static constexpr uint16_t DateSent = 70;
70 static constexpr uint16_t TimeSent = 80;
71 static constexpr uint16_t CharacterSet = 90;
72 static constexpr uint16_t UNO = 100;
73 static constexpr uint16_t ARMId = 120;
74 static constexpr uint16_t ARMVersion = 122;
75
76 static constexpr uint16_t RecordVersion = 0;
77 static constexpr uint16_t ObjectType = 3;
78 static constexpr uint16_t ObjectAttribute = 4;
79 static constexpr uint16_t ObjectName = 5;
80 static constexpr uint16_t EditStatus = 7;
81 static constexpr uint16_t EditorialUpdate = 8;
82 static constexpr uint16_t Urgency = 10;
83 static constexpr uint16_t Subject = 12;
84 static constexpr uint16_t Category = 15;
85 static constexpr uint16_t SuppCategory = 20;
86 static constexpr uint16_t FixtureId = 22;
87 static constexpr uint16_t Keywords = 25;
88 static constexpr uint16_t LocationCode = 26;
89 static constexpr uint16_t LocationName = 27;
90 static constexpr uint16_t ReleaseDate = 30;
91 static constexpr uint16_t ReleaseTime = 35;
92 static constexpr uint16_t ExpirationDate = 37;
93 static constexpr uint16_t ExpirationTime = 38;
94 static constexpr uint16_t SpecialInstructions = 40;
95 static constexpr uint16_t ActionAdvised = 42;
96 static constexpr uint16_t ReferenceService = 45;
97 static constexpr uint16_t ReferenceDate = 47;
98 static constexpr uint16_t ReferenceNumber = 50;
99 static constexpr uint16_t DateCreated = 55;
100 static constexpr uint16_t TimeCreated = 60;
101 static constexpr uint16_t DigitizationDate = 62;
102 static constexpr uint16_t DigitizationTime = 63;
103 static constexpr uint16_t Program = 65;
104 static constexpr uint16_t ProgramVersion = 70;
105 static constexpr uint16_t ObjectCycle = 75;
106 static constexpr uint16_t Byline = 80;
107 static constexpr uint16_t BylineTitle = 85;
108 static constexpr uint16_t City = 90;
109 static constexpr uint16_t SubLocation = 92;
110 static constexpr uint16_t ProvinceState = 95;
111 static constexpr uint16_t CountryCode = 100;
112 static constexpr uint16_t CountryName = 101;
113 static constexpr uint16_t TransmissionReference = 103;
114 static constexpr uint16_t Headline = 105;
115 static constexpr uint16_t Credit = 110;
116 static constexpr uint16_t Source = 115;
117 static constexpr uint16_t Copyright = 116;
118 static constexpr uint16_t Contact = 118;
119 static constexpr uint16_t Caption = 120;
120 static constexpr uint16_t Writer = 122;
121 static constexpr uint16_t RasterizedCaption = 125;
122 static constexpr uint16_t ImageType = 130;
123 static constexpr uint16_t ImageOrientation = 131;
124 static constexpr uint16_t Language = 135;
125 static constexpr uint16_t AudioType = 150;
126 static constexpr uint16_t AudioRate = 151;
127 static constexpr uint16_t AudioResolution = 152;
128 static constexpr uint16_t AudioDuration = 153;
129 static constexpr uint16_t AudioOutcue = 154;
130 static constexpr uint16_t PreviewFormat = 200;
131 static constexpr uint16_t PreviewVersion = 201;
132 static constexpr uint16_t Preview = 202;
134
143 static std::string dataSetName(uint16_t number, uint16_t recordId);
144
151 static const char* dataSetTitle(uint16_t number, uint16_t recordId);
152
159 static const char* dataSetDesc(uint16_t number, uint16_t recordId);
160
168 static const char* dataSetPsName(uint16_t number, uint16_t recordId);
169
176 static bool dataSetRepeatable(uint16_t number, uint16_t recordId);
177
188 static uint16_t dataSet(const std::string& dataSetName, uint16_t recordId);
189
191 static TypeId dataSetType(uint16_t number, uint16_t recordId);
192
200 static std::string recordName(uint16_t recordId);
201
207 static const char* recordDesc(uint16_t recordId);
208
215 static uint16_t recordId(const std::string& recordName);
216
218 static const DataSet* envelopeRecordList();
219
221 static const DataSet* application2RecordList();
222
224 static void dataSetList(std::ostream& os);
225
226 private:
227 static int dataSetIdx(uint16_t number, uint16_t recordId);
228 static int dataSetIdx(const std::string& dataSetName, uint16_t recordId);
229
230 static const DataSet* const records_[];
231
232}; // class IptcDataSets
233
237 class EXIV2API IptcKey : public Key {
238 public:
240 using UniquePtr = std::unique_ptr<IptcKey>;
241
243
244
252 explicit IptcKey(std::string key);
258 IptcKey(uint16_t tag, uint16_t record);
260
262
263 [[nodiscard]] std::string key() const override;
264 [[nodiscard]] const char* familyName() const override;
269 [[nodiscard]] std::string groupName() const override;
270 [[nodiscard]] std::string tagName() const override;
271 [[nodiscard]] std::string tagLabel() const override;
272 [[nodiscard]] std::string tagDesc() const override;
273 [[nodiscard]] uint16_t tag() const override;
274 [[nodiscard]] UniquePtr clone() const;
276 [[nodiscard]] std::string recordName() const;
278 [[nodiscard]] uint16_t record() const;
280
281 protected:
283
284
288 void makeKey();
296 void decomposeKey();
298
299 private:
301 [[nodiscard]] IptcKey* clone_() const override;
302
303 uint16_t tag_;
304 uint16_t record_;
305 std::string key_;
306
307}; // class IptcKey
308
312 using Dictionary = std::map<std::string, std::string>;
313
314// *****************************************************************************
315// free functions
316
318EXIV2API std::ostream& operator<<(std::ostream& os, const DataSet& dataSet);
319
320} // namespace Exiv2
321
322#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