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

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


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

The following commit has been merged in the master branch:
commit c54c385d611d9815f562729c3a20fb17ff1aaea6
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Thu Jan 24 16:23:43 2008 +0000

    Added XMP pretty-print functionality (by webustany for GHOP 98).
---
 src/actions.cpp    |  2 +-
 src/properties.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/properties.hpp | 15 +++++++++++++++
 src/tags.cpp       | 17 ++++++++++++++++-
 src/tags.hpp       |  2 ++
 src/xmp.cpp        |  2 +-
 6 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index 2a9fd03..6916e43 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -775,7 +775,7 @@ namespace Action {
                       << std::dec << std::setw(3)
                       << std::setfill(' ') << std::right
                       << md->count() << "  "
-                      << std::dec << md->value()
+                      << std::dec << *md
                       << std::endl;
         }
 
diff --git a/src/properties.cpp b/src/properties.cpp
index f09eb78..560819e 100644
--- a/src/properties.cpp
+++ b/src/properties.cpp
@@ -784,6 +784,38 @@ namespace Exiv2 {
         { 0, 0, 0, invalidTypeId, xmpInternal, 0 }
     };
 
+    extern const XmpPrintInfo xmpPrintInfo[] = { 
+        {"Xmp.crs.CropUnits",                           EXV_PRINT_TAG(xmpCrsCropUnits)},
+        {"Xmp.exif.ColorSpace",                         EXV_PRINT_TAG(xmpExifColorSpace)},
+        {"Xmp.exif.ComponentsConfiguration",            EXV_PRINT_TAG(xmpExifComponentsConfiguration)},
+        {"Xmp.exif.Contrast",                           EXV_PRINT_TAG(xmpExifNormalSoftHard)},
+        {"Xmp.exif.CustomRendered",                     EXV_PRINT_TAG(xmpExifCustomRendered)},
+        {"Xmp.exif.ExposureProgram",                    EXV_PRINT_TAG(xmpExifExposureProgram)},
+        {"Xmp.exif.FileSource",                         EXV_PRINT_TAG(xmpExifFileSource)},
+        {"Xmp.exif.FocalPlaneResolutionUnit",           EXV_PRINT_TAG(xmpExifFocalPlaneResolutionUnit)},
+        {"Xmp.exif.GainControl",                        EXV_PRINT_TAG(xmpExifGainControl)},
+        {"Xmp.exif.LightSource",                        EXV_PRINT_TAG(xmpExifLightSource)},
+        {"Xmp.exif.MeteringMode",                       EXV_PRINT_TAG(xmpExifMeteringMode)},
+        {"Xmp.exif.Saturation",                         EXV_PRINT_TAG(xmpExifSaturation)},
+        {"Xmp.exif.SceneCaptureType",                   EXV_PRINT_TAG(xmpExifSceneCaptureType)},
+        {"Xmp.exif.SceneType",                          EXV_PRINT_TAG(xmpExifSceneType)},
+        {"Xmp.exif.SensingMethod",                      EXV_PRINT_TAG(xmpExifSensingMethod)},
+        {"Xmp.exif.Sharpness",                          EXV_PRINT_TAG(xmpExifNormalSoftHard)},
+        {"Xmp.exif.SubjectDistanceRange",               EXV_PRINT_TAG(xmpExifSubjectDistanceRange)},
+        {"Xmp.exif.WhiteBalance",                       EXV_PRINT_TAG(xmpExifWhiteBalance)},
+        {"Xmp.exif.GPSAltitudeRef",                     EXV_PRINT_TAG(xmpExifGPSAltitudeRef)},
+        {"Xmp.exif.GPSDestBearingRef",                  EXV_PRINT_TAG(xmpExifGPSDirection)},
+        {"Xmp.exif.GPSDestDistanceRef",                 EXV_PRINT_TAG(xmpExifGPSDestDistanceRef)},
+        {"Xmp.exif.GPSDifferential",                    EXV_PRINT_TAG(xmpExifGPSDifferential)},
+        {"Xmp.exif.GPSImgDirectionRef",                 EXV_PRINT_TAG(xmpExifGPSDirection)},
+        {"Xmp.exif.GPSMeasureMode",                     EXV_PRINT_TAG(xmpExifGPSMeasureMode)},
+        {"Xmp.exif.GPSSpeedRef",                        EXV_PRINT_TAG(xmpExifGPSSpeedRef)},
+        {"Xmp.exif.GPSStatus",                          EXV_PRINT_TAG(xmpExifGPSStatus)},
+        {"Xmp.exif.GPSTrackRef",                        EXV_PRINT_TAG(xmpExifGPSDirection)},
+        {"Xmp.tiff.XResolution",                        printLong},
+        {"Xmp.tiff.YResolution",                        printLong}
+    };
+
     XmpNsInfo::Ns::Ns(const std::string& ns)
         : ns_(ns)
     {
@@ -812,6 +844,11 @@ namespace Exiv2 {
         return n == name;
     }
 
+    bool XmpPrintInfo::operator==(const std::string& key) const
+    {
+        return std::string(key_) == key;
+    }
+
     XmpProperties::NsRegistry XmpProperties::nsRegistry_;
 
     const XmpNsInfo* XmpProperties::lookupNsRegistry(const XmpNsInfo::Prefix& prefix)
@@ -950,6 +987,19 @@ namespace Exiv2 {
 
     } // XmpProperties::printProperties
 
+    std::ostream& XmpProperties::printProperty(std::ostream& os,
+                                               const std::string& key,
+                                               const Value& value)
+    {
+        if (value.count() == 0) return os;
+
+        PrintFct fct = printValue;
+        const XmpPrintInfo* info = find(xmpPrintInfo, key);
+        if (info) fct = info->printFct_;
+
+        return fct(os, value);
+    }
+
     //! @cond IGNORE
 
     //! Internal Pimpl structure with private members and data of class XmpKey.
diff --git a/src/properties.hpp b/src/properties.hpp
index 36ffd2c..b16baa9 100644
--- a/src/properties.hpp
+++ b/src/properties.hpp
@@ -37,6 +37,7 @@
 // included header files
 #include "types.hpp"
 #include "metadatum.hpp"
+#include "tags.hpp"
 
 // + standard includes
 #include <string>
@@ -70,6 +71,15 @@ namespace Exiv2 {
         const char*   desc_;            //!< Property description
     };
 
+    //! Struct used in the lookup table for pretty print functions
+    struct XmpPrintInfo {
+        //! Comparison operator for key
+        bool operator==(const std::string& key) const;
+
+        const char* key_;               //!< XMP key
+        PrintFct printFct_;             //!< Print function
+    };
+
     //! Structure mapping XMP namespaces and (preferred) prefixes.
     struct XmpNsInfo {
         //! For comparison with prefix
@@ -177,6 +187,11 @@ namespace Exiv2 {
         //! Print a list of properties of a schema namespace to output stream \em os.
         static void printProperties(std::ostream& os, const std::string& prefix);
 
+        //! Interpret and print the value of an XMP property
+        static std::ostream& printProperty(std::ostream& os,
+                                           const std::string& key,
+                                           const Value& value);
+
         /*!
           @brief Register namespace \em ns with preferred prefix \em prefix.
 
diff --git a/src/tags.cpp b/src/tags.cpp
index 498c754..82223b9 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -996,7 +996,7 @@ namespace Exiv2 {
                 "present. (Note: The <GPSVersionID> tag is given in bytes, "
                 "unlike the <ExifVersion> tag. When the version is "
                 "2.0.0.0, the tag value is 02000000.H)."),
-                gpsIfdId, gpsTags, unsignedByte, printValue),
+                gpsIfdId, gpsTags, unsignedByte, print0x0000),
         TagInfo(0x0001, "GPSLatitudeRef", N_("GPS Latitude Reference"),
                 N_("Indicates whether the latitude is north or south latitude. The "
                 "ASCII value 'N' indicates north latitude, and 'S' is south latitude."),
@@ -1756,6 +1756,21 @@ namespace Exiv2 {
 
     } // printUcs2
 
+    std::ostream& print0x0000(std::ostream& os, const Value& value)
+    {
+        if (value.size() != 4 || value.typeId() != unsignedByte) {
+            return os << value;
+        }
+
+        for (int i = 0; i < 3; i++) {
+            os << value.toLong(i);
+            os << ".";
+        }
+        os << value.toLong(3);
+
+        return os;
+    }
+
     std::ostream& print0x0006(std::ostream& os, const Value& value)
     {
         std::ostringstream oss;
diff --git a/src/tags.hpp b/src/tags.hpp
index cf2976b..6b813bc 100644
--- a/src/tags.hpp
+++ b/src/tags.hpp
@@ -445,6 +445,8 @@ namespace Exiv2 {
     //! Print function converting from UCS-2LE to UTF-8
     std::ostream& printUcs2(std::ostream& os, const Value& value);
 
+    //! Print GPS version
+    std::ostream& print0x0000(std::ostream& os, const Value& value);
     //! Print GPS altitude
     std::ostream& print0x0006(std::ostream& os, const Value& value);
     //! Print GPS timestamp
diff --git a/src/xmp.cpp b/src/xmp.cpp
index 96ec88a..087c3b6 100644
--- a/src/xmp.cpp
+++ b/src/xmp.cpp
@@ -669,7 +669,7 @@ namespace Exiv2 {
     // free functions
     std::ostream& operator<<(std::ostream& os, const Xmpdatum& md)
     {
-        return os << md.value();
+        return XmpProperties::printProperty(os, md.key(), md.value());
     }
 
 }                                       // namespace Exiv2

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list