new ExifKey constructor based on TagInfo container. Factoring duplicate code with other ExifKey constructor

v0.27.3
HumanDynamo 15 years ago
parent ff908547a5
commit d49caba41e

@ -2801,8 +2801,7 @@ namespace Exiv2 {
key_ = std::string(familyName_) + "." + groupName_ + "." + tagName(); key_ = std::string(familyName_) + "." + groupName_ + "." + tagName();
} }
ExifKey::ExifKey(uint16_t tag, const std::string& groupName) void ExifKey::create_internal(uint16_t tag, const std::string& groupName)
: p_(new Impl)
{ {
IfdId ifdId = groupId(groupName); IfdId ifdId = groupId(groupName);
// Todo: Test if this condition can be removed // Todo: Test if this condition can be removed
@ -2817,6 +2816,18 @@ namespace Exiv2 {
p_->makeKey(tag, ifdId, ti); p_->makeKey(tag, ifdId, ti);
} }
ExifKey::ExifKey(uint16_t tag, const std::string& groupName)
: p_(new Impl)
{
create_internal(tag, groupName);
}
ExifKey::ExifKey(const TagInfo& ti)
: p_(new Impl)
{
create_internal(ti.tag_, Internal::groupName(static_cast<Internal::IfdId>(ti.ifdId_)));
}
ExifKey::ExifKey(const std::string& key) ExifKey::ExifKey(const std::string& key)
: p_(new Impl) : p_(new Impl)
{ {

@ -173,6 +173,13 @@ namespace Exiv2 {
and group name. and group name.
*/ */
ExifKey(uint16_t tag, const std::string& groupName); ExifKey(uint16_t tag, const std::string& groupName);
/*!
@brief Constructor to create an Exif key from a TagInfo instance.
@param ti The TagInfo instance
@throw Error if the key cannot be constructed from the tag number
and group name.
*/
ExifKey(const TagInfo& ti);
//! Copy constructor //! Copy constructor
ExifKey(const ExifKey& rhs); ExifKey(const ExifKey& rhs);
//! Destructor //! Destructor
@ -212,6 +219,8 @@ namespace Exiv2 {
private: private:
//! Internal virtual copy constructor. //! Internal virtual copy constructor.
EXV_DLLLOCAL virtual ExifKey* clone_() const; EXV_DLLLOCAL virtual ExifKey* clone_() const;
//! Internal construction method.
void create_internal(uint16_t tag, const std::string& groupName);
private: private:
// Pimpl idiom // Pimpl idiom

Loading…
Cancel
Save