merge with dev

This commit is contained in:
Desmis 2019-03-08 16:22:52 +01:00
commit 43bf1f6cd9
10 changed files with 159 additions and 107 deletions

View File

@ -1265,7 +1265,7 @@ void DCPProfile::step2ApplyTile(float* rc, float* gc, float* bc, int width, int
float cnewb = FCLIP(newb); float cnewb = FCLIP(newb);
float h, s, v; float h, s, v;
Color::rgb2hsvdcp(cnewr, cnewg, cnewb, h, s, v); Color::rgb2hsvtc(cnewr, cnewg, cnewb, h, s, v);
hsdApply(look_info, look_table, h, s, v); hsdApply(look_info, look_table, h, s, v);
s = CLIP01(s); s = CLIP01(s);
@ -1648,7 +1648,7 @@ std::vector<DCPProfile::HsbModify> DCPProfile::makeHueSatMap(const ColorTemp& wh
return res; return res;
} }
void DCPProfile::hsdApply(const HsdTableInfo& table_info, const std::vector<HsbModify>& table_base, float& h, float& s, float& v) const inline void DCPProfile::hsdApply(const HsdTableInfo& table_info, const std::vector<HsbModify>& table_base, float& h, float& s, float& v) const
{ {
// Apply the HueSatMap. Ported from Adobes reference implementation. // Apply the HueSatMap. Ported from Adobes reference implementation.
float hue_shift; float hue_shift;

View File

@ -306,6 +306,38 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
} }
if (lens == "Unknown") { if (lens == "Unknown") {
const auto lens_from_make_and_model =
[this, exif]() -> bool
{
if (!exif) {
return false;
}
const rtexif::Tag* const lens_model = exif->getTag(0xA434);
if (lens_model) {
const rtexif::Tag* const lens_make = exif->getTag(0xA433);
const std::string make =
lens_make
? lens_make->valueToString()
: std::string();
const std::string model = lens_model->valueToString();
if (!model.empty()) {
lens = make;
if (!lens.empty()) {
lens += ' ';
}
lens += model;
return true;
}
}
return false;
};
if (mnote) { if (mnote) {
@ -412,11 +444,15 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
rtexif::Tag *lt = mnote->getTag("LensType"); rtexif::Tag *lt = mnote->getTag("LensType");
if (lt) { if (lt) {
std::string ldata = lt->valueToString(); if (lt->toInt()) {
std::string ldata = lt->valueToString ();
if (ldata.size() > 1) { if (ldata.size() > 1) {
found = true; found = true;
lens = "Canon " + ldata; lens = "Canon " + ldata;
}
} else {
found = lens_from_make_and_model();
} }
} }
@ -446,7 +482,13 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
} }
if (mnote->getTag("LensType")) { if (mnote->getTag("LensType")) {
lens = mnote->getTag("LensType")->valueToString(); lens = mnote->getTag ("LensType")->valueToString();
if (!mnote->getTag("LensType")->toInt()) {
// try to find something better than "M-42 or No Lens"
lens_from_make_and_model();
}
} else {
lens_from_make_and_model();
} }
// Try to get the FocalLength from the LensInfo structure, where length below 10mm will be correctly set // Try to get the FocalLength from the LensInfo structure, where length below 10mm will be correctly set
@ -490,9 +532,7 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
} }
} else if (exif->getTag("DNGLensInfo")) { } else if (exif->getTag("DNGLensInfo")) {
lens = exif->getTag("DNGLensInfo")->valueToString(); lens = exif->getTag("DNGLensInfo")->valueToString();
} else if (exif->getTag("LensModel")) { } else if (!lens_from_make_and_model() && exif->getTag ("LensInfo")) {
lens = exif->getTag("LensModel")->valueToString();
} else if (exif->getTag("LensInfo")) {
lens = exif->getTag("LensInfo")->valueToString(); lens = exif->getTag("LensInfo")->valueToString();
} }
} }

View File

