Loading...
Searching...
No Matches
tags.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef TAGS_HPP_
#define TAGS_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "metadatum.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class declarations
class ExifData;
class ExifKey;
class Value;
struct TagInfo;
// *****************************************************************************
// type definitions
using PrintFct = std::ostream& (*)(std::ostream&, const Value&, const ExifData* pExifData);
using TagListFct = const TagInfo* (*)();
// *****************************************************************************
// class definitions
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,
nikonFl6Id,
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);
}
struct EXIV2API GroupInfo {
using GroupName = std::string;
bool operator==(IfdId ifdId) const;
bool operator==(const GroupName& groupName) const;
IfdId ifdId_;
const char* ifdName_;
const char* groupName_;
TagListFct tagList_;
};
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
};
struct EXIV2API TagInfo {
uint16_t tag_;
const char* name_;
const char* title_;
const char* desc_;
IfdId ifdId_;
SectionId sectionId_;
TypeId typeId_;
int16_t count_;
PrintFct printFct_;
};
class EXIV2API ExifTags {
public:
static const GroupInfo* groupList();
static const TagInfo* tagList(const std::string& groupName);
static void taglist(std::ostream& os);
static void taglist(std::ostream& os, const std::string& groupName);
static const char* sectionName(const ExifKey& key);
static uint16_t defaultCount(const ExifKey& key);
static const char* ifdName(const std::string& groupName);
static bool isMakerGroup(const std::string& groupName);
static bool isExifGroup(const std::string& groupName);
}; // class ExifTags
class EXIV2API ExifKey : public Key {
public:
using UniquePtr = std::unique_ptr<ExifKey>;
explicit ExifKey(const std::string& key);
ExifKey(uint16_t tag, const std::string& groupName);
explicit ExifKey(const TagInfo& ti);
ExifKey(const ExifKey& rhs);
~ExifKey() override;
ExifKey& operator=(const ExifKey& rhs);
void setIdx(int idx) const;
[[nodiscard]] std::string key() const override;
[[nodiscard]] const char* familyName() const override;
[[nodiscard]] std::string groupName() const override;
[[nodiscard]] IfdId ifdId() const;
[[nodiscard]] std::string tagName() const override;
[[nodiscard]] uint16_t tag() const override;
[[nodiscard]] std::string tagLabel() const override;
[[nodiscard]] std::string tagDesc() const override;
[[nodiscard]] TypeId defaultTypeId() const; // Todo: should be in the base class
[[nodiscard]] UniquePtr clone() const;
[[nodiscard]] int idx() const;
private:
[[nodiscard]] ExifKey* clone_() const override;
// Pimpl idiom
struct Impl;
std::unique_ptr<Impl> p_;
}; // class ExifKey
// *****************************************************************************
// free functions
EXIV2API std::ostream& operator<<(std::ostream& os, const TagInfo& ti);
} // namespace Exiv2
#endif // #ifndef TAGS_HPP_
Exiv2::ExifData
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition exif.hpp:379
Exiv2::ExifKey
Concrete keys for Exif metadata and access to Exif tag reference data.
Definition tags.hpp:271
Exiv2::ExifKey::ExifKey
ExifKey(const std::string &key)
Constructor to create an Exif key from a key string.
Definition tags.cpp:258
Exiv2::ExifKey::operator=
ExifKey & operator=(const ExifKey &rhs)
Assignment operator.
Definition tags.cpp:267
Exiv2::ExifKey::tagDesc
std::string tagDesc() const override
Return a description for the tag.
Definition tags.cpp:301
Exiv2::ExifKey::idx
int idx() const
Return the index (unique id of this key within the original Exif data, 0 if not set).
Definition tags.cpp:329
Exiv2::ExifKey::tagName
std::string tagName() const override
Return the name of the tag (which is also the third part of the key).
Definition tags.cpp:291
Exiv2::ExifKey::setIdx
void setIdx(int idx) const
Set the index.
Definition tags.cpp:275
Exiv2::ExifKey::key
std::string key() const override
Return the key of the metadatum as a string. The key is of the form 'familyName.groupName....
Definition tags.cpp:279
Exiv2::ExifKey::groupName
std::string groupName() const override
Return the name of the group (the second part of the key).
Definition tags.cpp:287
Exiv2::ExifKey::defaultTypeId
TypeId defaultTypeId() const
Return the default type id for this tag.
Definition tags.cpp:307
Exiv2::ExifKey::~ExifKey
~ExifKey() override
Destructor.
Exiv2::ExifKey::tag
uint16_t tag() const override
Return the tag number.
Definition tags.cpp:313
Exiv2::ExifKey::tagLabel
std::string tagLabel() const override
Return a label for the tag.
Definition tags.cpp:295
Exiv2::ExifKey::UniquePtr
std::unique_ptr< ExifKey > UniquePtr
Shortcut for an ExifKey auto pointer.
Definition tags.hpp:274
Exiv2::ExifKey::ifdId
IfdId ifdId() const
Return the IFD id. (Do not use, this is meant for library internal use.).
Definition tags.cpp:325
Exiv2::ExifKey::familyName
const char * familyName() const override
Return an identifier for the type of metadata (the first part of the key).
Definition tags.cpp:283
Exiv2::ExifTags
Access to Exif group and tag lists and misc. tag reference methods, implemented as a static class.
Definition tags.hpp:237
Exiv2::ExifTags::isExifGroup
static bool isExifGroup(const std::string &groupName)
Return true if groupName is a TIFF or Exif IFD, else false. This is used to differentiate between sta...
Definition tags.cpp:101
Exiv2::ExifTags::defaultCount
static uint16_t defaultCount(const ExifKey &key)
Return the default number of components (not bytes!) key has. (0=any, -1=count not known).
Definition tags.cpp:84
Exiv2::ExifTags::groupList
static const GroupInfo * groupList()
Return read-only list of built-in groups.
Definition tags.cpp:106
Exiv2::ExifTags::ifdName
static const char * ifdName(const std::string &groupName)
Return the name of the IFD for the group.
Definition tags.cpp:91
Exiv2::ExifTags::sectionName
static const char * sectionName(const ExifKey &key)
Return the name of the section for an Exif key.
Definition tags.cpp:76
Exiv2::ExifTags::tagList
static const TagInfo * tagList(const std::string &groupName)
Return read-only list of built-in groupName tags.
Definition tags.cpp:110
Exiv2::ExifTags::taglist
static void taglist(std::ostream &os)
Print a list of all standard Exif tags to output stream.
Definition tags.cpp:114
Exiv2::ExifTags::isMakerGroup
static bool isMakerGroup(const std::string &groupName)
Return true if groupName is a makernote group.
Definition tags.cpp:96
Exiv2::Value
Common interface for all types of values used with metadata.
Definition value.hpp:33
Exiv2::Internal::groupName
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition tags_int.cpp:2479
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::TagListFct
const TagInfo *(*)() TagListFct
A function returning a tag list.
Definition tags.hpp:28
Exiv2::IfdId
IfdId
Type to specify the IFD to which a metadata belongs.
Definition tags.hpp:34
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition types.hpp:70
Exiv2::SectionId
SectionId
Section identifiers to logically group tags. A section consists of nothing more than a name,...
Definition tags.hpp:198
Exiv2::PrintFct
std::ostream &(*)(std::ostream &, const Value &, const ExifData *pExifData) PrintFct
Type for a function pointer for functions interpreting the tag value.
Definition tags.hpp:26
Exiv2::ExifKey::Impl
Internal Pimpl structure with private members and data of class ExifKey.
Definition tags.cpp:144
Exiv2::GroupInfo
The details of an Exif group. Groups include IFDs and binary arrays.
Definition tags.hpp:184
Exiv2::GroupInfo::tagList_
TagListFct tagList_
Tag list.
Definition tags.hpp:191
Exiv2::GroupInfo::ifdName_
const char * ifdName_
IFD name.
Definition tags.hpp:189
Exiv2::GroupInfo::groupName_
const char * groupName_
Group name, unique for each group.
Definition tags.hpp:190
Exiv2::GroupInfo::operator==
bool operator==(IfdId ifdId) const
Comparison operator for IFD id.
Definition tags.cpp:68
Exiv2::GroupInfo::ifdId_
IfdId ifdId_
IFD id.
Definition tags.hpp:188
Exiv2::TagInfo
Tag information.
Definition tags.hpp:224
Exiv2::TagInfo::tag_
uint16_t tag_
Tag.
Definition tags.hpp:225
Exiv2::TagInfo::ifdId_
IfdId ifdId_
Link to the (preferred) IFD.
Definition tags.hpp:229
Exiv2::TagInfo::count_
int16_t count_
The number of values (not bytes!), 0=any, -1=count not known.
Definition tags.hpp:232
Exiv2::TagInfo::typeId_
TypeId typeId_
Type id.
Definition tags.hpp:231
Exiv2::TagInfo::sectionId_
SectionId sectionId_
Section id.
Definition tags.hpp:230
Exiv2::TagInfo::desc_
const char * desc_
Short tag description.
Definition tags.hpp:228
Exiv2::TagInfo::title_
const char * title_
Tag title.
Definition tags.hpp:227
Exiv2::TagInfo::printFct_
PrintFct printFct_
Pointer to tag print function.
Definition tags.hpp:233
Exiv2::TagInfo::name_
const char * name_
One word tag label.
Definition tags.hpp:226