Added makernote taglists

v0.27.3
Andreas Huggel 21 years ago
parent 99a87043a4
commit 11577c0f77

@ -20,13 +20,13 @@
*/
/*
File: makernote.cpp
Version: $Name: $ $Revision: 1.14 $
Version: $Name: $ $Revision: 1.15 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 18-Feb-04, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.14 $ $RCSfile: makernote.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.15 $ $RCSfile: makernote.cpp,v $")
// Define DEBUG_MAKERNOTE to output debug information to std::cerr
#undef DEBUG_MAKERNOTE
@ -116,6 +116,40 @@ namespace Exif {
return tag;
} // MakerNote::tag
std::string MakerNote::tagDesc(uint16 tag) const
{
std::string tagDesc;
if (pMnTagInfo_) {
for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) {
if (pMnTagInfo_[i].tag_ == tag) {
tagDesc = pMnTagInfo_[i].desc_;
break;
}
}
}
return tagDesc;
} // MakerNote::tagDesc
void MakerNote::taglist(std::ostream& os) const
{
if (pMnTagInfo_) {
for (int i = 0; pMnTagInfo_[i].tag_ != 0xffff; ++i) {
writeMnTagInfo(os, pMnTagInfo_[i].tag_) << std::endl;
}
}
} // MakerNote::taglist
std::ostream& MakerNote::writeMnTagInfo(std::ostream& os, uint16 tag) const
{
return os << tagName(tag) << ", "
<< std::dec << tag << ", "
<< "0x" << std::setw(4) << std::setfill('0')
<< std::right << std::hex << tag << ", "
<< ExifTags::ifdItem(makerIfd) << ", "
<< makeKey(tag) << ", "
<< tagDesc(tag);
} // MakerNote::writeMnTagInfo
int IfdMakerNote::read(const char* buf,
long len,
ByteOrder byteOrder,

@ -22,7 +22,7 @@
@file makernote.hpp
@brief Contains the %Exif %MakerNote interface, IFD %MakerNote and a
MakerNote factory
@version $Name: $ $Revision: 1.13 $
@version $Name: $ $Revision: 1.14 $
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@date 18-Feb-04, ahu: created
@ -167,13 +167,29 @@ namespace Exif {
the tag.
*/
virtual std::string tagName(uint16 tag) const;
/*!
@brief Return the description of a makernote tag. The default
implementation looks up the makernote info tag array if one is
set, else it returns an empty string.
*/
virtual uint16 tag(const std::string& tagName) const;
/*!
@brief Print a list of all tags known by this MakerNote to the output
stream os. The default implementation prints all tags in the
makernote info tag array if one is set.
*/
virtual std::string tagDesc(uint16 tag) const;
/*!
@brief Return the tag associated with a makernote tag name. The
default implementation looks up the makernote info tag array
if one is set, else it expects tag names in the form \"0x01ff\"
and converts them to unsigned integer.
*/
virtual uint16 tag(const std::string& tagName) const;
virtual void taglist(std::ostream& os) const;
/*!
@brief Write the makernote tag info of tag to the output stream os.
*/
virtual std::ostream& writeMnTagInfo(std::ostream& os, uint16 tag) const;
/*!
@brief Return a pointer to an newly created, empty instance of the
same type as this. The makernote entries are <B>not</B> copied.

@ -3,25 +3,56 @@
Abstract: Print a simple comma separated list of tags defined in Exiv2
File: taglist.cpp
Version: $Name: $ $Revision: 1.3 $
Version: $Name: $ $Revision: 1.4 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 07-Jan-04, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.3 $ $RCSfile: taglist.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.4 $ $RCSfile: taglist.cpp,v $")
#include "makernote.hpp"
#include "tags.hpp"
#include "error.hpp"
#include <string>
#include <iostream>
using namespace Exif;
int main()
int main(int argc, char* argv[])
try {
ExifTags::taglist(std::cout);
return 0;
int rc = 0;
std::string make("any");
std::string model("any");
switch (argc) {
case 3:
model = argv[2];
// fallthrough
case 2:
{
make = argv[1];
MakerNoteFactory& mnf = MakerNoteFactory::instance();
MakerNote* pMakerNote = mnf.create(make, model);
if (pMakerNote) {
pMakerNote->taglist(std::cout);
}
else {
rc = -1;
}
break;
}
case 1:
ExifTags::taglist(std::cout);
break;
default:
std::cout << "Usage: " << argv[0] << " [Make [Model]]\n";
rc = 1;
break;
}
return rc;
}
catch (Error& e) {
std::cout << "Caught Exif exception '" << e << "'\n";

@ -1,9 +1,9 @@
################################################################################
# File tags.awk
# Brief Awk script to convert the taglist from ExifTags::taglist to XML
# format used in the documentation.
# $ taglist | awk -f tags.awk > tags.xml
# Version $Name: $ $Revision: 1.1 $
# Brief Awk script to convert a taglist to XML format used in the
# documentation.
# $ taglist [make [model]] | awk -f tags.awk > tags.xml
# Version $Name: $ $Revision: 1.2 $
# Author Andreas Huggel (ahu)
# <a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
# Date 07-Feb-04, ahu: created

@ -20,13 +20,13 @@
*/
/*
File: tags.cpp
Version: $Name: $ $Revision: 1.23 $
Version: $Name: $ $Revision: 1.24 $
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 15-Jan-04, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.23 $ $RCSfile: tags.cpp,v $")
EXIV2_RCSID("@(#) $Name: $ $Revision: 1.24 $ $RCSfile: tags.cpp,v $")
// *****************************************************************************
// included header files
@ -415,7 +415,6 @@ namespace Exif {
os << gpsTagInfo[i] << "\n";
}
} // ExifTags::taglist
// *************************************************************************
// free functions

Loading…
Cancel
Save