replace structs with std::pair
Simpler. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
0256775408
commit
d5e42da39e
@ -1803,7 +1803,7 @@ EncoderFct TiffMapping::findEncoder(const std::string& make, uint32_t extendedTa
|
||||
}
|
||||
|
||||
bool TiffTreeStruct::operator==(const TiffTreeStruct::Key& key) const {
|
||||
return key.r_ == root_ && key.g_ == group_;
|
||||
return key.first == root_ && key.second == group_;
|
||||
}
|
||||
|
||||
TiffComponent::UniquePtr TiffCreator::create(uint32_t extendedTag, IfdId group) {
|
||||
@ -2036,7 +2036,7 @@ bool TiffHeaderBase::isImageTag(uint16_t /*tag*/, IfdId /*group*/, const Primary
|
||||
|
||||
bool isTiffImageTag(uint16_t tag, IfdId group) {
|
||||
//! List of TIFF image tags
|
||||
static const TiffImgTagStruct tiffImageTags[] = {
|
||||
static constexpr TiffImgTagStruct tiffImageTags[] = {
|
||||
{0x00fe, IfdId::ifd0Id}, // Exif.Image.NewSubfileType
|
||||
{0x00ff, IfdId::ifd0Id}, // Exif.Image.SubfileType
|
||||
{0x0100, IfdId::ifd0Id}, // Exif.Image.ImageWidth
|
||||
@ -2107,7 +2107,7 @@ bool isTiffImageTag(uint16_t tag, IfdId group) {
|
||||
|
||||
// If tag, group is one of the image tags listed above -> bingo!
|
||||
#ifdef EXIV2_DEBUG_MESSAGES
|
||||
if (find(tiffImageTags, TiffImgTagStruct::Key(tag, group))) {
|
||||
if (find(tiffImageTags, TiffImgTagStruct(tag, group))) {
|
||||
ExifKey key(tag, groupName(group));
|
||||
std::cerr << "Image tag: " << key << " (3)\n";
|
||||
return true;
|
||||
@ -2115,7 +2115,7 @@ bool isTiffImageTag(uint16_t tag, IfdId group) {
|
||||
std::cerr << "Not an image tag: " << tag << " (4)\n";
|
||||
return false;
|
||||
#endif
|
||||
return find(tiffImageTags, TiffImgTagStruct::Key(tag, group));
|
||||
return find(tiffImageTags, TiffImgTagStruct(tag, group));
|
||||
}
|
||||
|
||||
TiffHeader::TiffHeader(ByteOrder byteOrder, uint32_t offset, bool hasImageTags) :
|
||||
|
||||
@ -132,19 +132,7 @@ class TiffHeader : public TiffHeaderBase {
|
||||
/*!
|
||||
@brief Data structure used to list image tags for TIFF and TIFF-like images.
|
||||
*/
|
||||
struct TiffImgTagStruct {
|
||||
//! Search key for TIFF image tag structure.
|
||||
using Key = std::pair<uint16_t, IfdId>;
|
||||
//! Comparison operator to compare a TiffImgTagStruct with a TiffImgTagStruct::Key
|
||||
bool operator==(const Key& key) const {
|
||||
auto [t, g] = key;
|
||||
return g == group_ && t == tag_;
|
||||
}
|
||||
|
||||
// DATA
|
||||
uint16_t tag_; //!< Image tag
|
||||
IfdId group_; //!< Group that contains the image tag
|
||||
}; // struct TiffImgTagStruct
|
||||
using TiffImgTagStruct = std::pair<uint16_t, IfdId>;
|
||||
|
||||
/*!
|
||||
@brief Data structure used as a row (element) of a table (array)
|
||||
@ -176,7 +164,7 @@ struct TiffGroupStruct {
|
||||
use standard TIFF layout.
|
||||
*/
|
||||
struct TiffTreeStruct {
|
||||
struct Key;
|
||||
using Key = std::pair<uint32_t, IfdId>;
|
||||
//! Comparison operator to compare a TiffTreeStruct with a TiffTreeStruct::Key
|
||||
bool operator==(const Key& key) const;
|
||||
|
||||
@ -187,15 +175,6 @@ struct TiffTreeStruct {
|
||||
uint32_t parentExtTag_; //!< Parent tag (32 bit so that it can contain special tags)
|
||||
};
|
||||
|
||||
//! Search key for TIFF tree structure.
|
||||
struct TiffTreeStruct::Key {
|
||||
//! Constructor
|
||||
Key(uint32_t r, IfdId g) : r_(r), g_(g) {
|
||||
}
|
||||
uint32_t r_; //!< Root
|
||||
IfdId g_; //!< %Group
|
||||
};
|
||||
|
||||
/*!
|
||||
@brief TIFF component factory.
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user