Skip to content

Commit dbfbd7f

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

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
@@ -3432,7 +3432,7 @@ std::ostream& Nikon3MakerNote::printExternalFlashData1Fl6(std::ostream& os, cons
34323432

34333433
if (v0 & 0x01) {
34343434
std::ostringstream ossTemp;
3435-
printTagBitmask<std::size(nikonFlashAdaptors), nikonFlashAdaptors>(ossTemp, value, metadata);
3435+
EXV_PRINT_TAG_BITMASK(nikonFlashAdaptors)(ossTemp, value, metadata);
34363436
std::string tempStr = ossTemp.str();
34373437
if (!tempStr.empty()) {
34383438
os << ", " << tempStr;
@@ -3458,7 +3458,7 @@ std::ostream& Nikon3MakerNote::printExternalFlashData2Fl6(std::ostream& os, cons
34583458

34593459
if (v0 & 0x80) {
34603460
os << ", ";
3461-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (value.toUint32() & 0x0F), metadata);
3461+
EXV_PRINT_TAG(nikonFlashControlMode)(os, (value.toUint32() & 0x0F), metadata);
34623462
}
34633463
os.copyfmt(oss);
34643464
os.flags(f);
@@ -3483,7 +3483,7 @@ std::ostream& Nikon3MakerNote::printExternalFlashData1Fl7(std::ostream& os, cons
34833483
os << (v0 & 0x80 ? _("External flash zoom override") : _("No external flash zoom override"));
34843484

34853485
std::ostringstream ossTemp;
3486-
printTagBitmask<std::size(nikonFlashAdaptors), nikonFlashAdaptors>(ossTemp, value, metadata);
3486+
EXV_PRINT_TAG_BITMASK(nikonFlashAdaptors)(ossTemp, value, metadata);
34873487
std::string tempStr = ossTemp.str();
34883488
if (!tempStr.empty()) {
34893489
os << ", " << tempStr;
@@ -3495,17 +3495,9 @@ std::ostream& Nikon3MakerNote::printExternalFlashData1Fl7(std::ostream& os, cons
34953495
}
34963496

34973497
std::ostream& Nikon3MakerNote::printExternalFlashData2(std::ostream& os, const Value& value, const ExifData* metadata) {
3498-
std::ios::fmtflags f(os.flags());
3499-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3500-
os << "(" << value << ")";
3501-
os.flags(f);
3502-
return os;
3503-
}
3504-
3505-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (value.toUint32() & 0x0F), metadata);
3506-
3507-
os.flags(f);
3508-
return os;
3498+
if (value.count() != 1 || value.typeId() != unsignedByte)
3499+
return os << "(" << value << ")";
3500+
return EXV_PRINT_TAG(nikonFlashControlMode)(os, (value.toUint32() & 0x0F), metadata);
35093501
}
35103502

35113503
std::ostream& Nikon3MakerNote::printFlashMasterDataFl6(std::ostream& os, const Value& value, const ExifData* metadata) {
@@ -3567,20 +3559,9 @@ std::ostream& Nikon3MakerNote::printFlashMasterDataFl7(std::ostream& os, const V
35673559
}
35683560

35693561
std::ostream& Nikon3MakerNote::printFlashGroupAControlData(std::ostream& os, const Value& value, const ExifData* data) {
3570-
std::ios::fmtflags f(os.flags());
3571-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3572-
os << "(" << value << ")";
3573-
os.flags(f);
3574-
return os;
3575-
}
3576-
std::ostringstream oss;
3577-
oss.copyfmt(os);
3578-
3579-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (value.toUint32() & 0x0F), data);
3580-
3581-
os.copyfmt(oss);
3582-
os.flags(f);
3583-
return os;
3562+
if (value.count() != 1 || value.typeId() != unsignedByte)
3563+
return os << "(" << value << ")";
3564+
return EXV_PRINT_TAG(nikonFlashControlMode)(os, (value.toUint32() & 0x0F), data);
35843565
}
35853566

35863567
std::ostream& Nikon3MakerNote::printFlashGroupBCControlData(std::ostream& os, const Value& value,
@@ -3595,9 +3576,9 @@ std::ostream& Nikon3MakerNote::printFlashGroupBCControlData(std::ostream& os, co
35953576
oss.copyfmt(os);
35963577
const auto temp = value.toUint32();
35973578

3598-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (temp >> 4), data);
3579+
EXV_PRINT_TAG(nikonFlashControlMode)(os, (temp >> 4), data);
35993580
os << ", ";
3600-
printTag<std::size(nikonFlashControlMode), nikonFlashControlMode>(os, (temp & 0x0f), data);
3581+
EXV_PRINT_TAG(nikonFlashControlMode)(os, (temp & 0x0f), data);
36013582

36023583
os.copyfmt(oss);
36033584
os.flags(f);
@@ -3779,17 +3760,9 @@ std::ostream& Nikon3MakerNote::printFlashGroupCDataFl7(std::ostream& os, const V
37793760
}
37803761

37813762
std::ostream& Nikon3MakerNote::printExternalFlashData3(std::ostream& os, const Value& value, const ExifData* data) {
3782-
std::ios::fmtflags f(os.flags());
3783-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3784-
os << "(" << value << ")";
3785-
os.flags(f);
3786-
return os;
3787-
}
3788-
3789-
printTag<std::size(nikonFlashExposureComp), nikonFlashExposureComp>(os, (value.toUint32(0) & 0x04), data);
3790-
3791-
os.flags(f);
3792-
return os;
3763+
if (value.count() != 1 || value.typeId() != unsignedByte)
3764+
return os << "(" << value << ")";
3765+
return EXV_PRINT_TAG(nikonFlashExposureComp)(os, (value.toUint32(0) & 0x04), data);
37933766
}
37943767

37953768
std::ostream& Nikon3MakerNote::printCameraExposureCompensation(std::ostream& os, const Value& value, const ExifData*) {
@@ -3805,30 +3778,17 @@ std::ostream& Nikon3MakerNote::printCameraExposureCompensation(std::ostream& os,
38053778
}
38063779

38073780
std::ostream& Nikon3MakerNote::printExternalFlashData4(std::ostream& os, const Value& value, const ExifData* metadata) {
3808-
std::ios::fmtflags f(os.flags());
3809-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3810-
os << "(" << value << ")";
3811-
os.flags(f);
3812-
return os;
3813-
}
3814-
3815-
printTag<std::size(nikonFlashIlluminationPat), nikonFlashIlluminationPat>(os, value.toUint32(0), metadata);
3816-
3817-
os.flags(f);
3818-
return os;
3781+
if (value.count() != 1 || value.typeId() != unsignedByte)
3782+
return os << "(" << value << ")";
3783+
return EXV_PRINT_TAG(nikonFlashIlluminationPat)(os, value.toUint32(0), metadata);
38193784
}
38203785

38213786
std::ostream& Nikon3MakerNote::printFlashZoomHeadPosition(std::ostream& os, const Value& value, const ExifData*) {
3822-
if (value.count() != 1 || value.typeId() != unsignedByte) {
3787+
if (value.count() != 1 || value.typeId() != unsignedByte)
38233788
return os << "(" << value << ")";
3824-
}
3825-
3826-
auto v0 = value.toUint32(0);
3827-
if (v0 == 0) {
3828-
return os << _("n/a");
3829-
}
3830-
3831-
return os << stringFormat("{} mm", v0);
3789+
if (auto v0 = value.toUint32(0))
3790+
return os << stringFormat("{} mm", v0);
3791+
return os << _("n/a");
38323792
}
38333793

38343794
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)