[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:37:25 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=2360321

The following commit has been merged in the master branch:
commit 2360321cbec84f8bd78b5fe168ad236ed15d45c3
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Feb 3 08:16:13 2006 +0000

    Added enum MetadataId and Image::supportsMetadata() to check what metadata an image class supports. Changed CrwImage to silently ignore calls to Iptc related functions instead of throwing an Error
---
 src/crwimage.cpp |  8 ++++----
 src/crwimage.hpp |  4 ++--
 src/image.cpp    |  5 +++++
 src/image.hpp    | 12 ++++++++++--
 src/jpgimage.cpp |  2 +-
 src/types.hpp    |  3 +++
 6 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/crwimage.cpp b/src/crwimage.cpp
index d8921d8..99c9e0e 100644
--- a/src/crwimage.cpp
+++ b/src/crwimage.cpp
@@ -128,7 +128,7 @@ namespace Exiv2 {
     };
 
     CrwImage::CrwImage(BasicIo::AutoPtr io, bool create)
-        : io_(io)
+        : Image(mdExif | mdComment), io_(io)
     {
         if (create) {
             IoCloser closer(*io_);
@@ -167,12 +167,12 @@ namespace Exiv2 {
 
     void CrwImage::clearIptcData()
     {
-        throw Error(31, "CrwImage::clearIptcData");
+        // not supported
     }
 
-    void CrwImage::setIptcData(const IptcData& iptcData)
+    void CrwImage::setIptcData(const IptcData& /*iptcData*/)
     {
-        throw Error(31, "CrwImage::setIptcData");
+        // not supported
     }
 
     void CrwImage::clearComment()
diff --git a/src/crwimage.hpp b/src/crwimage.hpp
index 468f48c..d90e73c 100644
--- a/src/crwimage.hpp
+++ b/src/crwimage.hpp
@@ -131,12 +131,12 @@ namespace Exiv2 {
         void            clearExifData();
         /*!
           @brief Not supported. Crw format does not contain Iptc metadata.
-                 Calling this function will raise an exception (Error).
+                 Calling this function will do nothing.
          */
         void            setIptcData(const IptcData& iptcData);
         /*!
           @brief Not supported. Crw format does not contain Iptc metadata.
-                 Calling this function will raise an exception (Error).
+                 Calling this function will do nothing.
          */
         void            clearIptcData();
         void            setComment(const std::string& comment);
diff --git a/src/image.cpp b/src/image.cpp
index a25263e..867ed27 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -62,6 +62,11 @@ EXIV2_RCSID("@(#) $Id$");
 // class member definitions
 namespace Exiv2 {
 
+    bool Image::supportsMetadata(MetadataId metadataId) const
+    {
+        return supportedMetadata_ & metadataId;
+    }
+
     const ImageFactory::Registry* ImageFactory::find(int imageType)
     {
         for (unsigned int i = 0; registry_[i].imageType_ != ImageType::none; ++i) {
diff --git a/src/image.hpp b/src/image.hpp
index bbc5b54..4eee265 100644
--- a/src/image.hpp
+++ b/src/image.hpp
@@ -236,13 +236,18 @@ namespace Exiv2 {
              method is called.
          */
         virtual BasicIo& io() const = 0;
+        /*!
+          @brief Check if image supports a particular type of metadata.
+         */
+        bool supportsMetadata(MetadataId metadataId) const;
         //@}
 
     protected:
         //! @name Creators
         //@{
-        //! Default Constructor
-        Image() {}
+        //! Constructor taking a bitmap of the metadata types, which are supported
+        Image(uint16_t supportedMetadata) 
+            : supportedMetadata_(supportedMetadata) {}
         //@}
 
     private:
@@ -252,6 +257,9 @@ namespace Exiv2 {
         //! Assignment operator
         Image& operator=(const Image& rhs);
 
+        // DATA
+        uint16_t supportedMetadata_; //! Bitmap with all supported metadata types
+
     }; // class Image
 
     //! Type for function pointer that creates new Image instances
diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index 37b12c6..d6e2173 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -64,7 +64,7 @@ namespace Exiv2 {
 
     JpegBase::JpegBase(BasicIo::AutoPtr io, bool create,
                        const byte initData[], long dataSize)
-        : io_(io)
+        : Image(mdExif | mdIptc | mdComment), io_(io)
     {
         if (create) {
             initImage(initData, dataSize);
diff --git a/src/types.hpp b/src/types.hpp
index 09890ab..d7ae0e4 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -79,6 +79,9 @@ namespace Exiv2 {
     //! Type to express the byte order (little or big endian)
     enum ByteOrder { invalidByteOrder, littleEndian, bigEndian };
 
+    //! An identifier for each type of metadata
+    enum MetadataId { mdExif=1, mdIptc=2, mdComment=4 };
+
     //! Type identifiers for IFD format types
     enum TypeId { invalidTypeId, unsignedByte, asciiString, unsignedShort,
                   unsignedLong, unsignedRational, invalid6, undefined,

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list