Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move enums from tags_int.hpp to tags.hpp #2276

Merged
merged 3 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/exiv2/exif.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class EXIV2API Exifdatum : public Metadatum {
[[nodiscard]] std::string tagLabel() const override;
[[nodiscard]] uint16_t tag() const override;
//! Return the IFD id as an integer. (Do not use, this is meant for library internal use.)
[[nodiscard]] int ifdId() const;
[[nodiscard]] IfdId ifdId() const;
//! Return the name of the IFD
[[nodiscard]] const char* ifdName() const;
//! Return the index (unique id of this key within the original IFD)
Expand Down
206 changes: 192 additions & 14 deletions include/exiv2/tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,161 @@ using TagListFct = const TagInfo* (*)();
// *****************************************************************************
// class definitions

//! Type to specify the IFD to which a metadata belongs
enum class IfdId : uint32_t {
ifdIdNotSet,
ifd0Id,
ifd1Id,
ifd2Id,
ifd3Id,
exifId,
gpsId,
iopId,
mpfId,
subImage1Id,
subImage2Id,
subImage3Id,
subImage4Id,
subImage5Id,
subImage6Id,
subImage7Id,
subImage8Id,
subImage9Id,
subThumb1Id,
panaRawId,
mnId,
canonId,
canonAfCId,
canonAfMiAdjId,
canonAmId,
canonAsId,
canonCbId,
canonCiId,
canonCsId,
canonFilId,
canonFlId,
canonHdrId,
canonLeId,
canonMeId,
canonMoID,
canonMvId,
canonRawBId,
canonSiId,
canonCfId,
canonContrastId,
canonFcd1Id,
canonFcd2Id,
canonFcd3Id,
canonLiOpId,
canonMyColorID,
canonPiId,
canonPaId,
canonTiId,
canonFiId,
canonPrId,
canonPreID,
canonVigCorId,
canonVigCor2Id,
canonWbId,
casioId,
casio2Id,
fujiId,
minoltaId,
minoltaCs5DId,
minoltaCs7DId,
minoltaCsOldId,
minoltaCsNewId,
nikon1Id,
nikon2Id,
nikon3Id,
nikonPvId,
nikonVrId,
nikonPcId,
nikonWtId,
nikonIiId,
nikonAfId,
nikonAf21Id,
nikonAf22Id,
nikonAFTId,
nikonFiId,
nikonMeId,
nikonFl1Id,
nikonFl2Id,
nikonFl3Id,
nikonFl7Id,
nikonSi1Id,
nikonSi2Id,
nikonSi3Id,
nikonSi4Id,
nikonSi5Id,
nikonSi6Id,
nikonLd1Id,
nikonLd2Id,
nikonLd3Id,
nikonLd4Id,
nikonCb1Id,
nikonCb2Id,
nikonCb2aId,
nikonCb2bId,
nikonCb3Id,
nikonCb4Id,
olympusId,
olympus2Id,
olympusCsId,
olympusEqId,
olympusRdId,
olympusRd2Id,
olympusIpId,
olympusFiId,
olympusFe1Id,
olympusFe2Id,
olympusFe3Id,
olympusFe4Id,
olympusFe5Id,
olympusFe6Id,
olympusFe7Id,
olympusFe8Id,
olympusFe9Id,
olympusRiId,
panasonicId,
pentaxId,
pentaxDngId,
samsung2Id,
samsungPvId,
samsungPwId,
sigmaId,
sony1Id,
sony2Id,
sonyMltId,
sony1CsId,
sony1Cs2Id,
sony2CsId,
sony2Cs2Id,
sony2FpId,
sonyMisc1Id,
sonyMisc2bId,
sonyMisc3cId,
sonySInfo1Id,
sony2010eId,
sony1MltCs7DId,
sony1MltCsOldId,
sony1MltCsNewId,
sony1MltCsA100Id,
tagInfoMvId,
lastId,
ignoreId = lastId
};

inline std::ostream& operator<<(std::ostream& os, IfdId id) {
return os << static_cast<int>(id);
}

//! The details of an Exif group. Groups include IFDs and binary arrays.
struct EXIV2API GroupInfo {
struct GroupName;
bool operator==(int ifdId) const; //!< Comparison operator for IFD id
bool operator==(IfdId ifdId) const; //!< Comparison operator for IFD id
bool operator==(const GroupName& groupName) const; //!< Comparison operator for group name
int ifdId_; //!< IFD id
IfdId ifdId_; //!< IFD id
const char* ifdName_; //!< IFD name
const char* groupName_; //!< Group name, unique for each group.
TagListFct tagList_; //!< Tag list
Expand All @@ -47,18 +196,47 @@ struct EXIV2API GroupInfo::GroupName {
std::string g_; //!< Group name
};

/*!
@brief Section identifiers to logically group tags. A section consists
of nothing more than a name, based on the Exif standard.
*/
enum class SectionId {
sectionIdNotSet,
imgStruct, // 4.6.4 A
recOffset, // 4.6.4 B
imgCharacter, // 4.6.4 C
otherTags, // 4.6.4 D
exifFormat, // 4.6.3
exifVersion, // 4.6.5 A
imgConfig, // 4.6.5 C
userInfo, // 4.6.5 D
relatedFile, // 4.6.5 E
dateTime, // 4.6.5 F
captureCond, // 4.6.5 G
gpsTags, // 4.6.6
iopTags, // 4.6.7
mpfTags,
makerTags, // MakerNote
dngTags, // DNG Spec
panaRaw,
tiffEp, // TIFF-EP Spec
tiffPm6,
adobeOpi,
lastSectionId
};

//! Tag information
struct EXIV2API TagInfo {
uint16_t tag_; //!< Tag
const char* name_; //!< One word tag label
const char* title_; //!< Tag title
const char* desc_; //!< Short tag description
int ifdId_; //!< Link to the (preferred) IFD
int sectionId_; //!< Section id
TypeId typeId_; //!< Type id
int16_t count_; //!< The number of values (not bytes!), 0=any, -1=count not known.
PrintFct printFct_; //!< Pointer to tag print function
}; // struct TagInfo
uint16_t tag_; //!< Tag
const char* name_; //!< One word tag label
const char* title_; //!< Tag title
const char* desc_; //!< Short tag description
IfdId ifdId_; //!< Link to the (preferred) IFD
SectionId sectionId_; //!< Section id
TypeId typeId_; //!< Type id
int16_t count_; //!< The number of values (not bytes!), 0=any, -1=count not known.
PrintFct printFct_; //!< Pointer to tag print function
}; // struct TagInfo

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