Skip to content

Commit 3f7cb78

Browse files
Move enums from tags_int.hpp to tags.hpp
1 parent a22aea0 commit 3f7cb78

File tree

10 files changed

+201
-202
lines changed

10 files changed

+201
-202
lines changed

include/exiv2/tags.hpp

Lines changed: 184 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,192 @@ struct EXIV2API GroupInfo::GroupName {
4747
std::string g_; //!< Group name
4848
};
4949

50+
//! Type to specify the IFD to which a metadata belongs
51+
enum IfdId {
52+
ifdIdNotSet,
53+
ifd0Id,
54+
ifd1Id,
55+
ifd2Id,
56+
ifd3Id,
57+
exifId,
58+
gpsId,
59+
iopId,
60+
mpfId,
61+
subImage1Id,
62+
subImage2Id,
63+
subImage3Id,
64+
subImage4Id,
65+
subImage5Id,
66+
subImage6Id,
67+
subImage7Id,
68+
subImage8Id,
69+
subImage9Id,
70+
subThumb1Id,
71+
panaRawId,
72+
mnId,
73+
canonId,
74+
canonAfCId,
75+
canonAfMiAdjId,
76+
canonAmId,
77+
canonAsId,
78+
canonCbId,
79+
canonCiId,
80+
canonCsId,
81+
canonFilId,
82+
canonFlId,
83+
canonHdrId,
84+
canonLeId,
85+
canonMeId,
86+
canonMoID,
87+
canonMvId,
88+
canonRawBId,
89+
canonSiId,
90+
canonCfId,
91+
canonContrastId,
92+
canonFcd1Id,
93+
canonFcd2Id,
94+
canonFcd3Id,
95+
canonLiOpId,
96+
canonMyColorID,
97+
canonPiId,
98+
canonPaId,
99+
canonTiId,
100+
canonFiId,
101+
canonPrId,
102+
canonPreID,
103+
canonVigCorId,
104+
canonVigCor2Id,
105+
canonWbId,
106+
casioId,
107+
casio2Id,
108+
fujiId,
109+
minoltaId,
110+
minoltaCs5DId,
111+
minoltaCs7DId,
112+
minoltaCsOldId,
113+
minoltaCsNewId,
114+
nikon1Id,
115+
nikon2Id,
116+
nikon3Id,
117+
nikonPvId,
118+
nikonVrId,
119+
nikonPcId,
120+
nikonWtId,
121+
nikonIiId,
122+
nikonAfId,
123+
nikonAf21Id,
124+
nikonAf22Id,
125+
nikonAFTId,
126+
nikonFiId,
127+
nikonMeId,
128+
nikonFl1Id,
129+
nikonFl2Id,
130+
nikonFl3Id,
131+
nikonFl7Id,
132+
nikonSi1Id,
133+
nikonSi2Id,
134+
nikonSi3Id,
135+
nikonSi4Id,
136+
nikonSi5Id,
137+
nikonSi6Id,
138+
nikonLd1Id,
139+
nikonLd2Id,
140+
nikonLd3Id,
141+
nikonLd4Id,
142+
nikonCb1Id,
143+
nikonCb2Id,
144+
nikonCb2aId,
145+
nikonCb2bId,
146+
nikonCb3Id,
147+
nikonCb4Id,
148+
olympusId,
149+
olympus2Id,
150+
olympusCsId,
151+
olympusEqId,
152+
olympusRdId,
153+
olympusRd2Id,
154+
olympusIpId,
155+
olympusFiId,
156+
olympusFe1Id,
157+
olympusFe2Id,
158+
olympusFe3Id,
159+
olympusFe4Id,
160+
olympusFe5Id,
161+
olympusFe6Id,
162+
olympusFe7Id,
163+
olympusFe8Id,
164+
olympusFe9Id,
165+
olympusRiId,
166+
panasonicId,
167+
pentaxId,
168+
pentaxDngId,
169+
samsung2Id,
170+
samsungPvId,
171+
samsungPwId,
172+
sigmaId,
173+
sony1Id,
174+
sony2Id,
175+
sonyMltId,
176+
sony1CsId,
177+
sony1Cs2Id,
178+
sony2CsId,
179+
sony2Cs2Id,
180+
sony2FpId,
181+
sonyMisc1Id,
182+
sonyMisc2bId,
183+
sonyMisc3cId,
184+
sonySInfo1Id,
185+
sony2010eId,
186+
sony1MltCs7DId,
187+
sony1MltCsOldId,
188+
sony1MltCsNewId,
189+
sony1MltCsA100Id,
190+
tagInfoMvId,
191+
lastId,
192+
ignoreId = lastId
193+
};
194+
195+
/*!
196+
@brief Section identifiers to logically group tags. A section consists
197+
of nothing more than a name, based on the Exif standard.
198+
*/
199+
enum SectionId {
200+
sectionIdNotSet,
201+
imgStruct, // 4.6.4 A
202+
recOffset, // 4.6.4 B
203+
imgCharacter, // 4.6.4 C
204+
otherTags, // 4.6.4 D
205+
exifFormat, // 4.6.3
206+
exifVersion, // 4.6.5 A
207+
imgConfig, // 4.6.5 C
208+
userInfo, // 4.6.5 D
209+
relatedFile, // 4.6.5 E
210+
dateTime, // 4.6.5 F
211+
captureCond, // 4.6.5 G
212+
gpsTags, // 4.6.6
213+
iopTags, // 4.6.7
214+
mpfTags,
215+
makerTags, // MakerNote
216+
dngTags, // DNG Spec
217+
panaRaw,
218+
tiffEp, // TIFF-EP Spec
219+
tiffPm6,
220+
adobeOpi,
221+
lastSectionId
222+
};
223+
50224
//! Tag information
51225
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
226+
uint16_t tag_; //!< Tag
227+
const char* name_; //!< One word tag label
228+
const char* title_; //!< Tag title
229+
const char* desc_; //!< Short tag description
230+
IfdId ifdId_; //!< Link to the (preferred) IFD
231+
SectionId sectionId_; //!< Section id
232+
TypeId typeId_; //!< Type id
233+
int16_t count_; //!< The number of values (not bytes!), 0=any, -1=count not known.
234+
PrintFct printFct_; //!< Pointer to tag print function
235+
}; // struct TagInfo
62236

