Changed behaviour of unsupport Image functions to throw. Added better method to query the supported metadata functions for each image type. Fixes bug #491.

v0.27.3
Andreas Huggel 19 years ago
parent cd4d2583e3
commit 8e85cea8d4

@ -66,7 +66,6 @@ CCSRC = basicio.cpp \
fujimn.cpp \
ifd.cpp \
image.cpp \
imgreg.cpp \
iptc.cpp \
jpgimage.cpp \
makernote.cpp \

@ -103,16 +103,21 @@ namespace Exiv2 {
return isThisType(*io_, false);
}
AccessMode Cr2Image::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::cr2, metadataId);
}
void Cr2Image::clearMetadata()
{
clearExifData();
clearComment();
clearIptcData();
}
void Cr2Image::setMetadata(const Image& image)
{
setExifData(image.exifData());
setComment(image.comment());
setIptcData(image.iptcData());
}
void Cr2Image::clearExifData()
@ -137,12 +142,13 @@ namespace Exiv2 {
void Cr2Image::clearComment()
{
comment_.erase();
// not supported, do nothing
}
void Cr2Image::setComment(const std::string& comment)
void Cr2Image::setComment(const std::string& /*comment*/)
{
comment_ = comment;
// not supported
throw(Error(32, "Image comment", "CR2"));
}
void Cr2Image::readMetadata()
@ -167,44 +173,10 @@ namespace Exiv2 {
void Cr2Image::writeMetadata()
{
/*
Todo: implement me!
#ifdef DEBUG
std::cerr << "Writing CR2 file " << io_->path() << "\n";
#endif
// Read existing image
DataBuf buf;
if (io_->open() == 0) {
IoCloser closer(*io_);
// Ensure that this is the correct image type
if (isThisType(*io_, false)) {
// Read the image into a memory buffer
buf.alloc(io_->size());
io_->read(buf.pData_, buf.size_);
if (io_->error() || io_->eof()) {
buf.reset();
}
}
}
// Parse image, starting with a CR2 header component
Cr2Header::AutoPtr head(new Cr2Header);
if (buf.size_ != 0) {
head->read(buf.pData_, buf.size_);
}
Blob blob;
Cr2Parser::encode(blob, head.get(), this);
// Write new buffer to file
BasicIo::AutoPtr tempIo(io_->temporary()); // may throw
assert (tempIo.get() != 0);
tempIo->write(&blob[0], static_cast<long>(blob.size()));
io_->close();
io_->transfer(*tempIo); // may throw
*/
/*
Todo: implement me!
*/
throw(Error(31, "metadata", "CR2"));
} // Cr2Image::writeMetadata
bool Cr2Image::isThisType(BasicIo& iIo, bool advance) const

@ -95,13 +95,17 @@ namespace Exiv2 {
void readMetadata();
/*!
@brief Todo: Write metadata back to the image. This method is not
yet implemented.
yet implemented. Calling it will throw an Error(31).
*/
void writeMetadata();
void setExifData(const ExifData& exifData);
void clearExifData();
void setIptcData(const IptcData& iptcData);
void clearIptcData();
/*!
@brief Not supported. CR2 format does not contain a comment.
Calling this function will throw an Error(32).
*/
void setComment(const std::string& comment);
void clearComment();
void setMetadata(const Image& image);
@ -117,6 +121,7 @@ namespace Exiv2 {
const IptcData& iptcData() const { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
AccessMode checkMode(MetadataId metadataId) const;
//@}
private:

@ -182,6 +182,11 @@ namespace Exiv2 {
return isThisType(*io_, false);
}
AccessMode CrwImage::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::crw, metadataId);
}
void CrwImage::clearMetadata()
{
clearExifData();
@ -206,12 +211,13 @@ namespace Exiv2 {
void CrwImage::clearIptcData()
{
// not supported
// not supported, do nothing
}
void CrwImage::setIptcData(const IptcData& /*iptcData*/)
{
// not supported
throw(Error(32, "IPTC metadata", "CRW"));
}
void CrwImage::clearComment()

@ -83,7 +83,7 @@ namespace Exiv2 {
/*!
@brief Class to access raw Canon Crw images. Only Exif metadata and a
comment are supported. Crw format does not contain Iptc metadata.
comment are supported. Crw format does not contain IPTC metadata.
*/
class CrwImage : public Image {
friend bool isCrwType(BasicIo& iIo, bool advance);
@ -122,22 +122,14 @@ namespace Exiv2 {
//! @name Manipulators
//@{
void readMetadata();
/*!
@brief Todo: Write metadata back to the image. This method is not
yet implemented.
*/
void writeMetadata();
void setExifData(const ExifData& exifData);
void clearExifData();
/*!
@brief Not supported. Crw format does not contain Iptc metadata.
Calling this function will do nothing.
@brief Not supported. CRW format does not contain IPTC metadata.
Calling this function will throw an Error(32).
*/
void setIptcData(const IptcData& iptcData);
/*!
@brief Not supported. Crw format does not contain Iptc metadata.
Calling this function will do nothing.
*/
void clearIptcData();
void setComment(const std::string& comment);
void clearComment();
@ -154,6 +146,7 @@ namespace Exiv2 {
const IptcData& iptcData() const { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
AccessMode checkMode(MetadataId metadataId) const;
//@}
private:

@ -73,8 +73,8 @@ namespace Exiv2 {
ErrMsg( 28, N_("Invalid charset: `%1'")), // %1=charset name
ErrMsg( 29, N_("Unsupported date format")),
ErrMsg( 30, N_("Unsupported time format")),
ErrMsg( 31, N_("%1: CRW images don't support IPTC metadata")), // %1=function
ErrMsg( 32, N_("%1: CRW images don't support JPEG comments")), // %1=function
ErrMsg( 31, N_("Writing %1 to %2 images is not supported")), // %1=metadata type, %2=image format
ErrMsg( 32, N_("%1 in %2 images is not supported")), // %1=metadata type, %2=image format
ErrMsg( 33, N_("This does not look like a CRW image")),
ErrMsg( 34, N_("%1: Not supported")), // %1=function
ErrMsg( 35, N_("ImageFactory registry full")),

@ -44,6 +44,15 @@ EXIV2_RCSID("@(#) $Id$")
#include "error.hpp"
#include "futils.hpp"
#include "jpgimage.hpp"
#include "cr2image.hpp"
#include "crwimage.hpp"
#include "mrwimage.hpp"
#include "tiffimage.hpp"
#ifdef EXV_HAVE_LIBZ
# include "pngimage.hpp"
#endif // EXV_HAVE_LIBZ
// + standard includes
#include <cerrno>
#include <cstdio>
@ -62,31 +71,50 @@ EXIV2_RCSID("@(#) $Id$")
// class member definitions
namespace Exiv2 {
bool Image::supportsMetadata(MetadataId metadataId) const
const ImageFactory::Registry ImageFactory::registry_[] = {
//image type creation fct type check Exif mode IPTC mode Comment mode
//--------------- --------------- ---------- ----------- ----------- ------------
{ ImageType::jpeg, newJpegInstance, isJpegType, amReadWrite, amReadWrite, amReadWrite },
{ ImageType::exv, newExvInstance, isExvType, amReadWrite, amReadWrite, amReadWrite },
{ ImageType::cr2, newCr2Instance, isCr2Type, amRead, amRead, amNone },
{ ImageType::crw, newCrwInstance, isCrwType, amReadWrite, amNone, amReadWrite },
{ ImageType::mrw, newMrwInstance, isMrwType, amRead, amRead, amNone },
{ ImageType::tiff, newTiffInstance, isTiffType, amRead, amRead, amNone },
#ifdef EXV_HAVE_LIBZ
{ ImageType::png, newPngInstance, isPngType, amRead, amRead, amNone },
#endif // EXV_HAVE_LIBZ
// End of list marker
{ ImageType::none, 0, 0, amNone, amNone, amNone }
};
bool ImageFactory::Registry::operator==(const int& imageType) const
{
return (supportedMetadata_ & metadataId) != 0;
return imageType == imageType_;
}
const ImageFactory::Registry* ImageFactory::find(int imageType)
bool Image::supportsMetadata(MetadataId metadataId) const
{
for (unsigned int i = 0; registry_[i].imageType_ != ImageType::none; ++i) {
if (registry_[i].imageType_ == imageType) return &registry_[i];
}
return 0;
return (supportedMetadata_ & metadataId) != 0;
}
void ImageFactory::registerImage(int type,
NewInstanceFct newInst,
IsThisTypeFct isType)
AccessMode ImageFactory::checkMode(int imageType, MetadataId metadataId)
{
unsigned int i = 0;
for (; i < MAX_IMAGE_FORMATS; ++i) {
if (registry_[i].imageType_ == ImageType::none) {
registry_[i] = Registry(type, newInst, isType);
break;
}
const Registry* r = find(registry_, imageType);
if (!r) throw Error(13, imageType);
AccessMode am = amNone;
switch (metadataId) {
case mdExif:
am = r->exifSupport_;
break;
case mdIptc:
am = r->iptcSupport_;
break;
case mdComment:
am = r->commentSupport_;
break;
// no default: let the compiler complain
}
if (i == MAX_IMAGE_FORMATS) throw Error(35);
return am;
}
int ImageFactory::getType(const std::string& path)
@ -169,7 +197,7 @@ namespace Exiv2 {
BasicIo::AutoPtr io)
{
// BasicIo instance does not need to be open
const Registry* r = find(type);
const Registry* r = find(registry_, type);
if (0 != r) {
return r->newInstance_(io, true);
}

@ -235,9 +235,17 @@ namespace Exiv2 {
Image class will not see those changes until the readMetadata()
method is called.
*/
virtual BasicIo& io() const = 0;
virtual BasicIo& io() const =0;
/*!
@brief Returns the access mode, i.e., the metadata functions, which
this image supports for the metadata type \em metadataId.
@param metadataId The metadata identifier.
@return Access mode for the requested image type and metadata identifier.
*/
virtual AccessMode checkMode(MetadataId metadataId) const =0;
/*!
@brief Check if image supports a particular type of metadata.
This method is deprecated. Use checkMode() instead.
*/
bool supportsMetadata(MetadataId metadataId) const;
//@}
@ -274,27 +282,6 @@ namespace Exiv2 {
*/
class ImageFactory {
public:
//! @name Manipulators
//@{
/*!
@brief Register image type together with its function pointers.
The image factory creates new images by calling their associated
function pointer. Additional images can be added by registering
new type and function pointers. If called for a type that already
exists in the list, the corresponding functions are replaced.
@param type Image type.
@param newInst Function pointer for creating image instances.
@param isType Function pointer to test for matching image types.
*/
static void registerImage(int type,
NewInstanceFct newInst,
IsThisTypeFct isType);
//@}
//! @name Accessors
//@{
/*!
@brief Create an Image subclass of the appropriate type by reading
the specified file. %Image type is derived from the file
@ -394,9 +381,31 @@ namespace Exiv2 {
@return %Image type or Image::none if the type is not recognized.
*/
static int getType(BasicIo& io);
//@}
/*!
@brief Returns the access mode or supported metadata functions for an
image type and a metadata type.
@param imageType The image type.
@param metadataId The metadata identifier.
@return Access mode for the requested image type and metadata identifier.
@throw Error(13) if the image type is not supported.
*/
static AccessMode checkMode(int imageType, MetadataId metadataId);
private:
//! Struct for storing image types and function pointers.
struct Registry {
//! Comparison operator to compare a Registry structure with an image type
bool operator==(const int& imageType) const;
// DATA
int imageType_;
NewInstanceFct newInstance_;
IsThisTypeFct isThisType_;
AccessMode exifSupport_;
AccessMode iptcSupport_;
AccessMode commentSupport_;
};
//! @name Creators
//@{
//! Prevent construction: not implemented.
@ -405,35 +414,9 @@ namespace Exiv2 {
ImageFactory(const ImageFactory& rhs);
//@}
//! Struct for storing image types and function pointers.
struct Registry
{
//! Default constructor
Registry()
: imageType_(ImageType::none),
newInstance_(0),
isThisType_(0)
{}
//! Constructor
Registry(int imageType,
NewInstanceFct newInstance,
IsThisTypeFct isThisType)
: imageType_(imageType),
newInstance_(newInstance),
isThisType_(isThisType)
{}
int imageType_;
NewInstanceFct newInstance_;
IsThisTypeFct isThisType_;
};
//! Return the registry entry for type
static const Registry* find(int imageType);
// DATA
static const unsigned int MAX_IMAGE_FORMATS = 32;
//! List of image types and corresponding creation functions.
static Registry registry_[MAX_IMAGE_FORMATS];
//! List of image types, creation functions and access modes
static const Registry registry_[];
}; // class ImageFactory
//! Helper class modelling the TIFF header structure.

@ -1,62 +0,0 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2005, 2006 Andreas Huggel <ahuggel@gmx.net>
*
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
/*
File: imgreg.cpp
Version: $Rev$
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History: 19-Sep-05, ahu: created
*/
// *****************************************************************************
#include "rcsid.hpp"
EXIV2_RCSID("@(#) $Id$")
// *****************************************************************************
// included header files
#include "image.hpp"
#include "jpgimage.hpp"
#include "cr2image.hpp"
#include "crwimage.hpp"
#include "mrwimage.hpp"
#include "tiffimage.hpp"
#ifdef EXV_HAVE_LIBZ
# include "pngimage.hpp"
#endif // EXV_HAVE_LIBZ
// + standard includes
// *****************************************************************************
// class member definitions
namespace Exiv2 {
ImageFactory::Registry ImageFactory::registry_[] = {
Registry(ImageType::jpeg, newJpegInstance, isJpegType),
Registry(ImageType::exv, newExvInstance, isExvType),
Registry(ImageType::cr2, newCr2Instance, isCr2Type),
Registry(ImageType::crw, newCrwInstance, isCrwType),
Registry(ImageType::mrw, newMrwInstance, isMrwType),
Registry(ImageType::tiff, newTiffInstance, isTiffType),
#ifdef EXV_HAVE_LIBZ
Registry(ImageType::png, newPngInstance, isPngType)
#endif // EXV_HAVE_LIBZ
};
} // namespace Exiv2

@ -581,6 +581,11 @@ namespace Exiv2 {
{
}
AccessMode JpegImage::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::jpeg, metadataId);
}
int JpegImage::writeHeader(BasicIo& outIo) const
{
// Jpeg header
@ -628,6 +633,11 @@ namespace Exiv2 {
{
}
AccessMode ExvImage::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::exv, metadataId);
}
int ExvImage::writeHeader(BasicIo& outIo) const
{
// Exv header

@ -124,27 +124,27 @@ namespace Exiv2 {
//@}
//! @name Manipulators
//@{
void readMetadata();
void writeMetadata();
void setExifData(const ExifData& exifData);
void clearExifData();
void setIptcData(const IptcData& iptcData);
void clearIptcData();
void setComment(const std::string& comment);
void clearComment();
void setMetadata(const Image& image);
void clearMetadata();
void readMetadata();
void writeMetadata();
void setExifData(const ExifData& exifData);
void clearExifData();
void setIptcData(const IptcData& iptcData);
void clearIptcData();
void setComment(const std::string& comment);
void clearComment();
void setMetadata(const Image& image);
void clearMetadata();
ExifData& exifData() { return exifData_; }
IptcData& iptcData() { return iptcData_; }
//@}
//! @name Accessors
//@{
bool good() const;
bool good() const;
const ExifData& exifData() const { return exifData_; }
ExifData& exifData() { return exifData_; }
const IptcData& iptcData() const { return iptcData_; }
IptcData& iptcData() { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
//@}
protected:
//! @name Creators
@ -283,6 +283,10 @@ namespace Exiv2 {
//! Destructor
~JpegImage() {}
//@}
//! @name Accessors
//@{
AccessMode checkMode(MetadataId metadataId) const;
//@}
protected:
//! @name Accessors
//@{
@ -339,6 +343,10 @@ namespace Exiv2 {
//! Destructor
~ExvImage() {}
//@}
//! @name Accessors
//@{
AccessMode checkMode(MetadataId metadataId) const;
//@}
protected:
//! @name Accessors
//@{

@ -70,14 +70,21 @@ namespace Exiv2 {
return isThisType(*io_, false);
}
AccessMode MrwImage::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::mrw, metadataId);
}
void MrwImage::clearMetadata()
{
clearExifData();
clearIptcData();
}
void MrwImage::setMetadata(const Image& image)
{
setExifData(image.exifData());
setIptcData(image.iptcData());
}
void MrwImage::clearExifData()
@ -102,12 +109,13 @@ namespace Exiv2 {
void MrwImage::clearComment()
{
// not supported
// not supported, do nothing
}
void MrwImage::setComment(const std::string& /*comment*/)
{
// not supported
throw(Error(32, "Image comment", "MRW"));
}
void MrwImage::readMetadata()
@ -161,44 +169,10 @@ namespace Exiv2 {
void MrwImage::writeMetadata()
{
/*
Todo: implement me!
#ifdef DEBUG
std::cerr << "Writing MRW file " << io_->path() << "\n";
#endif
// Read existing image
DataBuf buf;
if (io_->open() == 0) {
IoCloser closer(*io_);
// Ensure that this is the correct image type
if (isThisType(*io_, false)) {
// Read the image into a memory buffer
buf.alloc(io_->size());
io_->read(buf.pData_, buf.size_);
if (io_->error() || io_->eof()) {
buf.reset();
}
}
}
// Parse image, starting with a MRW header component
TiffHeade2::AutoPtr head(new TiffHeade2);
if (buf.size_ != 0) {
head->read(buf.pData_, buf.size_);
}
Blob blob;
TiffParser::encode(blob, head.get(), this);
// Write new buffer to file
BasicIo::AutoPtr tempIo(io_->temporary()); // may throw
assert (tempIo.get() != 0);
tempIo->write(&blob[0], static_cast<long>(blob.size()));
io_->close();
io_->transfer(*tempIo); // may throw
*/
/*
Todo: implement me!
*/
throw(Error(31, "metadata", "MRW"));
} // MrwImage::writeMetadata
bool MrwImage::isThisType(BasicIo& iIo, bool advance) const

@ -94,7 +94,7 @@ namespace Exiv2 {
void readMetadata();
/*!
@brief Todo: Write metadata back to the image. This method is not
yet implemented.
yet implemented. Calling it will throw an Error(31).
*/
void writeMetadata();
void setExifData(const ExifData& exifData);
@ -103,13 +103,9 @@ namespace Exiv2 {
void clearIptcData();
/*!
@brief Not supported. MRW format does not contain a comment.
Calling this function will do nothing.
Calling this function will throw an Error(32).
*/
void setComment(const std::string& comment);
/*!
@brief Not supported. MRW format does not contain a comment.
Calling this function will do nothing.
*/
void clearComment();
void setMetadata(const Image& image);
void clearMetadata();
@ -124,6 +120,7 @@ namespace Exiv2 {
const IptcData& iptcData() const { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
AccessMode checkMode(MetadataId metadataId) const;
//@}
private:

@ -74,14 +74,21 @@ namespace Exiv2 {
return isThisType(*io_, false);
}
AccessMode PngImage::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::png, metadataId);
}
void PngImage::clearMetadata()
{
clearExifData();
clearIptcData();
}
void PngImage::setMetadata(const Image& image)
{
setExifData(image.exifData());
setIptcData(image.iptcData());
}
void PngImage::clearExifData()
@ -106,7 +113,7 @@ namespace Exiv2 {
void PngImage::clearComment()
{
// not yet supported.
// not yet supported, do nothing
// TODO : Add 'iTXt' chunk 'Description' tag support here
}
@ -114,6 +121,7 @@ namespace Exiv2 {
{
// not yet supported
// TODO : Add 'iTXt' chunk 'Description' tag support here
throw(Error(32, "Image comment", "PNG"));
}
void PngImage::readMetadata()
@ -151,9 +159,10 @@ namespace Exiv2 {
void PngImage::writeMetadata()
{
/*
TODO: implement me!
*/
/*
Todo: implement me!
*/
throw(Error(31, "metadata", "PNG"));
} // PngImage::writeMetadata
bool PngImage::isThisType(BasicIo& iIo, bool advance) const

@ -97,7 +97,7 @@ namespace Exiv2 {
void readMetadata();
/*!
@brief Todo: Write metadata back to the image. This method is not
yet implemented.
yet implemented. Calling it will throw an Error(31).
*/
void writeMetadata();
void setExifData(const ExifData& exifData);
@ -106,13 +106,10 @@ namespace Exiv2 {
void clearIptcData();
/*!
@brief Not supported. PNG format does not contain a comment.
Calling this function will do nothing.
Calling it will throw an Error(32).<br>
Todo: Add 'iTXt' chunk 'Description' tag support here.
*/
void setComment(const std::string& comment);
/*!
@brief Not supported. PNG format does not contain a comment.
Calling this function will do nothing.
*/
void clearComment();
void setMetadata(const Image& image);
void clearMetadata();
@ -127,6 +124,7 @@ namespace Exiv2 {
const IptcData& iptcData() const { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
AccessMode checkMode(MetadataId metadataId) const;
//@}
private:

@ -70,16 +70,21 @@ namespace Exiv2 {
return isThisType(*io_, false);
}
AccessMode TiffImage::checkMode(MetadataId metadataId) const
{
return ImageFactory::checkMode(ImageType::tiff, metadataId);
}
void TiffImage::clearMetadata()
{
clearExifData();
clearComment();
clearIptcData();
}
void TiffImage::setMetadata(const Image& image)
{
setExifData(image.exifData());
setComment(image.comment());
setIptcData(image.iptcData());
}
void TiffImage::clearExifData()
@ -104,12 +109,13 @@ namespace Exiv2 {
void TiffImage::clearComment()
{
comment_.erase();
// not supported, do nothing
}
void TiffImage::setComment(const std::string& comment)
void TiffImage::setComment(const std::string& /*comment*/)
{
comment_ = comment;
// not supported
throw(Error(32, "Image comment", "TIFF"));
}
void TiffImage::readMetadata()
@ -134,44 +140,10 @@ namespace Exiv2 {
void TiffImage::writeMetadata()
{
/*
Todo: implement me!
#ifdef DEBUG
std::cerr << "Writing TIFF file " << io_->path() << "\n";
#endif
// Read existing image
DataBuf buf;
if (io_->open() == 0) {
IoCloser closer(*io_);
// Ensure that this is the correct image type
if (isThisType(*io_, false)) {
// Read the image into a memory buffer
buf.alloc(io_->size());
io_->read(buf.pData_, buf.size_);
if (io_->error() || io_->eof()) {
buf.reset();
}
}
}
// Parse image, starting with a TIFF header component
TiffHeade2::AutoPtr head(new TiffHeade2);
if (buf.size_ != 0) {
head->read(buf.pData_, buf.size_);
}
Blob blob;
TiffParser::encode(blob, head.get(), this);
// Write new buffer to file
BasicIo::AutoPtr tempIo(io_->temporary()); // may throw
assert (tempIo.get() != 0);
tempIo->write(&blob[0], static_cast<long>(blob.size()));
io_->close();
io_->transfer(*tempIo); // may throw
*/
/*
Todo: implement me!
*/
throw(Error(31, "metadata", "TIFF"));
} // TiffImage::writeMetadata
bool TiffImage::isThisType(BasicIo& iIo, bool advance) const

@ -93,13 +93,17 @@ namespace Exiv2 {
void readMetadata();
/*!
@brief Todo: Write metadata back to the image. This method is not
yet implemented.
yet implemented. Calling it will throw an Error(31).
*/
void writeMetadata();
void setExifData(const ExifData& exifData);
void clearExifData();
void setIptcData(const IptcData& iptcData);
void clearIptcData();
/*!
@brief Not supported. TIFF format does not contain a comment.
Calling this function will throw an Error(32).
*/
void setComment(const std::string& comment);
void clearComment();
void setMetadata(const Image& image);
@ -115,6 +119,7 @@ namespace Exiv2 {
const IptcData& iptcData() const { return iptcData_; }
std::string comment() const { return comment_; }
BasicIo& io() const { return *io_; }
AccessMode checkMode(MetadataId metadataId) const;
//@}
private:

@ -92,6 +92,9 @@ namespace Exiv2 {
//! An identifier for each type of metadata
enum MetadataId { mdExif=1, mdIptc=2, mdComment=4 };
//! An identifier for each mode of metadata support
enum AccessMode { amNone=0, amRead=1, amWrite=2, amReadWrite=3 };
//! Type identifiers for IFD format types
enum TypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort,
unsignedLong, unsignedRational, invalid6, undefined,

Loading…
Cancel
Save