[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:34 UTC 2017


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

The following commit has been merged in the master branch:
commit 516bc731530def8d6763ec79b87e80c3164e0916
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat May 6 17:31:28 2006 +0000

    Added generic printTag template function (and the COUNTOF macro) and the first two Minolta lookup tables and print functions which make use of it.
---
 src/minoltamn.cpp | 23 +++++++++++++++++++++--
 src/tags.hpp      | 23 ++++++++++++++++++++++-
 src/types.hpp     |  5 +++++
 3 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/src/minoltamn.cpp b/src/minoltamn.cpp
index bbfa425..e122285 100644
--- a/src/minoltamn.cpp
+++ b/src/minoltamn.cpp
@@ -37,6 +37,7 @@ EXIV2_RCSID("@(#) $Id$");
 #include "minoltamn.hpp"
 #include "makernote.hpp"
 #include "value.hpp"
+#include "tags.hpp"
 
 // + standard includes
 #include <string>
@@ -48,6 +49,24 @@ EXIV2_RCSID("@(#) $Id$");
 // class member definitions
 namespace Exiv2 {
 
+    //! Lookup table to translate Minolta color mode values to readable labels
+    extern const TagDetails minoltaColorMode[] = {
+        { 0, "Natural Color" },
+        { 1, "Black & White" },
+        { 2, "Vivid Color"   },
+        { 3, "Solarization"  },
+        { 4, "AdobeRGB"      }
+    };
+
+    //! Lookup table to translate Minolta image quality values to readable labels
+    extern const TagDetails minoltaImageQuality[] = {
+        { 0, "Raw"       },
+        { 1, "Superfine" },
+        { 2, "Fine"      },
+        { 3, "Standard"  },
+        { 5, "Extrafine" }
+    };
+
     //! @cond IGNORE
     MinoltaMakerNote::RegisterMn::RegisterMn()
     {
@@ -69,8 +88,8 @@ namespace Exiv2 {
         TagInfo(0x0081, "Thumbnail", "Thumbnail", "Jpeg thumbnail 640x480 pixels", minoltaIfdId, makerTags, undefined, printValue),
         TagInfo(0x0088, "ThumbnailOffset", "Thumbnail Offset", "Offset of the thumbnail", minoltaIfdId, makerTags, unsignedLong, printValue),
         TagInfo(0x0089, "ThumbnailLength", "Thumbnail Length", "Size of the thumbnail", minoltaIfdId, makerTags, unsignedLong, printValue),
-        TagInfo(0x0101, "ColorMode", "Color Mode", "Color mode", minoltaIfdId, makerTags, unsignedLong, printValue),
-        TagInfo(0x0102, "ImageQuality", "Image Quality", "Image quality", minoltaIfdId, makerTags, unsignedLong, printValue),
+        TagInfo(0x0101, "ColorMode", "Color Mode", "Color mode", minoltaIfdId, makerTags, unsignedLong, printTag<COUNTOF(minoltaColorMode), minoltaColorMode>),
+        TagInfo(0x0102, "ImageQuality", "Image Quality", "Image quality", minoltaIfdId, makerTags, unsignedLong, printTag<COUNTOF(minoltaImageQuality), minoltaImageQuality>),
         TagInfo(0x0e00, "PIM_IFD", "PIM IFD", "PIM information", minoltaIfdId, makerTags, undefined, printValue),
         // End of list marker
         TagInfo(0xffff, "(UnknownMinoltaMakerNoteTag)", "(UnknownMinoltaMakerNoteTag)", "Unknown MinoltaMakerNote tag", minoltaIfdId, makerTags, invalidTypeId, printValue)
diff --git a/src/tags.hpp b/src/tags.hpp
index fbb5d0f..30e9482 100644
--- a/src/tags.hpp
+++ b/src/tags.hpp
@@ -34,11 +34,12 @@
 // included header files
 #include "metadatum.hpp"
 #include "types.hpp"
+#include "value.hpp"
 
 // + standard includes
 #include <string>
 #include <utility>                              // for std::pair
-#include <iosfwd>
+#include <iostream>
 #include <memory>
 
 // *****************************************************************************
@@ -118,9 +119,29 @@ namespace Exiv2 {
     struct TagDetails {
         long val_;                              //!< Tag value
         char* label_;                           //!< Translation of the tag value
+
+        //! Comparison operator for use with the find template
+        bool operator==(long key) const { return val_ == key; }
     }; // struct TagDetails
 
     /*!
+      @brief Generic print function to translate a long value to a description
+             by looking up a reference table.
+     */
+    template <int N, const TagDetails (&array)[N]>
+    std::ostream& printTag(std::ostream& os, const Value& value)
+    {
+        const TagDetails* td = find(array, value.toLong());
+        if (td) {
+            os << td->label_;
+        }
+        else {
+            os << "(" << value << ")";
+        }
+        return os;
+    }
+
+    /*!
       @brief Translation from numeric values from a lookup list to human
              readable labels
      */
diff --git a/src/types.hpp b/src/types.hpp
index 836b80c..289d7ab 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -352,6 +352,11 @@ namespace Exiv2 {
         return rc == src + N ? 0 : rc;
     }
 
+    //! Template used in the COUNTOF macro to determine the size of an array
+    template <typename T, int N> char (&sizer(T (&)[N]))[N];
+//! Macro to determine the size of an array
+#define COUNTOF(a) (sizeof(sizer(a)))
+
     //! Utility function to convert the argument of any type to a string
     template<typename T>
     std::string toString(const T& arg)

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list