55#include < iomanip>
66#include < iostream>
77
8- using EasyAccessFct = Exiv2::ExifData::const_iterator (*)(const Exiv2::ExifData&);
8+ using EasyAccessFct = std::function<Exiv2::ExifData::const_iterator(const Exiv2::ExifData&)>;
9+ using EasyAccess = std::pair<const char *, EasyAccessFct>;
910
10- struct EasyAccess {
11- const char * label_;
12- EasyAccessFct findFct_;
11+ static const EasyAccess easyAccess[] = {
12+ {" Orientation" , Exiv2::orientation},
13+ {" ISO speed" , Exiv2::isoSpeed},
14+ {" Date & time original" , Exiv2::dateTimeOriginal},
15+ {" Flash bias" , Exiv2::flashBias},
16+ {" Exposure mode" , Exiv2::exposureMode},
17+ {" Scene mode" , Exiv2::sceneMode},
18+ {" Macro mode" , Exiv2::macroMode},
19+ {" Image quality" , Exiv2::imageQuality},
20+ {" White balance" , Exiv2::whiteBalance},
21+ {" Lens name" , Exiv2::lensName},
22+ {" Saturation" , Exiv2::saturation},
23+ {" Sharpness" , Exiv2::sharpness},
24+ {" Contrast" , Exiv2::contrast},
25+ {" Scene capture type" , Exiv2::sceneCaptureType},
26+ {" Metering mode" , Exiv2::meteringMode},
27+ {" Camera make" , Exiv2::make},
28+ {" Camera model" , Exiv2::model},
29+ {" Exposure time" , Exiv2::exposureTime},
30+ {" FNumber" , Exiv2::fNumber },
31+ {" Shutter speed value" , Exiv2::shutterSpeedValue},
32+ {" Aperture value" , Exiv2::apertureValue},
33+ {" Brightness value" , Exiv2::brightnessValue},
34+ {" Exposure bias" , Exiv2::exposureBiasValue},
35+ {" Max aperture value" , Exiv2::maxApertureValue},
36+ {" Subject distance" , Exiv2::subjectDistance},
37+ {" Light source" , Exiv2::lightSource},
38+ {" Flash" , Exiv2::flash},
39+ {" Camera serial number" , Exiv2::serialNumber},
40+ {" Focal length" , Exiv2::focalLength},
41+ {" Subject location/area" , Exiv2::subjectArea},
42+ {" Flash energy" , Exiv2::flashEnergy},
43+ {" Exposure index" , Exiv2::exposureIndex},
44+ {" Sensing method" , Exiv2::sensingMethod},
45+ {" AF point" , Exiv2::afPoint},
1346};
1447
15- static const EasyAccess easyAccess[] = {{" Orientation" , Exiv2::orientation},
16- {" ISO speed" , Exiv2::isoSpeed},
17- {" Date & time original" , Exiv2::dateTimeOriginal},
18- {" Flash bias" , Exiv2::flashBias},
19- {" Exposure mode" , Exiv2::exposureMode},
20- {" Scene mode" , Exiv2::sceneMode},
21- {" Macro mode" , Exiv2::macroMode},
22- {" Image quality" , Exiv2::imageQuality},
23- {" White balance" , Exiv2::whiteBalance},
24- {" Lens name" , Exiv2::lensName},
25- {" Saturation" , Exiv2::saturation},
26- {" Sharpness" , Exiv2::sharpness},
27- {" Contrast" , Exiv2::contrast},
28- {" Scene capture type" , Exiv2::sceneCaptureType},
29- {" Metering mode" , Exiv2::meteringMode},
30- {" Camera make" , Exiv2::make},
31- {" Camera model" , Exiv2::model},
32- {" Exposure time" , Exiv2::exposureTime},
33- {" FNumber" , Exiv2::fNumber },
34- {" Shutter speed value" , Exiv2::shutterSpeedValue},
35- {" Aperture value" , Exiv2::apertureValue},
36- {" Brightness value" , Exiv2::brightnessValue},
37- {" Exposure bias" , Exiv2::exposureBiasValue},
38- {" Max aperture value" , Exiv2::maxApertureValue},
39- {" Subject distance" , Exiv2::subjectDistance},
40- {" Light source" , Exiv2::lightSource},
41- {" Flash" , Exiv2::flash},
42- {" Camera serial number" , Exiv2::serialNumber},
43- {" Focal length" , Exiv2::focalLength},
44- {" Subject location/area" , Exiv2::subjectArea},
45- {" Flash energy" , Exiv2::flashEnergy},
46- {" Exposure index" , Exiv2::exposureIndex},
47- {" Sensing method" , Exiv2::sensingMethod},
48- {" AF point" , Exiv2::afPoint}};
49-
5048int main (int argc, char ** argv) {
5149 try {
5250 Exiv2::XmpParser::initialize ();
@@ -64,9 +62,9 @@ int main(int argc, char** argv) {
6462 image->readMetadata ();
6563 Exiv2::ExifData& ed = image->exifData ();
6664
67- for (auto && ea : easyAccess) {
68- auto pos = ea. findFct_ (ed);
69- std::cout << std::setw (21 ) << std::left << ea. label_ ;
65+ for (auto && [label, fct] : easyAccess) {
66+ auto pos = fct (ed);
67+ std::cout << std::setw (21 ) << std::left << label ;
7068 if (pos != ed.end ()) {
7169 std::cout << " (" << std::setw (35 ) << pos->key () << " ) : " << pos->print (&ed) << " \n " ;
7270 } else {
0 commit comments