new ExifKey constructor based on TagInfo container. Factoring duplicate code with other ExifKey constructor
This commit is contained in:
parent
ff908547a5
commit
d49caba41e
15
src/tags.cpp
15
src/tags.cpp
@ -2801,8 +2801,7 @@ namespace Exiv2 {
|
||||
key_ = std::string(familyName_) + "." + groupName_ + "." + tagName();
|
||||
}
|
||||
|
||||
ExifKey::ExifKey(uint16_t tag, const std::string& groupName)
|
||||
: p_(new Impl)
|
||||
void ExifKey::create_internal(uint16_t tag, const std::string& groupName)
|
||||
{
|
||||
IfdId ifdId = groupId(groupName);
|
||||
// Todo: Test if this condition can be removed
|
||||
@ -2817,6 +2816,18 @@ namespace Exiv2 {
|
||||
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)
|
||||
: p_(new Impl)
|
||||
{
|
||||
|
||||
@ -173,6 +173,13 @@ namespace Exiv2 {
|
||||
and group name.
|
||||
*/
|
||||
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
|
||||
ExifKey(const ExifKey& rhs);
|
||||
//! Destructor
|
||||
@ -212,6 +219,8 @@ namespace Exiv2 {
|
||||
private:
|
||||
//! Internal virtual copy constructor.
|
||||
EXV_DLLLOCAL virtual ExifKey* clone_() const;
|
||||
//! Internal construction method.
|
||||
void create_internal(uint16_t tag, const std::string& groupName);
|
||||
|
||||
private:
|
||||
// Pimpl idiom
|
||||
|
||||
Loading…
Reference in New Issue
Block a user