63237
//! Access to Exif group and tag lists and misc. tag reference methods, implemented as a static class.
64238
class EXIV2API ExifTags {

src/cr2image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ WriteMethod Cr2Parser::encode(BasicIo& io, const byte* pData, size_t size, ByteO
112112

113113
// Delete IFDs which do not occur in TIFF images
114114
static constexpr auto filteredIfds = std::array{
115-
Internal::panaRawId,
115+
panaRawId,
116116
};
117117
for (auto&& filteredIfd : filteredIfds) {
118118
#ifdef EXIV2_DEBUG_MESSAGES

src/crwimage_int.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ struct CrwMapping {
496496
//! @name Creators
497497
//@{
498498
//! Default constructor
499-
CrwMapping(uint16_t crwTagId, uint16_t crwDir, uint32_t size, uint16_t tag, Internal::IfdId ifdId,
499+
CrwMapping(uint16_t crwTagId, uint16_t crwDir, uint32_t size, uint16_t tag, IfdId ifdId,
500500
CrwDecodeFct toExif, CrwEncodeFct fromExif) :
501501
crwTagId_(crwTagId),
502502
crwDir_(crwDir),

src/exif.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class JpegThumbnail : public Thumbnail {
128128
int64_t sumToLong(const Exiv2::Exifdatum& md);
129129

130130
//! Helper function to delete all tags of a specific IFD from the metadata.
131-
void eraseIfd(Exiv2::ExifData& ed, Exiv2::Internal::IfdId ifdId);
131+
void eraseIfd(Exiv2::ExifData& ed, Exiv2::IfdId ifdId);
132132

133133
} // namespace
134134

@@ -301,7 +301,7 @@ int Exifdatum::ifdId() const {
301301
}
302302

303303
const char* Exifdatum::ifdName() const {
304-
return key_ ? Internal::ifdName(static_cast<Internal::IfdId>(key_->ifdId())) : "";
304+
return key_ ? Internal::ifdName(static_cast<IfdId>(key_->ifdId())) : "";
305305
}
306306

307307
int Exifdatum::idx() const {

src/makernote_int.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ namespace fs = std::filesystem;
3737
namespace {
3838
// Todo: Can be generalized further - get any tag as a string/long/...
3939
//! Get the Value for a tag within a particular group
40-
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, const uint16_t& tag,
41-
const Exiv2::Internal::IfdId& group);
40+
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, const uint16_t& tag, const Exiv2::IfdId& group);
4241
//! Get the model name from tag Exif.Image.Model
4342
std::string getExifModel(Exiv2::Internal::TiffComponent* pRoot);
4443

@@ -969,9 +968,9 @@ int sonyMisc2bSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/,
969968
// > First byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
970969

971970
// Get the value from the image format that is being used
972-
auto value = getExifValue(pRoot, 0x9404, Exiv2::Internal::sony1Id);
971+
auto value = getExifValue(pRoot, 0x9404, Exiv2::sony1Id);
973972
if (!value) {
974-
value = getExifValue(pRoot, 0x9404, Exiv2::Internal::sony2Id);
973+
value = getExifValue(pRoot, 0x9404, Exiv2::sony2Id);
975974
if (!value)
976975
return -1;
977976
}
@@ -996,9 +995,9 @@ int sonyMisc3cSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/,
996995
// > first byte decoded: 62, 48, 215, 28, 106 respectively
997996

998997
// Get the value from the image format that is being used
999-
auto value = getExifValue(pRoot, 0x9400, Exiv2::Internal::sony1Id);
998+
auto value = getExifValue(pRoot, 0x9400, Exiv2::sony1Id);
1000999
if (!value) {
1001-
value = getExifValue(pRoot, 0x9400, Exiv2::Internal::sony2Id);
1000+
value = getExifValue(pRoot, 0x9400, Exiv2::sony2Id);
10021001
if (!value)
10031002
return -1;
10041003
}
@@ -1024,7 +1023,7 @@ int sonyMisc3cSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/,
10241023
// local definitions
10251024
namespace {
10261025
const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, const uint16_t& tag,
1027-
const Exiv2::Internal::IfdId& group) {
1026+
const Exiv2::IfdId& group) {
10281027
Exiv2::Internal::TiffFinder finder(tag, group);
10291028
if (!pRoot)
10301029
return nullptr;
@@ -1035,7 +1034,7 @@ const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, const ui
10351034

10361035
std::string getExifModel(Exiv2::Internal::TiffComponent* pRoot) {
10371036
// Lookup the Exif.Image.Model tag
1038-
const auto value = getExifValue(pRoot, 0x0110, Exiv2::Internal::ifd0Id);
1037+
const auto value = getExifValue(pRoot, 0x0110, Exiv2::ifd0Id);
10391038
return (!value || value->count() == 0) ? std::string("") : static_cast<std::string>(value->toString());
10401039
}
10411040

src/preview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ DataBuf LoaderTiff::getData() const {
697697
consistent result for all previews, including JPEG
698698
*/
699699
uint16_t tag = pos.tag();
700-
if (tag != 0x00fe && tag != 0x00ff && Internal::isTiffImageTag(tag, Internal::ifd0Id)) {
700+
if (tag != 0x00fe && tag != 0x00ff && Internal::isTiffImageTag(tag, ifd0Id)) {
701701
preview.add(ExifKey(tag, "Image"), &pos.value());
702702
}
703703
}

src/tags.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ bool GroupInfo::operator==(const GroupName& groupName) const {
7575
}
7676

7777
const char* ExifTags::sectionName(const ExifKey& key) {
78-
const TagInfo* ti = tagInfo(key.tag(), static_cast<Internal::IfdId>(key.ifdId()));
78+
const TagInfo* ti = tagInfo(key.tag(), static_cast<IfdId>(key.ifdId()));
7979
if (!ti)
8080
return sectionInfo[unknownTag.sectionId_].name_;
8181
return sectionInfo[ti->sectionId_].name_;
8282
}
8383

8484
/// \todo not used internally. At least we should test it
8585
uint16_t ExifTags::defaultCount(const ExifKey& key) {
86-
const TagInfo* ti = tagInfo(key.tag(), static_cast<Internal::IfdId>(key.ifdId()));
86+
const TagInfo* ti = tagInfo(key.tag(), static_cast<IfdId>(key.ifdId()));
8787
if (!ti)
8888
return unknownTag.count_;
8989
return ti->count_;

0 commit comments

Comments
 (0)