Skip to content

Commit 0558662

Browse files
Merge pull request #2276 from kevinbackhouse/TagInfo-enums
Move enums from tags_int.hpp to tags.hpp
2 parents 90f794f + 3ef783e commit 0558662

31 files changed

+5165
-4792
lines changed

include/exiv2/exif.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class EXIV2API Exifdatum : public Metadatum {
142142
[[nodiscard]] std::string tagLabel() const override;
143143
[[nodiscard]] uint16_t tag() const override;
144144
//! Return the IFD id as an integer. (Do not use, this is meant for library internal use.)
145-
[[nodiscard]] int ifdId() const;
145+
[[nodiscard]] IfdId ifdId() const;
146146
//! Return the name of the IFD
147147
[[nodiscard]] const char* ifdName() const;
148148
//! Return the index (unique id of this key within the original IFD)

include/exiv2/tags.hpp

Lines changed: 192 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,161 @@ using TagListFct = const TagInfo* (*)();
3030
// *****************************************************************************
3131
// class definitions
3232

33+
//! Type to specify the IFD to which a metadata belongs
34+
enum class IfdId : uint32_t {
35+
ifdIdNotSet,
36+
ifd0Id,
37+
ifd1Id,
38+
ifd2Id,
39+
ifd3Id,
40+
exifId,
41+
gpsId,
42+
iopId,
43+
mpfId,
44+
subImage1Id,
45+
subImage2Id,
46+
subImage3Id,
47+
subImage4Id,
48+
subImage5Id,
49+
subImage6Id,
50+
subImage7Id,
51+
subImage8Id,
52+
subImage9Id,
53+
subThumb1Id,
54+
panaRawId,
55+
mnId,
56+
canonId,
57+
canonAfCId,
58+
canonAfMiAdjId,
59+
canonAmId,
60+
canonAsId,
61+
canonCbId,
62+
canonCiId,
63+
canonCsId,
64+
canonFilId,
65+
canonFlId,
66+
canonHdrId,
67+
canonLeId,
68+
canonMeId,
69+
canonMoID,
70+
canonMvId,
71+
canonRawBId,
72+
canonSiId,
73+
canonCfId,
74+
canonContrastId,
75+
canonFcd1Id,
76+
canonFcd2Id,
77+
canonFcd3Id,
78+
canonLiOpId,
79+
canonMyColorID,
80+
canonPiId,
81+
canonPaId,
82+
canonTiId,
83+
canonFiId,
84+
canonPrId,
85+
canonPreID,
86+
canonVigCorId,
87+
canonVigCor2Id,
88+
canonWbId,
89+
casioId,
90+
casio2Id,
91+
fujiId,
92+
minoltaId,
93+
minoltaCs5DId,
94+
minoltaCs7DId,
95+
minoltaCsOldId,
96+
minoltaCsNewId,
97+
nikon1Id,
98+
nikon2Id,
99+
nikon3Id,
100+
nikonPvId,
101+
nikonVrId,
102+
nikonPcId,
103+
nikonWtId,
104+
nikonIiId,
105+
nikonAfId,
106+
nikonAf21Id,
107+
nikonAf22Id,
108+
nikonAFTId,
109+
nikonFiId,
110+
nikonMeId,
111+
nikonFl1Id,
112+
nikonFl2Id,
113+
nikonFl3Id,
114+
nikonFl7Id,
115+
nikonSi1Id,
116+
nikonSi2Id,
117+
nikonSi3Id,
118+
nikonSi4Id,
119+
nikonSi5Id,
120+
nikonSi6Id,
121+
nikonLd1Id,
122+
nikonLd2Id,
123+
nikonLd3Id,
124+
nikonLd4Id,
125+
nikonCb1Id,
126+
nikonCb2Id,
127+
nikonCb2aId,
128+
nikonCb2bId,
129+
nikonCb3Id,
130+
nikonCb4Id,
131+
olympusId,
132+
olympus2Id,
133+
olympusCsId,
134+
olympusEqId,
135+
olympusRdId,
136+
olympusRd2Id,
137+
olympusIpId,
138+
olympusFiId,
139+
olympusFe1Id,
140+
olympusFe2Id,
141+
olympusFe3Id,
142+
olympusFe4Id,
143+
olympusFe5Id,
144+
olympusFe6Id,
145+
olympusFe7Id,
146+
olympusFe8Id,
147+
olympusFe9Id,
148+
olympusRiId,
149+
panasonicId,
150+
pentaxId,
151+
pentaxDngId,
152+
samsung2Id,
153+
samsungPvId,
154+
samsungPwId,
155+
sigmaId,
156+
sony1Id,
157+
sony2Id,
158+
sonyMltId,
159+
sony1CsId,
160+
sony1Cs2Id,
161+
sony2CsId,
162+
sony2Cs2Id,
163+
sony2FpId,
164+
sonyMisc1Id,
165+
sonyMisc2bId,
166+
sonyMisc3cId,
167+
sonySInfo1Id,
168+
sony2010eId,
169+
sony1MltCs7DId,
170+
sony1MltCsOldId,
171+
sony1MltCsNewId,
172+
sony1MltCsA100Id,
173+
tagInfoMvId,
174+
lastId,
175+
ignoreId = lastId
176+
};
177+
178+
inline std::ostream& operator<<(std::ostream& os, IfdId id) {
179+
return os << static_cast<int>(id);
180+
}
181+
33182
//! The details of an Exif group. Groups include IFDs and binary arrays.
34183
struct EXIV2API GroupInfo {
35184
struct GroupName;
36-
bool operator==(int ifdId) const; //!< Comparison operator for IFD id
185+
bool operator==(IfdId ifdId) const; //!< Comparison operator for IFD id
37186
bool operator==(const GroupName& groupName) const; //!< Comparison operator for group name
38-
int ifdId_; //!< IFD id
187+
IfdId ifdId_; //!< IFD id
39188
const char* ifdName_; //!< IFD name
40189
const char* groupName_; //!< Group name, unique for each group.
41190
TagListFct tagList_; //!< Tag list
@@ -47,18 +196,47 @@ struct EXIV2API GroupInfo::GroupName {
47196
std::string g_; //!< Group name
48197
};
49198

199+
/*!
200+
@brief Section identifiers to logically group tags. A section consists
201+
of nothing more than a name, based on the Exif standard.
202+
*/
203+
enum class SectionId {
204+
sectionIdNotSet,
205+
imgStruct, // 4.6.4 A
206+
recOffset, // 4.6.4 B
207+
imgCharacter, // 4.6.4 C
208+
otherTags, // 4.6.4 D
209+
exifFormat, // 4.6.3
210+
exifVersion, // 4.6.5 A
211+
imgConfig, // 4.6.5 C
212+
userInfo, // 4.6.5 D
213+
relatedFile, // 4.6.5 E
214+
dateTime, // 4.6.5 F
215+
captureCond, // 4.6.5 G
216+
gpsTags, // 4.6.6
217+
iopTags, // 4.6.7
218+
mpfTags,
219+
makerTags, // MakerNote
220+
dngTags, // DNG Spec
221+
panaRaw,
222+
tiffEp, // TIFF-EP Spec
223+
tiffPm6,
224+
adobeOpi,
225+
lastSectionId
226+
};
227+
50228
//! Tag information
51229
struct EXIV2API TagInfo {
52-
uint16_t tag_; //!< Tag
53-
const char* name_; //!< One word tag label
54-
const char* title_; //!< Tag title
55-
const char* desc_; //!< Short tag description
56-
int ifdId_; //!< Link to the (preferred) IFD
57-
int sectionId_; //!< Section id
58-
TypeId typeId_; //!< Type id
59-
int16_t count_; //!< The number of values (not bytes!), 0=any, -1=count not known.
60-
PrintFct printFct_; //!< Pointer to tag print function
61-
}; // struct TagInfo
230+
uint16_t tag_; //!< Tag
231+
const char* name_; //!< One word tag label
232+
const char* title_; //!< Tag title
233+
const char* desc_; //!< Short tag description
234+
IfdId ifdId_; //!< Link to the (preferred) IFD
235+
SectionId sectionId_; //!< Section id
236+
TypeId typeId_; //!< Type id
237+
int16_t count_; //!< The number of values (not bytes!), 0=any, -1=count not known.
238+
PrintFct printFct_; //!< Pointer to tag print function
239+
}; // struct TagInfo
62240

63241
//! Access to Exif group and tag lists and misc. tag reference methods, implemented as a static class.
64242
class EXIV2API ExifTags {
@@ -156,8 +334,8 @@ class EXIV2API ExifKey : public Key {
156334
[[nodiscard]] std::string key() const override;
157335
[[nodiscard]] const char* familyName() const override;
158336
[[nodiscard]] std::string groupName() const override;
159-
//! Return the IFD id as an integer. (Do not use, this is meant for library internal use.)
160-
[[nodiscard]] int ifdId() const;
337+
//! Return the IFD id. (Do not use, this is meant for library internal use.)
338+
[[nodiscard]] IfdId ifdId() const;
161339
[[nodiscard]] std::string tagName() const override;
162340
[[nodiscard]] uint16_t tag() const override;
163341
[[nodiscard]] std::string tagLabel() const override;

0 commit comments

Comments
 (0)