Skip to content

Commit df30b1e

Browse files
committed
replace templated prints with macros
Signed-off-by: Rosen Penev <[email protected]>
1 parent e82c0c1 commit df30b1e

File tree

2 files changed

+24
-67
lines changed

2 files changed

+24
-67
lines changed

src/nikonmn_int.cpp

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3438,7 +3438,7 @@ std::ostream& Nikon3MakerNote::printExternalFlashData1Fl6(std::ostream& os, cons
34383438

34393439
if (v0 & 0x01) {
34403440
std::ostringstream ossTemp;
3441-
printTagBitmask<std::size(nikonFlashAdaptors), nikonFlashAdaptors>(ossTemp, value, metadata);
3441+
EXV_PRINT_TAG_BITMASK(nikonFlashAdaptors)(ossTemp, value, metadata);
34423442
std::string tempStr = ossTemp.str();
34433443
if (!tempStr.empty()) {
34443444
os << ", " << tempStr;
@@ -3464,7 +3464,7 @@ std::ostream& Nikon3MakerNote::printExternalFlashData2Fl6(std::ostream& os, cons
34643464

34653465
if (v0 & 0x80) {
34663466
os << ", ";
3467-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (value.toUint32() & 0x0F), metadata);
3467+
EXV_PRINT_TAG(nikonFlashControlMode)(os, (value.toUint32() & 0x0F), metadata);
34683468
}
34693469
os.copyfmt(oss);
34703470
os.flags(f);
@@ -3489,7 +3489,7 @@ std::ostream& Nikon3MakerNote::printExternalFlashData1Fl7(std::ostream& os, cons
34893489
os << (v0 & 0x80 ? _("External flash zoom override") : _("No external flash zoom override"));
34903490

34913491
std::ostringstream ossTemp;
3492-
printTagBitmask<std::size(nikonFlashAdaptors), nikonFlashAdaptors>(ossTemp, value, metadata);
3492+
EXV_PRINT_TAG_BITMASK(nikonFlashAdaptors)(ossTemp, value, metadata);
34933493
std::string tempStr = ossTemp.str();
34943494
if (!tempStr.empty()) {
34953495
os << ", " << tempStr;
@@ -3501,17 +3501,9 @@ std::ostream& Nikon3MakerNote::printExternalFlashData1Fl7(std::ostream& os, cons
35013501
}
35023502

35033503
std::ostream& Nikon3MakerNote::printExternalFlashData2(std::ostream& os, const Value& value, const ExifData* metadata) {
3504-
std::ios::fmtflags f(os.flags());
3505-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3506-
os << "(" << value << ")";
3507-
os.flags(f);
3508-
return os;
3509-
}
3510-
3511-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (value.toUint32() & 0x0F), metadata);
3512-
3513-
os.flags(f);
3514-
return os;
3504+
if (value.count() != 1 || value.typeId() != unsignedByte)
3505+
return os << "(" << value << ")";
3506+
return EXV_PRINT_TAG(nikonFlashControlMode)(os, (value.toUint32() & 0x0F), metadata);
35153507
}
35163508

35173509
std::ostream& Nikon3MakerNote::printFlashMasterDataFl6(std::ostream& os, const Value& value, const ExifData* metadata) {
@@ -3573,20 +3565,9 @@ std::ostream& Nikon3MakerNote::printFlashMasterDataFl7(std::ostream& os, const V
35733565
}
35743566

35753567
std::ostream& Nikon3MakerNote::printFlashGroupAControlData(std::ostream& os, const Value& value, const ExifData* data) {
3576-
std::ios::fmtflags f(os.flags());
3577-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3578-
os << "(" << value << ")";
3579-
os.flags(f);
3580-
return os;
3581-
}
3582-
std::ostringstream oss;
3583-
oss.copyfmt(os);
3584-
3585-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (value.toUint32() & 0x0F), data);
3586-
3587-
os.copyfmt(oss);
3588-
os.flags(f);
3589-
return os;
3568+
if (value.count() != 1 || value.typeId() != unsignedByte)
3569+
return os << "(" << value << ")";
3570+
return EXV_PRINT_TAG(nikonFlashControlMode)(os, (value.toUint32() & 0x0F), data);
35903571
}
35913572

35923573
std::ostream& Nikon3MakerNote::printFlashGroupBCControlData(std::ostream& os, const Value& value,
@@ -3601,9 +3582,9 @@ std::ostream& Nikon3MakerNote::printFlashGroupBCControlData(std::ostream& os, co
36013582
oss.copyfmt(os);
36023583
const auto temp = value.toUint32();
36033584

3604-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (temp >> 4), data);
3585+
EXV_PRINT_TAG(nikonFlashControlMode)(os, (temp >> 4), data);
36053586
os << ", ";
3606-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (temp & 0x0f), data);
3587+
EXV_PRINT_TAG(nikonFlashControlMode)(os, (temp & 0x0f), data);
36073588

36083589
os.copyfmt(oss);
36093590
os.flags(f);
@@ -3785,17 +3766,9 @@ std::ostream& Nikon3MakerNote::printFlashGroupCDataFl7(std::ostream& os, const V
37853766
}
37863767

37873768
std::ostream& Nikon3MakerNote::printExternalFlashData3(std::ostream& os, const Value& value, const ExifData* data) {
3788-
std::ios::fmtflags f(os.flags());
3789-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3790-
os << "(" << value << ")";
3791-
os.flags(f);
3792-
return os;
3793-
}
3794-
3795-
printTag<std::size(nikonFlashExposureComp), nikonFlashExposureComp>(os, (value.toUint32(0) & 0x04), data);
3796-
3797-
os.flags(f);
3798-
return os;
3769+
if (value.count() != 1 || value.typeId() != unsignedByte)
3770+
return os << "(" << value << ")";
3771+
return EXV_PRINT_TAG(nikonFlashExposureComp)(os, (value.toUint32(0) & 0x04), data);
37993772
}
38003773

38013774
std::ostream& Nikon3MakerNote::printCameraExposureCompensation(std::ostream& os, const Value& value, const ExifData*) {
@@ -3811,30 +3784,17 @@ std::ostream& Nikon3MakerNote::printCameraExposureCompensation(std::ostream& os,
38113784
}
38123785

38133786
std::ostream& Nikon3MakerNote::printExternalFlashData4(std::ostream& os, const Value& value, const ExifData* metadata) {
3814-
std::ios::fmtflags f(os.flags());
3815-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3816-
os << "(" << value << ")";
3817-
os.flags(f);
3818-
return os;
3819-
}
3820-
3821-
printTag<std::size(nikonFlashIlluminationPat), nikonFlashIlluminationPat>(os, value.toUint32(0), metadata);
3822-
3823-
os.flags(f);
3824-
return os;
3787+
if (value.count() != 1 || value.typeId() != unsignedByte)
3788+
return os << "(" << value << ")";
3789+
return EXV_PRINT_TAG(nikonFlashIlluminationPat)(os, value.toUint32(0), metadata);
38253790
}
38263791

38273792
std::ostream& Nikon3MakerNote::printFlashZoomHeadPosition(std::ostream& os, const Value& value, const ExifData*) {
3828-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3793+
if (value.count() != 1 || value.typeId() != unsignedByte)
38293794
return os << "(" << value << ")";
3830-
}
3831-
3832-
auto v0 = value.toUint32(0);
3833-
if (v0 == 0) {
3834-
return os << _("n/a");
3835-
}
3836-
3837-
return os << stringFormat("{} mm", v0);
3795+
if (auto v0 = value.toUint32(0))
3796+
return os << stringFormat("{} mm", v0);
3797+
return os << _("n/a");
38383798
}
38393799

