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
18namespace Exiv2 {
19// *****************************************************************************
20// class definitions
21
23struct EXIV2API RecordInfo {
24 uint16_t recordId_;
25 const char* name_;
26 const char* desc_;
27};
28
30struct EXIV2API DataSet {
31 uint16_t number_;
32 const char* name_;
33 const char* title_;
34 const char* desc_;
37 uint32_t minbytes_;
38 uint32_t maxbytes_;
40 uint16_t recordId_;
41 const char* photoshop_;
42};
43
45class 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
237class 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
312using 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_
IPTC dataset reference, implemented as a static class.
Definition datasets.hpp:45
Concrete keys for IPTC metadata.
Definition datasets.hpp:237
std::unique_ptr< IptcKey > UniquePtr
Shortcut for an IptcKey auto pointer.
Definition datasets.hpp:240
Abstract base class defining the Key of a metadatum. Keys are used to identify and group metadata.
Definition metadatum.hpp:26
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition tags_int.cpp:2477
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition datasets.cpp:590
std::map< std::string, std::string > Dictionary
typedef for string:string map
Definition datasets.hpp:312
TypeId
Exiv2 value type identifiers.
Definition types.hpp:70
ImageType
Supported Image Formats.
Definition image_types.hpp:8
Details of an IPTC dataset.
Definition datasets.hpp:30
bool mandatory_
True if dataset is mandatory.
Definition datasets.hpp:35
uint32_t minbytes_
Minimum number of bytes.
Definition datasets.hpp:37
const char * photoshop_
Photoshop string.
Definition datasets.hpp:41
uint32_t maxbytes_
Maximum number of bytes.
Definition datasets.hpp:38
uint16_t recordId_
Record id.
Definition datasets.hpp:40
const char * name_
Dataset name.
Definition datasets.hpp:32
bool repeatable_
True if dataset is repeatable.
Definition datasets.hpp:36
const char * title_
Dataset title or label.
Definition datasets.hpp:33
TypeId type_
Exiv2 default type.
Definition datasets.hpp:39
uint16_t number_
Dataset number.
Definition datasets.hpp:31
const char * desc_
Dataset description.
Definition datasets.hpp:34
Details of an IPTC record.
Definition datasets.hpp:23
const char * name_
Record name (one word)
Definition datasets.hpp:25
uint16_t recordId_
Record id.
Definition datasets.hpp:24
const char * desc_
Record description.
Definition datasets.hpp:26