Derive lens name from 0xA434 and 0xA433 if other means fail (#5157)

Implemented for
- Pentax
- Canon
- "Unknown"

Also constified `toString()` methods in `rtexif`.
This commit is contained in:
Flössie
2019-03-07 19:29:11 +01:00
parent a91acfacf2
commit 70475f781a
9 changed files with 156 additions and 104 deletions

View File

@@ -58,7 +58,7 @@ const enum ByteOrder HOSTORDER = MOTOROLA;
#endif
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);
int sget4 (unsigned char *s, ByteOrder order);
@@ -293,7 +293,7 @@ public:
int getDistanceFrom (const TagDirectory *root);
// additional getter/setter for more comfortable use
std::string valueToString ();
std::string valueToString () const;
std::string nameToString (int i = 0);
void valueFromString (const std::string& value);
void userCommentFromString (const Glib::ustring& text);
@@ -372,7 +372,7 @@ class Interpreter
public:
Interpreter () {}
virtual ~Interpreter() {};
virtual std::string toString (Tag* t)
virtual std::string toString (const Tag* t) const
{
char buffer[1024];
t->toString (buffer);
@@ -493,7 +493,7 @@ protected:
Choices choices;
public:
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());
@@ -512,11 +512,11 @@ class IntLensInterpreter : public Interpreter
{
protected:
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;
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;
size_t nFound = choices.count ( lensID );