#721: Removed Exif-specific reference functions from the ExifKey interface again.
This commit is contained in:
parent
348bc4a21c
commit
a0bdc5528e
@ -14,6 +14,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
using namespace Exiv2;
|
||||
|
||||
@ -59,13 +60,13 @@ int main()
|
||||
}
|
||||
// ifdName
|
||||
tc += 1;
|
||||
if (std::string(ek.ifdName()) != "Iop") {
|
||||
if (std::string(ExifTags::ifdName(ek.groupName())) != "Iop") {
|
||||
std::cout << "Testcase failed (ifdName: " << std::endl;
|
||||
rc += 1;
|
||||
}
|
||||
// sectionName
|
||||
tc += 1;
|
||||
if (ek.sectionName() != "Interoperability") {
|
||||
if (strcmp(ExifTags::sectionName(ek), "Interoperability") != 0) {
|
||||
std::cout << "Testcase failed (sectionName)" << std::endl;
|
||||
rc += 1;
|
||||
}
|
||||
@ -109,13 +110,13 @@ int main()
|
||||
}
|
||||
// ifdName
|
||||
tc += 1;
|
||||
if (std::string(ek2.ifdName()) != "Iop") {
|
||||
if (std::string(ExifTags::ifdName(ek2.groupName())) != "Iop") {
|
||||
std::cout << "Testcase failed (ifdName: " << std::endl;
|
||||
rc += 1;
|
||||
}
|
||||
// sectionName
|
||||
tc += 1;
|
||||
if (ek2.sectionName() != "Interoperability") {
|
||||
if (strcmp(ExifTags::sectionName(ek2), "Interoperability") != 0) {
|
||||
std::cout << "Testcase failed (sectionName)" << std::endl;
|
||||
rc += 1;
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ namespace Exiv2 {
|
||||
|
||||
const char* Exifdatum::ifdName() const
|
||||
{
|
||||
return key_.get() == 0 ? "" : key_->ifdName();
|
||||
return key_.get() == 0 ? "" : Internal::ifdName(static_cast<Internal::IfdId>(key_->ifdId()));
|
||||
}
|
||||
|
||||
int Exifdatum::idx() const
|
||||
|
||||
50
src/tags.cpp
50
src/tags.cpp
@ -2640,6 +2640,26 @@ namespace Exiv2 {
|
||||
return ii->tagList_();
|
||||
} // ExifTags::tagList
|
||||
|
||||
const char* ExifTags::sectionName(const ExifKey& key)
|
||||
{
|
||||
const TagInfo* ti = tagInfo(key.tag(), static_cast<Internal::IfdId>(key.ifdId()));
|
||||
if (ti == 0) return sectionInfo[unknownTag.sectionId_].name_;
|
||||
return sectionInfo[ti->sectionId_].name_;
|
||||
}
|
||||
|
||||
uint16_t ExifTags::defaultCount(const ExifKey& key)
|
||||
{
|
||||
const TagInfo* ti = tagInfo(key.tag(), static_cast<Internal::IfdId>(key.ifdId()));
|
||||
if (ti == 0) return unknownTag.count_;
|
||||
return ti->count_;
|
||||
}
|
||||
|
||||
const char* ExifTags::ifdName(const std::string& groupName)
|
||||
{
|
||||
IfdId ifdId = Internal::groupId(groupName);
|
||||
return Internal::ifdName(ifdId);
|
||||
}
|
||||
|
||||
bool ExifTags::isMakerGroup(const std::string& groupName)
|
||||
{
|
||||
IfdId ifdId = Internal::groupId(groupName);
|
||||
@ -2795,17 +2815,6 @@ namespace Exiv2 {
|
||||
p_->makeKey(tag, ifdId, ti);
|
||||
}
|
||||
|
||||
ExifKey::ExifKey(const TagInfo& tagInfo)
|
||||
: p_(new Impl)
|
||||
{
|
||||
IfdId ifdId = static_cast<IfdId>(tagInfo.ifdId_);
|
||||
if (!Internal::isExifIfd(ifdId) && !Internal::isMakerIfd(ifdId)) {
|
||||
throw Error(23, ifdId);
|
||||
}
|
||||
p_->groupName_ = Exiv2::groupName(ifdId);
|
||||
p_->makeKey(tagInfo.tag_, ifdId, &tagInfo);
|
||||
}
|
||||
|
||||
ExifKey::ExifKey(const std::string& key)
|
||||
: p_(new Impl)
|
||||
{
|
||||
@ -2850,11 +2859,6 @@ namespace Exiv2 {
|
||||
return p_->groupName_;
|
||||
}
|
||||
|
||||
const char* ExifKey::ifdName() const
|
||||
{
|
||||
return Internal::ifdName(p_->ifdId_);
|
||||
}
|
||||
|
||||
std::string ExifKey::tagName() const
|
||||
{
|
||||
return p_->tagName();
|
||||
@ -2878,12 +2882,6 @@ namespace Exiv2 {
|
||||
return p_->tagInfo_->typeId_;
|
||||
}
|
||||
|
||||
uint16_t ExifKey::defaultCount() const
|
||||
{
|
||||
if (p_->tagInfo_ == 0) return unknownTag.count_;
|
||||
return p_->tagInfo_->count_;
|
||||
}
|
||||
|
||||
uint16_t ExifKey::tag() const
|
||||
{
|
||||
return p_->tag_;
|
||||
@ -2904,11 +2902,6 @@ namespace Exiv2 {
|
||||
return p_->ifdId_;
|
||||
}
|
||||
|
||||
std::string ExifKey::sectionName() const
|
||||
{
|
||||
return sectionInfo[p_->tagInfo_->sectionId_].name_;
|
||||
}
|
||||
|
||||
int ExifKey::idx() const
|
||||
{
|
||||
return p_->idx_;
|
||||
@ -2919,7 +2912,8 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const TagInfo& ti)
|
||||
{
|
||||
ExifKey exifKey(ti);
|
||||
|
||||
ExifKey exifKey(ti.tag_, Internal::groupName(static_cast<Internal::IfdId>(ti.ifdId_)));
|
||||
return os << exifKey.tagName() << ",\t"
|
||||
<< std::dec << exifKey.tag() << ",\t"
|
||||
<< "0x" << std::setw(4) << std::setfill('0')
|
||||
|
||||
26
src/tags.hpp
26
src/tags.hpp
@ -47,6 +47,7 @@ namespace Exiv2 {
|
||||
// *****************************************************************************
|
||||
// class declarations
|
||||
class ExifData;
|
||||
class ExifKey;
|
||||
class Value;
|
||||
struct TagInfo;
|
||||
|
||||
@ -123,6 +124,13 @@ namespace Exiv2 {
|
||||
//! Print the list of tags for \em groupName
|
||||
static void taglist(std::ostream& os, const std::string& groupName);
|
||||
|
||||
//! Return the name of the section for an Exif \em key.
|
||||
static const char* sectionName(const ExifKey& key);
|
||||
//! Return the default number of components (not bytes!) \em key has. (0=any, -1=count not known)
|
||||
static uint16_t defaultCount(const ExifKey& key);
|
||||
//! Return the name of the IFD for the group.
|
||||
static const char* ifdName(const std::string& groupName);
|
||||
|
||||
/*!
|
||||
@brief Return true if \em groupName is a makernote group.
|
||||
*/
|
||||
@ -165,12 +173,6 @@ namespace Exiv2 {
|
||||
and group name.
|
||||
*/
|
||||
ExifKey(uint16_t tag, const std::string& groupName);
|
||||
/*!
|
||||
@brief Constructor to create an Exif key from a tag info structure
|
||||
@param tagInfo The tag info structure
|
||||
@throw Error if the key cannot be constructed from the tag info structure
|
||||
*/
|
||||
explicit ExifKey(const TagInfo& tagInfo);
|
||||
//! Copy constructor
|
||||
ExifKey(const ExifKey& rhs);
|
||||
//! Destructor
|
||||
@ -192,23 +194,17 @@ namespace Exiv2 {
|
||||
virtual std::string key() const;
|
||||
virtual const char* familyName() const;
|
||||
virtual std::string groupName() const;
|
||||
//! Return the IFD id as an integer. (Do not use, this is meant for library internal use.)
|
||||
int ifdId() const;
|
||||
virtual std::string tagName() const;
|
||||
virtual uint16_t tag() const;
|
||||
virtual std::string tagLabel() const;
|
||||
//! Return the tag description.
|
||||
std::string tagDesc() const; // Todo: should be in the base class
|
||||
//! Return the default type id for this tag.
|
||||
TypeId defaultTypeId() const; // Todo: should be in the base class
|
||||
//! Return the default number of components (not bytes!) this tag has. (0=any, -1=count not known)
|
||||
uint16_t defaultCount() const;
|
||||
virtual uint16_t tag() const;
|
||||
|
||||
AutoPtr clone() const;
|
||||
//! Return the IFD id as an integer. (Do not use, this is meant for library internal use.)
|
||||
int ifdId() const;
|
||||
//! Return the name of the IFD
|
||||
const char* ifdName() const;
|
||||
//! Return the name of the Exif section (deprecated)
|
||||
std::string sectionName() const;
|
||||
//! Return the index (unique id of this key within the original Exif data, 0 if not set)
|
||||
int idx() const;
|
||||
//@}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user