@ -32,7 +32,7 @@ namespace rtexif
class CAOnOffInterpreter : public Interpreter class CAOnOffInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int n = t->toInt(); int n = t->toInt();
@ -51,7 +51,7 @@ class CAIntSerNumInterpreter : public Interpreter
{ {
public: public:
CAIntSerNumInterpreter () {} CAIntSerNumInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
return ""; return "";
} }
@ -63,7 +63,7 @@ class CAApertureInterpreter : public Interpreter
{ {
public: public:
CAApertureInterpreter () {} CAApertureInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double v = pow (2.0, t->toDouble() / 64.0); double v = pow (2.0, t->toDouble() / 64.0);
@ -92,7 +92,7 @@ CAMacroModeInterpreter caMacroModeInterpreter;
class CASelfTimerInterpreter : public Interpreter class CASelfTimerInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int sec = t->toInt (0, SHORT); int sec = t->toInt (0, SHORT);
@ -385,7 +385,7 @@ CAExposureModeInterpreter caExposureModeInterpreter;
class CAFlashBitsInterpreter : public Interpreter class CAFlashBitsInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream s; std::ostringstream s;
unsigned bits = t->toInt (0, SHORT); unsigned bits = t->toInt (0, SHORT);
@ -533,7 +533,7 @@ CARAWQualityInterpreter caRAWQualityInterpreter;
class CAFocalInterpreter : public Interpreter class CAFocalInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
Tag *unitTag = t->getParent()->getRoot()->findTag ("FocalUnits"); Tag *unitTag = t->getParent()->getRoot()->findTag ("FocalUnits");
double v = unitTag ? unitTag->toDouble() : 1.; double v = unitTag ? unitTag->toDouble() : 1.;
@ -957,7 +957,7 @@ public:
}; };
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int lensID = t->toInt(); int lensID = t->toInt();
@ -1109,7 +1109,7 @@ CAFocalTypeInterpreter caFocalTypeInterpreter;
class CAFocalPlaneInterpreter : public Interpreter class CAFocalPlaneInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int val = t->toInt(); int val = t->toInt();
@ -1127,7 +1127,7 @@ CAFocalPlaneInterpreter caFocalPlaneInterpreter;
class CAExposureTimeInterpreter : public Interpreter class CAExposureTimeInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double d = pow (2, - t->toInt() / 32.0); double d = pow (2, - t->toInt() / 32.0);
@ -1139,7 +1139,7 @@ CAExposureTimeInterpreter caExposureTimeInterpreter;
class CAEVInterpreter : public Interpreter class CAEVInterpreter : public Interpreter
{ {
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%.1f", t->toDouble() / 32.0 ); sprintf (buffer, "%.1f", t->toDouble() / 32.0 );
@ -1151,7 +1151,7 @@ CAEVInterpreter caEVInterpreter;
class CABaseISOInterpreter : public Interpreter class CABaseISOInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
int a = t->toInt(); int a = t->toInt();
@ -1288,7 +1288,7 @@ CASlowShutterInterpreter caSlowShutterInterpreter;
class CAFlashGuideNumberInterpreter : public Interpreter class CAFlashGuideNumberInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int n = t->toInt(); int n = t->toInt();
@ -1349,7 +1349,7 @@ CAControModeInterpreter caControModeInterpreter;
class CAFocusDistanceInterpreter : public Interpreter class CAFocusDistanceInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%.2f", t->toDouble() / 100 ); sprintf (buffer, "%.2f", t->toDouble() / 100 );
@ -1361,7 +1361,7 @@ CAFocusDistanceInterpreter caFocusDistanceInterpreter;
class CAMeasuredEVInterpreter : public Interpreter class CAMeasuredEVInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%.1f", t->toDouble() / 8 - 6 ); sprintf (buffer, "%.1f", t->toDouble() / 8 - 6 );
@ -1496,7 +1496,7 @@ CAToningEffectInterpreter caToningEffectInterpreter;
class CAFileNumberInterpreter : public Interpreter class CAFileNumberInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
unsigned long val = t->toInt (0, LONG); unsigned long val = t->toInt (0, LONG);
char buffer[32]; char buffer[32];

View File

@ -34,7 +34,7 @@ class NAISOInterpreter : public Interpreter
{ {
public: public:
NAISOInterpreter () {} NAISOInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%d", t->toInt (2)); sprintf (buffer, "%d", t->toInt (2));
@ -47,7 +47,7 @@ class NAISOInfoISOInterpreter : public Interpreter
{ {
public: public:
NAISOInfoISOInterpreter () {} NAISOInfoISOInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
int a = t->toInt(); int a = t->toInt();
@ -83,7 +83,7 @@ class NAISOExpansionInterpreter : public Interpreter
{ {
public: public:
NAISOExpansionInterpreter () {} NAISOExpansionInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt(); int a = t->toInt();
@ -142,7 +142,7 @@ class NALensTypeInterpreter : public Interpreter
{ {
public: public:
NALensTypeInterpreter () {} NALensTypeInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt(); int a = t->toInt();
std::ostringstream str; std::ostringstream str;
@ -191,7 +191,7 @@ class NAShootingModeInterpreter : public Interpreter
{ {
public: public:
NAShootingModeInterpreter () {} NAShootingModeInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt(); int a = t->toInt();
std::ostringstream str; std::ostringstream str;
@ -234,14 +234,26 @@ public:
afpchoices[0x9] = "Far Left"; afpchoices[0x9] = "Far Left";
afpchoices[0xa] = "Far Right"; afpchoices[0xa] = "Far Right";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const auto get_from_choices =
[](const std::map<int, std::string>& choices, int index) -> std::string
{
const std::map<int, std::string>::const_iterator choice = choices.find(index);
if (choice != choices.end()) {
return choice->second;
}
return {};
};
int am = t->toInt (0, BYTE); int am = t->toInt (0, BYTE);
int afp = t->toInt (1, BYTE); int afp = t->toInt (1, BYTE);
int aff = t->toInt (2, SHORT); int aff = t->toInt (2, SHORT);
std::ostringstream str; std::ostringstream str;
str << "AFAreaMode = " << amchoices[am] << std::endl; str << "AFAreaMode = " << get_from_choices(amchoices, am) << std::endl;
str << "AFAreaMode = " << afpchoices[afp] << std::endl; str << "AFAreaMode = " << get_from_choices(afpchoices, afp) << std::endl;
std::ostringstream af; std::ostringstream af;
@ -314,7 +326,7 @@ class NALensDataInterpreter : public Interpreter
static const std::map<std::string, std::string> lenses; static const std::map<std::string, std::string> lenses;
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
static const unsigned char xlat[2][256] = { static const unsigned char xlat[2][256] = {

View File

@ -33,7 +33,7 @@ class OLOnOffInterpreter : public Interpreter
{ {
public: public:
OLOnOffInterpreter () {} OLOnOffInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
if (t->toInt() == 0) { if (t->toInt() == 0) {
return "Off"; return "Off";
@ -48,7 +48,7 @@ class OLYesNoInterpreter : public Interpreter
{ {
public: public:
OLYesNoInterpreter () {} OLYesNoInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
if (t->toInt() == 0) { if (t->toInt() == 0) {
return "No"; return "No";
@ -63,7 +63,7 @@ class OLApertureInterpreter : public Interpreter
{ {
public: public:
OLApertureInterpreter () {} OLApertureInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
str.precision (2); str.precision (2);
@ -194,7 +194,7 @@ public:
lenses["03 02 00"] = "Leica D Summilux 25mm f/1.4 Asph."; lenses["03 02 00"] = "Leica D Summilux 25mm f/1.4 Asph.";
lenses["05 01 10"] = "Tamron 14-150mm f/3.5-5.8 Di III"; lenses["05 01 10"] = "Tamron 14-150mm f/3.5-5.8 Di III";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream lid; std::ostringstream lid;
lid.setf (std::ios_base::hex, std::ios_base::basefield); lid.setf (std::ios_base::hex, std::ios_base::basefield);
@ -203,7 +203,7 @@ public:
lid << std::setw (2) << std::setfill ('0') << t->toInt (2) << ' '; //model lid << std::setw (2) << std::setfill ('0') << t->toInt (2) << ' '; //model
lid << std::setw (2) << std::setfill ('0') << t->toInt (3); // submodel lid << std::setw (2) << std::setfill ('0') << t->toInt (3); // submodel
std::map<std::string, std::string>::iterator r = lenses.find (lid.str()); std::map<std::string, std::string>::const_iterator r = lenses.find (lid.str());
if (r != lenses.end()) { if (r != lenses.end()) {
return r->second; return r->second;
@ -465,7 +465,7 @@ class OLNoiseFilterInterpreter : public Interpreter
{ {
public: public:
OLNoiseFilterInterpreter () {} OLNoiseFilterInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0); int a = t->toInt (0);
int b = t->toInt (2); int b = t->toInt (2);
@ -490,7 +490,7 @@ class OLFlashModeInterpreter : public Interpreter
{ {
public: public:
OLFlashModeInterpreter () {} OLFlashModeInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
int a = t->toInt (); int a = t->toInt ();
@ -509,7 +509,7 @@ class OLNoiseReductionInterpreter : public Interpreter
{ {
public: public:
OLNoiseReductionInterpreter () {} OLNoiseReductionInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
int a = t->toInt (); int a = t->toInt ();

View File

@ -415,7 +415,7 @@ class PAFNumberInterpreter: public Interpreter
{ {
public: public:
PAFNumberInterpreter () {} PAFNumberInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double v = t->toDouble() / 10; double v = t->toDouble() / 10;
@ -610,7 +610,7 @@ public:
choices[256 * 255 + 0] = "Video (Auto Aperture)"; choices[256 * 255 + 0] = "Video (Auto Aperture)";
choices[256 * 255 + 4] = "Video (4)"; choices[256 * 255 + 4] = "Video (4)";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int c = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE); int c = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE);
const ChoicesIterator r = choices.find (c); const ChoicesIterator r = choices.find (c);
@ -669,12 +669,12 @@ public:
choices3[224] = "HDR Auto"; choices3[224] = "HDR Auto";
choices3[255] = "Video"; choices3[255] = "Video";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); const ChoicesIterator r = choices.find (t->toInt (0, BYTE));
std::map<int, std::string>::iterator r1 = choices1.find (t->toInt (1, BYTE)); std::map<int, std::string>::const_iterator r1 = choices1.find (t->toInt (1, BYTE));
std::map<int, std::string>::iterator r2 = choices2.find (t->toInt (2, BYTE)); std::map<int, std::string>::const_iterator r2 = choices2.find (t->toInt (2, BYTE));
std::map<int, std::string>::iterator r3 = choices3.find (t->toInt (3, BYTE)); std::map<int, std::string>::const_iterator r3 = choices3.find (t->toInt (3, BYTE));
std::ostringstream s; std::ostringstream s;
s << ((r != choices.end()) ? r->second : ""); s << ((r != choices.end()) ? r->second : "");
s << ((r1 != choices1.end()) ? r1->second : "") << " "; s << ((r1 != choices1.end()) ? r1->second : "") << " ";
@ -993,7 +993,7 @@ public:
choices.insert (p_t (256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1")); choices.insert (p_t (256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1"));
choices.insert (p_t (256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8")); choices.insert (p_t (256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8"));
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
double *liArray = nullptr; double *liArray = nullptr;
double maxApertureAtFocal = 0.; double maxApertureAtFocal = 0.;
@ -1061,7 +1061,7 @@ class PASRResultInterpreter: public Interpreter
{ {
public: public:
PASRResultInterpreter() { } PASRResultInterpreter() { }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
int b = t->toInt (0, BYTE); int b = t->toInt (0, BYTE);
@ -1146,7 +1146,7 @@ public:
choices[ 2 << 8 | 4 ] = "Auto"; choices[ 2 << 8 | 4 ] = "Auto";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int idx = 0; int idx = 0;
@ -1173,7 +1173,7 @@ public:
choices[2] = "Standard"; choices[2] = "Standard";
choices[3] = "Fast"; choices[3] = "Fast";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); const ChoicesIterator r = choices.find (t->toInt (0, BYTE));
std::ostringstream s; std::ostringstream s;
@ -1211,7 +1211,7 @@ public:
choices[2] = "Medium"; choices[2] = "Medium";
choices[3] = "High"; choices[3] = "High";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); const ChoicesIterator r = choices.find (t->toInt (0, BYTE));
std::ostringstream s; std::ostringstream s;
@ -1243,11 +1243,11 @@ public:
choices2[8] = "2 EV"; choices2[8] = "2 EV";
choices2[12] = "3 EV"; choices2[12] = "3 EV";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const ChoicesIterator r = choices.find (t->toInt (0, BYTE)); const ChoicesIterator r = choices.find (t->toInt (0, BYTE));
std::map<int, std::string>::iterator r1 = choices1.find (t->toInt (1, BYTE)); std::map<int, std::string>::const_iterator r1 = choices1.find (t->toInt (1, BYTE));
std::map<int, std::string>::iterator r2 = choices2.find (t->toInt (2, BYTE)); std::map<int, std::string>::const_iterator r2 = choices2.find (t->toInt (2, BYTE));
std::ostringstream s; std::ostringstream s;
s << ((r != choices.end() ) ? r->second : "") << std::endl; s << ((r != choices.end() ) ? r->second : "") << std::endl;
s << ((r1 != choices1.end()) ? r1->second : "") << std::endl; s << ((r1 != choices1.end()) ? r1->second : "") << std::endl;
@ -1290,7 +1290,7 @@ class PALensModelQInterpreter: public Interpreter
{ {
public: public:
PALensModelQInterpreter() {} PALensModelQInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[31]; char buffer[31];
buffer[0] = 0; // buffer[0] = 0; //
@ -1308,7 +1308,7 @@ class PALensInfoQInterpreter: public Interpreter
{ {
public: public:
PALensInfoQInterpreter() {} PALensInfoQInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[21]; char buffer[21];
buffer[0] = 0; buffer[0] = 0;
@ -1326,7 +1326,7 @@ class PAFlashExposureCompInterpreter: public Interpreter
{ {
public: public:
PAFlashExposureCompInterpreter() {} PAFlashExposureCompInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a; int a;
@ -1359,7 +1359,7 @@ class PAFocalLengthInterpreter: public Interpreter
{ {
public: public:
PAFocalLengthInterpreter() {} PAFocalLengthInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
double a = double (t->toInt (0, LONG)); double a = double (t->toInt (0, LONG));
@ -1388,7 +1388,7 @@ class PALensDataFocalLengthInterpreter: public Interpreter
{ {
public: public:
PALensDataFocalLengthInterpreter() {} PALensDataFocalLengthInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2));
@ -1419,7 +1419,7 @@ class PAISOfInterpreter: public Interpreter
{ {
public: public:
PAISOfInterpreter() {} PAISOfInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
char buffer[32]; char buffer[32];
@ -1439,7 +1439,7 @@ class PAMaxApertureInterpreter: public Interpreter
{ {
public: public:
PAMaxApertureInterpreter() {} PAMaxApertureInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
a &= 0x7F; a &= 0x7F;
@ -1476,7 +1476,7 @@ class PAAEXvInterpreter: public Interpreter
{ {
public: public:
PAAEXvInterpreter() {} PAAEXvInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
char buffer[32]; char buffer[32];
@ -1496,7 +1496,7 @@ class PAAEBXvInterpreter: public Interpreter
{ {
public: public:
PAAEBXvInterpreter() {} PAAEBXvInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, SBYTE); int a = t->toInt (0, SBYTE);
char buffer[32]; char buffer[32];
@ -1516,7 +1516,7 @@ class PAApertureInterpreter: public Interpreter
{ {
public: public:
PAApertureInterpreter() {} PAApertureInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
char buffer[32]; char buffer[32];
@ -1536,7 +1536,7 @@ class PAExposureTimeInterpreter: public Interpreter
{ {
public: public:
PAExposureTimeInterpreter() {} PAExposureTimeInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
char buffer[32]; char buffer[32];
@ -1556,7 +1556,7 @@ class PANominalMinApertureInterpreter: public Interpreter
{ {
public: public:
PANominalMinApertureInterpreter() {} PANominalMinApertureInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
@ -1576,7 +1576,7 @@ class PANominalMaxApertureInterpreter: public Interpreter
{ {
public: public:
PANominalMaxApertureInterpreter() {} PANominalMaxApertureInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
int a = t->toInt (0, BYTE); int a = t->toInt (0, BYTE);
@ -1694,7 +1694,7 @@ class PAExternalFlashGNInterpreter: public Interpreter
{ {
public: public:
PAExternalFlashGNInterpreter() {} PAExternalFlashGNInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
int b = t->toInt (0, BYTE) & 0x1F; int b = t->toInt (0, BYTE) & 0x1F;
@ -1708,7 +1708,7 @@ class PAEVStepsInterpreter: public Interpreter
{ {
public: public:
PAEVStepsInterpreter() {} PAEVStepsInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
@ -1727,7 +1727,7 @@ class PAEDialinInterpreter: public Interpreter
{ {
public: public:
PAEDialinInterpreter() {} PAEDialinInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
@ -1746,7 +1746,7 @@ class PAApertureRingUseInterpreter: public Interpreter
{ {
public: public:
PAApertureRingUseInterpreter() {} PAApertureRingUseInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
@ -1776,7 +1776,7 @@ public:
choices[9] = "Slow-sync, Red-eye reduction"; choices[9] = "Slow-sync, Red-eye reduction";
choices[10] = "Trailing-curtain Sync"; choices[10] = "Trailing-curtain Sync";
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const ChoicesIterator r = choices.find (t->toInt (0, BYTE) >> 4); const ChoicesIterator r = choices.find (t->toInt (0, BYTE) >> 4);
@ -1795,7 +1795,7 @@ class PAMeteringMode2Interpreter: public Interpreter
{ {
public: public:
PAMeteringMode2Interpreter() {} PAMeteringMode2Interpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
int v = (t->toInt (0, BYTE) & 0xF); int v = (t->toInt (0, BYTE) & 0xF);
@ -1859,7 +1859,7 @@ class PAProgramLineInterpreter: public Interpreter
{ {
public: public:
PAProgramLineInterpreter() {} PAProgramLineInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::ostringstream str; std::ostringstream str;
int c = t->toInt (0, BYTE); int c = t->toInt (0, BYTE);
@ -1899,7 +1899,7 @@ class PAAFModeInterpreter: public Interpreter
{ {
public: public:
PAAFModeInterpreter() {} PAAFModeInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
switch (t->toInt (0, BYTE) & 0x3) { switch (t->toInt (0, BYTE) & 0x3) {
case 0: case 0:
@ -1925,7 +1925,7 @@ class PAAFPointSelectedInterpreter: public Interpreter
{ {
public: public:
PAAFPointSelectedInterpreter() {} PAAFPointSelectedInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int c = t->toInt (0, SHORT); int c = t->toInt (0, SHORT);
@ -1949,7 +1949,7 @@ class PADriveMode2Interpreter: public Interpreter
{ {
public: public:
PADriveMode2Interpreter() {} PADriveMode2Interpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int c = t->toInt (0, BYTE); int c = t->toInt (0, BYTE);

View File

@ -1767,7 +1767,7 @@ std::string Tag::nameToString (int i)
return buffer; return buffer;
} }
std::string Tag::valueToString () std::string Tag::valueToString () const
{ {
if (attrib && attrib->interpreter) { if (attrib && attrib->interpreter) {
@ -3439,7 +3439,7 @@ short int int2_to_signed (short unsigned int i)
* <focal>-<focal>mm f/<aperture>-<aperture> * <focal>-<focal>mm f/<aperture>-<aperture>
* NB: no space between separator '-'; no space between focal length and 'mm' * NB: no space between separator '-'; no space between focal length and 'mm'
*/ */
bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) bool extractLensInfo (const std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal)
{ {
minFocal = 0.0; minFocal = 0.0;
maxFocal = 0.0; maxFocal = 0.0;

View File

@ -58,7 +58,7 @@ const enum ByteOrder HOSTORDER = MOTOROLA;
#endif #endif
enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI, TABLESUBDIR}; enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI, TABLESUBDIR};
bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); bool extractLensInfo (const std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal);
unsigned short sget2 (unsigned char *s, ByteOrder order); unsigned short sget2 (unsigned char *s, ByteOrder order);
int sget4 (unsigned char *s, ByteOrder order); int sget4 (unsigned char *s, ByteOrder order);
@ -293,7 +293,7 @@ public:
int getDistanceFrom (const TagDirectory *root); int getDistanceFrom (const TagDirectory *root);
// additional getter/setter for more comfortable use // additional getter/setter for more comfortable use
std::string valueToString (); std::string valueToString () const;
std::string nameToString (int i = 0); std::string nameToString (int i = 0);
void valueFromString (const std::string& value); void valueFromString (const std::string& value);
void userCommentFromString (const Glib::ustring& text); void userCommentFromString (const Glib::ustring& text);
@ -372,7 +372,7 @@ class Interpreter
public: public:
Interpreter () {} Interpreter () {}
virtual ~Interpreter() {}; virtual ~Interpreter() {};
virtual std::string toString (Tag* t) virtual std::string toString (const Tag* t) const
{ {
char buffer[1024]; char buffer[1024];
t->toString (buffer); t->toString (buffer);
@ -493,7 +493,7 @@ protected:
Choices choices; Choices choices;
public: public:
ChoiceInterpreter () {}; ChoiceInterpreter () {};
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
const typename std::map<T, std::string>::const_iterator r = choices.find(t->toInt()); const typename std::map<T, std::string>::const_iterator r = choices.find(t->toInt());
@ -512,11 +512,11 @@ class IntLensInterpreter : public Interpreter
{ {
protected: protected:
typedef std::multimap< T, std::string> container_t; typedef std::multimap< T, std::string> container_t;
typedef typename std::multimap< T, std::string>::iterator it_t; typedef typename std::multimap< T, std::string>::const_iterator it_t;
typedef std::pair< T, std::string> p_t; typedef std::pair< T, std::string> p_t;
container_t choices; container_t choices;
virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) const
{ {
it_t r; it_t r;
size_t nFound = choices.count ( lensID ); size_t nFound = choices.count ( lensID );

View File

@ -1158,7 +1158,7 @@ public:
}; };
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int lensID = t->toInt(); int lensID = t->toInt();
Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo");
@ -1309,7 +1309,7 @@ public:
choices.insert (p_t (51507, "Samyang AF 35mm f/1.4")); choices.insert (p_t (51507, "Samyang AF 35mm f/1.4"));
} }
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int lensID = t->toInt(); int lensID = t->toInt();
Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo");
@ -2103,7 +2103,7 @@ class SAExposureTimeInterpreter : public Interpreter
{ {
public: public:
SAExposureTimeInterpreter () {} SAExposureTimeInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
double a = t->toDouble(); double a = t->toDouble();
@ -2163,7 +2163,7 @@ class SAFNumberInterpreter : public Interpreter
{ {
public: public:
SAFNumberInterpreter () {} SAFNumberInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
double a = double (t->toDouble()); double a = double (t->toDouble());
@ -2223,7 +2223,7 @@ class SAISOSettingInterpreter : public Interpreter
{ {
public: public:
SAISOSettingInterpreter () {} SAISOSettingInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->toInt(); int a = t->toInt();
@ -2264,7 +2264,7 @@ class SAExposureCompSetInterpreter : public Interpreter
{ {
public: public:
SAExposureCompSetInterpreter () {} SAExposureCompSetInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
double a = t->toDouble(); double a = t->toDouble();
char buffer[32]; char buffer[32];
@ -2285,7 +2285,7 @@ class SAAFMicroAdjValueInterpreter : public Interpreter
{ {
public: public:
SAAFMicroAdjValueInterpreter() {} SAAFMicroAdjValueInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%d", t->getValue()[0] - 20); sprintf (buffer, "%d", t->getValue()[0] - 20);
@ -2302,7 +2302,7 @@ class SAAFMicroAdjModeInterpreter : public Interpreter
{ {
public: public:
SAAFMicroAdjModeInterpreter() {} SAAFMicroAdjModeInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int a = t->getValue()[0] & 0x80; int a = t->getValue()[0] & 0x80;
@ -2324,7 +2324,7 @@ class SAAFMicroAdjRegisteredLensesInterpreter : public Interpreter
{ {
public: public:
SAAFMicroAdjRegisteredLensesInterpreter() {} SAAFMicroAdjRegisteredLensesInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%d", t->getValue()[0] & 0x7f); sprintf (buffer, "%d", t->getValue()[0] & 0x7f);
@ -2341,7 +2341,7 @@ class SAFocusStatusInterpreter : public Interpreter
{ {
public: public:
SAFocusStatusInterpreter () {} SAFocusStatusInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
std::string retval; std::string retval;
int a = t->toInt(); int a = t->toInt();
@ -2380,7 +2380,7 @@ class SAColorTemperatureSettingInterpreter : public Interpreter
{ {
public: public:
SAColorTemperatureSettingInterpreter () {} SAColorTemperatureSettingInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
sprintf (buffer, "%d", t->toInt()); sprintf (buffer, "%d", t->toInt());

View File

@ -327,7 +327,7 @@ class FNumberInterpreter : public Interpreter
{ {
public: public:
FNumberInterpreter () {} FNumberInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double v = t->toDouble(); double v = t->toDouble();
@ -346,7 +346,7 @@ class ApertureInterpreter : public Interpreter
{ {
public: public:
ApertureInterpreter () {} ApertureInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double v = pow (2.0, t->toDouble() / 2.0); double v = pow (2.0, t->toDouble() / 2.0);
@ -365,7 +365,7 @@ class ExposureBiasInterpreter : public Interpreter
{ {
public: public:
ExposureBiasInterpreter () {} ExposureBiasInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double v = t->toDouble(); double v = t->toDouble();
@ -384,7 +384,7 @@ class ShutterSpeedInterpreter : public Interpreter
{ {
public: public:
ShutterSpeedInterpreter () {} ShutterSpeedInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double d = pow (2.0, -t->toDouble()); double d = pow (2.0, -t->toDouble());
@ -404,7 +404,7 @@ class ExposureTimeInterpreter : public Interpreter
{ {
public: public:
ExposureTimeInterpreter () {} ExposureTimeInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double d = t->toDouble(); double d = t->toDouble();
@ -424,7 +424,7 @@ class FocalLengthInterpreter : public Interpreter
{ {
public: public:
FocalLengthInterpreter () {} FocalLengthInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char buffer[32]; char buffer[32];
double v = t->toDouble(); double v = t->toDouble();
@ -443,7 +443,7 @@ class UserCommentInterpreter : public Interpreter
{ {
public: public:
UserCommentInterpreter () {} UserCommentInterpreter () {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int count = t->getCount(); int count = t->getCount();
@ -575,7 +575,7 @@ class CFAInterpreter : public Interpreter
{ {
public: public:
CFAInterpreter() {} CFAInterpreter() {}
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
char colors[] = "RGB"; char colors[] = "RGB";
char buffer[1024]; char buffer[1024];
@ -632,7 +632,7 @@ UTF8BinInterpreter utf8BinInterpreter;
class RawImageSegmentationInterpreter : public Interpreter class RawImageSegmentationInterpreter : public Interpreter
{ {
public: public:
std::string toString (Tag* t) override std::string toString (const Tag* t) const override
{ {
int segmentNumber = t->toInt(0, SHORT); int segmentNumber = t->toInt(0, SHORT);
int segmentWidth = t->toInt(2, SHORT); int segmentWidth = t->toInt(2, SHORT);