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

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


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

The following commit has been merged in the master branch:
commit 35e9a18f8c1d020c784e228b561cab0bf5f4a706
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Feb 6 12:11:58 2004 +0000

    Isolated makeKey and decomposeKey functions
---
 src/tags.cpp | 36 +++++++++++++++++++++++++++---------
 src/tags.hpp | 21 +++++++++++----------
 2 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/src/tags.cpp b/src/tags.cpp
index 3bb0d6a..827e94d 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -20,13 +20,13 @@
  */
 /*
   File:      tags.cpp
-  Version:   $Name:  $ $Revision: 1.8 $
+  Version:   $Name:  $ $Revision: 1.9 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   15-Jan-04, ahu: created
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.8 $ $RCSfile: tags.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.9 $ $RCSfile: tags.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -346,18 +346,36 @@ namespace Exif {
         return SectionId(i);
     }
 
+    std::string ExifTags::makeKey(uint16 tag, IfdId ifdId)
+    {
+        return std::string(ifdItem(ifdId)) 
+            + "." + std::string(sectionName(tag, ifdId)) 
+            + "." + std::string(tagName(tag, ifdId));
+    }
+
     // The uniqueness that we promise in this 'database lookup' function
     // holds only implicitely. The function returns the first match that
     // we find, it doesn't verify the uniqueness.
-    std::pair<IfdId, uint16> ExifTags::ifdAndTag(const std::string& ifdItem, 
-                                                 const std::string& sectionName, 
-                                                 const std::string& tagName)
+    std::pair<uint16, IfdId> ExifTags::decomposeKey(const std::string& key)
     {
+        // Get the IFD, section name and tag name parts of the key
+        std::string::size_type pos1 = key.find('.');
+        if (pos1 == std::string::npos) throw Error("Invalid key");
+        std::string ifdItem = key.substr(0, pos1);
+        std::string::size_type pos0 = pos1 + 1;
+        pos1 = key.find('.', pos0);
+        if (pos1 == std::string::npos) throw Error("Invalid key");
+        std::string sectionName = key.substr(pos0, pos1 - pos0);
+        pos0 = pos1 + 1;
+        std::string tagName = key.substr(pos0);
+        if (tagName == "") throw Error("Invalid key");
+
+        // Use the parts of the key to find tag and IFD id
         IfdId ifdId = ifdIdNotSet;
         uint16 tag = 0xffff;
-        
+
         SectionId s = sectionId(sectionName);
-        if (s == sectionIdNotSet) return std::make_pair(ifdId, tag);
+        if (s == sectionIdNotSet) return std::make_pair(tag, ifdId);
 
         for (int i = 0; i < lastIfdId; ++i) {
             if (ifdInfo_[i].item_ == ifdItem) {
@@ -369,8 +387,8 @@ namespace Exif {
                 }
             }
         }
-        return std::make_pair(ifdId, tag);
-    }
+        return std::make_pair(tag, ifdId);
+    } // ExifTags::decomposeKey
 
     // *************************************************************************
     // free functions
diff --git a/src/tags.hpp b/src/tags.hpp
index 2f2ef6e..cc19a51 100644
--- a/src/tags.hpp
+++ b/src/tags.hpp
@@ -21,7 +21,7 @@
 /*!
   @file    tags.hpp
   @brief   %Exif tag and type information
-  @version $Name:  $ $Revision: 1.8 $
+  @version $Name:  $ $Revision: 1.9 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    15-Jan-04, ahu: created
@@ -196,16 +196,17 @@ namespace Exif {
         //! Return the section id for a section name
         static SectionId sectionId(const std::string& sectionName);
         /*!
-          @brief Return the unique combination of IFD id and tag for the
-                 components of a key.
-          @param ifdItem The IFD item part of the key (first part)
-          @param sectionName The section name part of the key (second part)
-          @param tagName The tag name part of the key (third part)
-          @return A pair consisting of the IFD id and the tag.
+          @brief Return a unique key for the tag and IFD id.
+                 The key is of the form 'ifdItem.sectionName.tagName'.
          */
-        static std::pair<IfdId, uint16> ifdAndTag(const std::string& ifdItem, 
-                                                  const std::string& sectionName, 
-                                                  const std::string& tagName);
+        static std::string makeKey(uint16 tag, IfdId ifdId);
+        /*!
+          @brief Return the unique tag and IFD id pair for the key.
+          @return A pair consisting of the tag and IFD id.
+          @throw Error ("Invalid key") if the key cannot be parsed into
+                 item item, section name and tag name parts.
+         */
+        static std::pair<uint16, IfdId> decomposeKey(const std::string& key);
 
     private:
         static int tagInfoIdx(uint16 tag, IfdId ifdId);

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list