38403800
std::ostream& Nikon3MakerNote::printTimeZone(std::ostream& os, const Value& value, const ExifData*) {

src/olympusmn_int.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,18 +1582,15 @@ std::ostream& OlympusMakerNote::printCs0x0301(std::ostream& os, const Value& val
15821582

15831583
//! OlympusCs ArtFilter, tag 0x0529, OlympusCs MagicFilter, tag 0x052c
15841584
std::ostream& OlympusMakerNote::print0x0529(std::ostream& os, const Value& value, const ExifData* metadata) {
1585-
if (value.count() != 4 || value.typeId() != unsignedShort) {
1585+
if (value.count() != 4 || value.typeId() != unsignedShort)
15861586
return os << "(" << value << ")";
1587-
}
15881587

15891588
const auto v0 = value.toInt64(0);
1590-
1591-
printTag<std::size(artFilters), artFilters>(os, v0, metadata);
1589+
EXV_PRINT_TAG(artFilters)(os, v0, metadata);
15921590

15931591
if (v0 == 39) { // The "Partial color" option also has a color choice
15941592
const auto v3 = value.toInt64(3);
1595-
os << " (" << _("position") << " " << (v3 + 1) << ")";
1596-
return os;
1593+
return os << " (" << _("position") << " " << (v3 + 1) << ")";
15971594
}
15981595

15991596
return os;

0 commit comments

Comments
 (0)