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

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


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

The following commit has been merged in the master branch:
commit c8d9fe0b3561ed4056de07d7f78f996653ec2a9f
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Dec 10 18:04:07 2004 +0000

    Changed operator hack to be more consistent, added op=(const Value&)
---
 src/exif.cpp     | 10 ++++++--
 src/exif.hpp     | 74 ++++++++++++++++++++++++++------------------------------
 src/iptc.cpp     | 35 ++++++++++-----------------
 src/iptc.hpp     | 35 ++++++++++++++++-----------
 src/iptceasy.cpp |  8 ++++--
 5 files changed, 82 insertions(+), 80 deletions(-)

diff --git a/src/exif.cpp b/src/exif.cpp
index 99e3446..c1e04ef 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -155,6 +155,12 @@ namespace Exiv2 {
         return Exiv2::setValue(*this, value); 
     }
 
+    Exifdatum& Exifdatum::operator=(const Value& value)
+    {
+        setValue(&value);
+        return *this;
+    }
+
     void Exifdatum::setValue(const Value* pValue)
     {
         value_.reset();
@@ -168,10 +174,10 @@ namespace Exiv2 {
         value_->setDataArea(e.dataArea(), e.sizeDataArea());
     }
 
-    void Exifdatum::setValue(const std::string& buf)
+    void Exifdatum::setValue(const std::string& value)
     {
         if (value_.get() == 0) value_ = Value::create(asciiString);
-        value_->read(buf);
+        value_->read(value);
     }
 
     int TiffThumbnail::setDataArea(ExifData& exifData, Ifd& ifd1,
diff --git a/src/exif.hpp b/src/exif.hpp
index 4cca64b..5b6db5c 100644
--- a/src/exif.hpp
+++ b/src/exif.hpp
@@ -62,7 +62,8 @@ namespace Exiv2 {
 // class definitions
 
     /*!
-      @brief Information related to one Exif tag.
+      @brief Information related to one Exif tag. An Exif metadatum consists of
+             an ExifKey and a Value and provides methods to manipulate these.
      */
     class Exifdatum : public Metadatum {
         friend std::ostream& operator<<(std::ostream&, const Exifdatum&);
@@ -95,62 +96,60 @@ namespace Exiv2 {
         //! Assignment operator
         Exifdatum& operator=(const Exifdatum& rhs);
         /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 AsciiValue value is created and set to \em value.
-         */
-        Exifdatum& operator=(const std::string& value);
-        /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 UShortValue value is created and set to \em value.
+          @brief Assign \em value to the %Exifdatum. The type of the new Value
+                 is set to UShortValue.
          */
         Exifdatum& operator=(const uint16_t& value); 
         /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 ULongValue value is created and set to \em value.
+          @brief Assign \em value to the %Exifdatum. The type of the new Value
+                 is set to ULongValue.
          */
         Exifdatum& operator=(const uint32_t& value);
         /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 URational value is created and set to \em value.
+          @brief Assign \em value to the %Exifdatum. The type of the new Value
+                 is set to URationalValue.
          */
         Exifdatum& operator=(const URational& value);
         /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 ShortValue value is created and set to \em value.
+          @brief Assign \em value to the %Exifdatum. The type of the new Value
+                 is set to ShortValue.
          */
         Exifdatum& operator=(const int16_t& value);
         /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 LongValue value is created and set to \em value.
+          @brief Assign \em value to the %Exifdatum. The type of the new Value
+                 is set to LongValue.
          */
         Exifdatum& operator=(const int32_t& value);
         /*!
-          @brief Assign \em value to the %Exifdatum. If the object already has a
-                 value, it is replaced with \em value.  Otherwise a new
-                 Rational value is created and set to \em value.
+          @brief Assign \em value to the %Exifdatum. The type of the new Value
+                 is set to RationalValue.
          */
         Exifdatum& operator=(const Rational& value);
         /*!
+          @brief Assign \em value to the %Exifdatum.
+                 Calls setValue(const std::string&).                 
+         */
+        Exifdatum& operator=(const std::string& value);
+        /*!
+          @brief Assign \em value to the %Exifdatum.
+                 Calls setValue(const Value*).
+         */
+        Exifdatum& operator=(const Value& value);
+        /*!
           @brief Set the value. This method copies (clones) the value pointed
                  to by \em pValue.
          */
         void setValue(const Value* pValue);
         /*!
-          @brief Set the value from an IFD entry.
+          @brief Set the value to the string \em value. 
+                 Uses Value::read(const std::string&). If the %Exifdatum
+                 does not have a value yet, then an AsciiValue is created.
          */
-        void setValue(const Entry& e, ByteOrder byteOrder);
+        void setValue(const std::string& value);
         /*!
-          @brief Set the value to the string \em buf. 
-                 Uses Value::read(const std::string& buf). If the %Exifdatum does
-                 not have a value yet, then an AsciiValue is created.
+          @brief Set the value from an IFD entry.
          */
-        void setValue(const std::string& buf);
+        void setValue(const Entry& e, ByteOrder byteOrder);
         /*!
           @brief Set the data area by copying (cloning) the buffer pointed to 
                  by \em buf.
@@ -897,15 +896,10 @@ namespace Exiv2 {
     template<typename T>
     Exifdatum& setValue(Exifdatum& exifDatum, const T& value)
     {
-        if (exifDatum.value_.get() == 0) {
-            std::auto_ptr<ValueType<T> > v 
-                = std::auto_ptr<ValueType<T> >(new ValueType<T>);
-            v->value_.push_back(value);
-            exifDatum.value_ = v;
-        }
-        else {
-            exifDatum.value_->read(Exiv2::toString(value));
-        }
+        std::auto_ptr<ValueType<T> > v 
+            = std::auto_ptr<ValueType<T> >(new ValueType<T>);
+        v->value_.push_back(value);
+        exifDatum.value_ = v;
         return exifDatum;
     }
     /*!
diff --git a/src/iptc.cpp b/src/iptc.cpp
index 9bb1c21..420a1fa 100644
--- a/src/iptc.cpp
+++ b/src/iptc.cpp
@@ -96,6 +96,12 @@ namespace Exiv2 {
         return *this;
     }
 
+    Iptcdatum& Iptcdatum::operator=(const Value& value)
+    {
+        setValue(&value);
+        return *this;
+    }
+
     void Iptcdatum::setValue(const Value* pValue)
     {
         modified_ = true;
@@ -103,19 +109,13 @@ namespace Exiv2 {
         if (pValue) value_ = pValue->clone();
     }
 
-    void Iptcdatum::setValue(const std::string& buf)
+    void Iptcdatum::setValue(const std::string& value)
     {
-        Value::AutoPtr value;
-        try {
+        if (value_.get() == 0) {
             TypeId type = IptcDataSets::dataSetType(tag(), record());
-            value = Value::create(type);
-        }
-        catch (const Error&) {
-            // Default to a StringValue if the type is unknown or the parse fails
-            value = Value::create(string);
+            value_ = Value::create(type);
         }
-        value->read(buf);
-        value_ = value;
+        value_->read(value);
         modified_ = true;
     }
 
@@ -213,18 +213,9 @@ namespace Exiv2 {
                            const byte* data, uint32_t sizeData)
     {
         Value::AutoPtr value;
-        try {
-            // If the type is unknown or the parse fails then
-            // default to undefined type below.
-            TypeId type = IptcDataSets::dataSetType(dataSet, record);
-            value = Value::create(type);
-            value->read(data, sizeData, bigEndian);
-        } 
-        catch (const Error&) {
-            // Default to loading as raw bytes
-            value = Value::create(undefined);
-            value->read(data, sizeData, bigEndian);
-        }
+        TypeId type = IptcDataSets::dataSetType(dataSet, record);
+        value = Value::create(type);
+        value->read(data, sizeData, bigEndian);
         IptcKey key(dataSet, record);
         add(key, value.get());
         return 0;
diff --git a/src/iptc.hpp b/src/iptc.hpp
index c9bf527..bdde1fd 100644
--- a/src/iptc.hpp
+++ b/src/iptc.hpp
@@ -49,7 +49,8 @@ namespace Exiv2 {
 // class definitions
 
     /*!
-      @brief Information related to one Iptc dataset.
+      @brief Information related to one Iptc dataset. An Iptc metadatum consists 
+             of an IptcKey and a Value and provides methods to manipulate these.
      */
     class Iptcdatum : public Metadatum {
     public:
@@ -80,28 +81,34 @@ namespace Exiv2 {
         //! Assignment operator
         Iptcdatum& operator=(const Iptcdatum& rhs);
         /*!
-          @brief Assign \em value to the %Iptcdatum. The type of the new value
-                 is determined from %Iptcdatum. If that fails, a StringValue is
-                 used. Calls setValue(const std::string&).
+          @brief Assign \em value to the %Iptcdatum. The type of the new Value
+                 is set to UShortValue.
+         */
+        Iptcdatum& operator=(const uint16_t& value);
+        /*!
+          @brief Assign \em value to the %Iptcdatum. 
+                 Calls setValue(const std::string&).
          */
         Iptcdatum& operator=(const std::string& value);
         /*!
-          @brief Assign \em value to the %Iptcdatum. The type of the new value
-                 is set to UShortValue.
+          @brief Assign \em value to the %Iptcdatum.
+                 Calls setValue(const Value*).
          */
-        Iptcdatum& operator=(const uint16_t& value);
+        Iptcdatum& operator=(const Value& value);
         /*!
-          @brief Set the value. This method copies (clones) the value pointed
-                 to by pValue.
+          @brief Set the Value. This method copies (clones) the %Value pointed
+                 to by \em pValue.
          */
         void setValue(const Value* pValue);
         /*!
-          @brief Set the value to the string buf. Uses Value::read(const
-                 std::string& buf). If the %Iptcdatum does not have a value yet,
-                 then a value of the correct type for this %Iptcdatum is
-                 created. If that fails, a StringValue is created.
+          @brief Set the value to the string \em value, using 
+                 Value::read(const std::string&). 
+                 If the %Iptcdatum does not have a Value yet, then a %Value of
+                 the correct type for this %Iptcdatum is created. If that
+                 fails (because of an unknown dataset), a StringValue is 
+                 created.
          */
-        void setValue(const std::string& buf);
+        void setValue(const std::string& value);
         //@}
 
         //! @name Accessors
diff --git a/src/iptceasy.cpp b/src/iptceasy.cpp
index dbd3faa..0dea905 100644
--- a/src/iptceasy.cpp
+++ b/src/iptceasy.cpp
@@ -10,7 +10,6 @@ void printIptc(const Exiv2::IptcData& iptcData);
 
 int main()
 try {
-
     Exiv2::IptcData iptcData;
 
     iptcData["Iptc.Application2.Headline"] = "The headline I am";
@@ -21,10 +20,15 @@ try {
     iptcData["Iptc.Envelope.ModelVersion"] = 2;
     iptcData["Iptc.Envelope.TimeSent"] = "14:41:0-05:00";
     iptcData["Iptc.Application2.RasterizedCaption"] = "230 42 34 2 90 84 23 146";
+    iptcData["Iptc.0x0009.0x0001"] = "Who am I?";
+
+    Exiv2::StringValue value;
+    value.read("Hi there!");
+    iptcData["Iptc.Envelope.ModelVersion"] = value;
 
     std::cout << "Time sent: " << iptcData["Iptc.Envelope.TimeSent"] << "

";
 
-    printIptc(iptcData);    
+    printIptc(iptcData);
 
     return 0;
 }

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list