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

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


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

The following commit has been merged in the master branch:
commit 248cfb33c562eed980436f8dd0544411ed7b54ea
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Mon Aug 16 13:38:06 2010 +0000

    #719: Removed standard Exif tag definitions and pretty-print functions from the API. Fixed warnings in the code for Float and Double values (added for #711).
---
 src/CMakeLists.txt   |    1 +
 src/canonmn.cpp      |    1 +
 src/crwimage.cpp     |    1 +
 src/fujimn.cpp       |    1 +
 src/minoltamn.cpp    |    1 +
 src/nikonmn.cpp      |    2 +-
 src/olympusmn.cpp    |    2 +-
 src/panasonicmn.cpp  |    1 +
 src/pentaxmn_int.hpp |    1 +
 src/properties.cpp   |    4 +-
 src/sigmamn.cpp      |    1 +
 src/sonymn.cpp       |    1 +
 src/tags.cpp         | 1771 +++++++++++++++++++++++++-------------------------
 src/tags.hpp         |  224 +------
 src/tags_int.hpp     |  278 ++++++++
 src/types.cpp        |  127 ++--
 16 files changed, 1253 insertions(+), 1164 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7af4cb9..a33b8f5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -45,6 +45,7 @@ SET( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp
                           rw2image_int.hpp
                           sigmamn_int.hpp
                           sonymn_int.hpp
+			  tags_int.hpp
                           tiffcomposite_int.hpp
                           tifffwd_int.hpp
                           tiffimage_int.hpp
diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 8cc2479..52ac191 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -33,6 +33,7 @@ EXIV2_RCSID("@(#) $Id$")
 // included header files
 #include "types.hpp"
 #include "canonmn_int.hpp"
+#include "tags_int.hpp"
 #include "value.hpp"
 #include "exif.hpp"
 #include "i18n.h"                // NLS support.
diff --git a/src/crwimage.cpp b/src/crwimage.cpp
index 813140c..0ee1374 100644
--- a/src/crwimage.cpp
+++ b/src/crwimage.cpp
@@ -47,6 +47,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "futils.hpp"
 #include "value.hpp"
 #include "tags.hpp"
+#include "tags_int.hpp"
 #include "canonmn_int.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/fujimn.cpp b/src/fujimn.cpp
index ab96bfe..80de14a 100644
--- a/src/fujimn.cpp
+++ b/src/fujimn.cpp
@@ -35,6 +35,7 @@ EXIV2_RCSID("@(#) $Id$")
 // included header files
 #include "types.hpp"
 #include "fujimn_int.hpp"
+#include "tags_int.hpp"
 #include "value.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/minoltamn.cpp b/src/minoltamn.cpp
index 753dc1e..e0ef118 100644
--- a/src/minoltamn.cpp
+++ b/src/minoltamn.cpp
@@ -34,6 +34,7 @@ EXIV2_RCSID("@(#) $Id$")
 // *****************************************************************************
 // included header files
 #include "minoltamn_int.hpp"
+#include "tags_int.hpp"
 #include "value.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp
index 7e0200a..662a199 100644
--- a/src/nikonmn.cpp
+++ b/src/nikonmn.cpp
@@ -40,7 +40,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "nikonmn_int.hpp"
 #include "value.hpp"
 #include "image.hpp"
-#include "tags.hpp"
+#include "tags_int.hpp"
 #include "error.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/olympusmn.cpp b/src/olympusmn.cpp
index e2f28a6..b8d0d25 100644
--- a/src/olympusmn.cpp
+++ b/src/olympusmn.cpp
@@ -39,7 +39,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "olympusmn_int.hpp"
 #include "value.hpp"
 #include "image.hpp"
-#include "tags.hpp"
+#include "tags_int.hpp"
 #include "i18n.h"                // NLS support.
 
 // + standard includes
diff --git a/src/panasonicmn.cpp b/src/panasonicmn.cpp
index 45b90ea..a48c591 100644
--- a/src/panasonicmn.cpp
+++ b/src/panasonicmn.cpp
@@ -34,6 +34,7 @@ EXIV2_RCSID("@(#) $Id$")
 // included header files
 #include "types.hpp"
 #include "panasonicmn_int.hpp"
+#include "tags_int.hpp"
 #include "value.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/pentaxmn_int.hpp b/src/pentaxmn_int.hpp
index 75199f6..651f72d 100644
--- a/src/pentaxmn_int.hpp
+++ b/src/pentaxmn_int.hpp
@@ -35,6 +35,7 @@
 // *****************************************************************************
 // included header files
 #include "tags.hpp"
+#include "tags_int.hpp"
 #include "types.hpp"
 
 // + standard includes
diff --git a/src/properties.cpp b/src/properties.cpp
index 852263b..0355e22 100644
--- a/src/properties.cpp
+++ b/src/properties.cpp
@@ -32,7 +32,7 @@ EXIV2_RCSID("@(#) $Id$")
 // *****************************************************************************
 // included header files
 #include "properties.hpp"
-#include "tags.hpp"
+#include "tags_int.hpp"
 #include "error.hpp"
 #include "types.hpp"
 #include "value.hpp"
@@ -67,6 +67,8 @@ namespace {
 // class member definitions
 namespace Exiv2 {
 
+    using namespace Internal;
+
     //! @cond IGNORE
     extern const XmpPropertyInfo xmpDcInfo[];
     extern const XmpPropertyInfo xmpDigikamInfo[];
diff --git a/src/sigmamn.cpp b/src/sigmamn.cpp
index dfdce66..3476183 100644
--- a/src/sigmamn.cpp
+++ b/src/sigmamn.cpp
@@ -35,6 +35,7 @@ EXIV2_RCSID("@(#) $Id$")
 // included header files
 #include "types.hpp"
 #include "sigmamn_int.hpp"
+#include "tags_int.hpp"
 #include "value.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/sonymn.cpp b/src/sonymn.cpp
index 3a591f2..4afa325 100644
--- a/src/sonymn.cpp
+++ b/src/sonymn.cpp
@@ -33,6 +33,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "types.hpp"
 #include "minoltamn_int.hpp"
 #include "sonymn_int.hpp"
+#include "tags_int.hpp"
 #include "value.hpp"
 #include "i18n.h"                // NLS support.
 
diff --git a/src/tags.cpp b/src/tags.cpp
index c0b2922..fd85dd3 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -34,6 +34,7 @@ EXIV2_RCSID("@(#) $Id$")
 // included header files
 #include "types.hpp"
 #include "tags.hpp"
+#include "tags_int.hpp"
 #include "error.hpp"
 #include "futils.hpp"
 #include "value.hpp"
@@ -76,9 +77,7 @@ namespace {
 // *****************************************************************************
 // class member definitions
 namespace Exiv2 {
-
-    // Todo: Remove: temporary fix used during migration of makernote classes to namespace Internal
-    using namespace Internal;
+    namespace Internal {
 
     bool TagVocabulary::operator==(const std::string& key) const
     {
@@ -86,161 +85,6 @@ namespace Exiv2 {
         return 0 == strcmp(voc_, key.c_str() + key.size() - strlen(voc_));
     }
 
-    //! @cond IGNORE
-    IfdInfo::Item::Item(const std::string& item)
-    {
-        i_ = item;
-    }
-    //! @endcond
-
-    bool IfdInfo::operator==(IfdId ifdId) const
-    {
-        return ifdId_ == ifdId;
-    }
-
-    bool IfdInfo::operator==(const Item& item) const
-    {
-        return 0 == strcmp(item.i_.c_str(), item_);
-    }
-
-    // Important: IFD item must be unique!
-    const IfdInfo ExifTags::ifdInfo_[] = {
-        { ifdIdNotSet,       "(Unknown IFD)", "(Unknown item)", 0 },
-        { ifd0Id,            "IFD0",      "Image",        ExifTags::ifdTagList           },
-        { exifIfdId,         "Exif",      "Photo",        ExifTags::exifTagList          }, // just to avoid 'Exif.Exif.*' keys
-        { gpsIfdId,          "GPSInfo",   "GPSInfo",      ExifTags::gpsTagList           },
-        { iopIfdId,          "Iop",       "Iop",          ExifTags::iopTagList           },
-        { ifd1Id,            "IFD1",      "Thumbnail",    ExifTags::ifdTagList           },
-        { ifd2Id,            "IFD2",      "Image2",       ExifTags::ifdTagList           },
-        { ifd3Id,            "IFD3",      "Image3",       ExifTags::ifdTagList           },
-        { subImage1Id,       "SubImage1", "SubImage1",    ExifTags::ifdTagList           },
-        { subImage2Id,       "SubImage2", "SubImage2",    ExifTags::ifdTagList           },
-        { subImage3Id,       "SubImage3", "SubImage3",    ExifTags::ifdTagList           },
-        { subImage4Id,       "SubImage4", "SubImage4",    ExifTags::ifdTagList           },
-        { subImage5Id,       "SubImage5", "SubImage5",    ExifTags::ifdTagList           },
-        { subImage6Id,       "SubImage6", "SubImage6",    ExifTags::ifdTagList           },
-        { subImage7Id,       "SubImage7", "SubImage7",    ExifTags::ifdTagList           },
-        { subImage8Id,       "SubImage8", "SubImage8",    ExifTags::ifdTagList           },
-        { subImage9Id,       "SubImage9", "SubImage9",    ExifTags::ifdTagList           },
-        { mnIfdId,           "Makernote", "MakerNote",    ExifTags::mnTagList            },
-        { canonIfdId,        "Makernote", "Canon",        CanonMakerNote::tagList        },
-        { canonCsIfdId,      "Makernote", "CanonCs",      CanonMakerNote::tagListCs      },
-        { canonSiIfdId,      "Makernote", "CanonSi",      CanonMakerNote::tagListSi      },
-        { canonCfIfdId,      "Makernote", "CanonCf",      CanonMakerNote::tagListCf      },
-        { canonPiIfdId,      "Makernote", "CanonPi",      CanonMakerNote::tagListPi      },
-        { canonFiIfdId,      "Makernote", "CanonFi",      CanonMakerNote::tagListFi      },
-        { canonPaIfdId,      "Makernote", "CanonPa",      CanonMakerNote::tagListPa      },
-        { fujiIfdId,         "Makernote", "Fujifilm",     FujiMakerNote::tagList         },
-        { minoltaIfdId,      "Makernote", "Minolta",      MinoltaMakerNote::tagList      },
-        { minoltaCs5DIfdId,  "Makernote", "MinoltaCs5D",  MinoltaMakerNote::tagListCs5D  },
-        { minoltaCs7DIfdId,  "Makernote", "MinoltaCs7D",  MinoltaMakerNote::tagListCs7D  },
-        { minoltaCsOldIfdId, "Makernote", "MinoltaCsOld", MinoltaMakerNote::tagListCsStd },
-        { minoltaCsNewIfdId, "Makernote", "MinoltaCsNew", MinoltaMakerNote::tagListCsStd },
-        { nikon1IfdId,       "Makernote", "Nikon1",       Nikon1MakerNote::tagList       },
-        { nikon2IfdId,       "Makernote", "Nikon2",       Nikon2MakerNote::tagList       },
-        { nikon3IfdId,       "Makernote", "Nikon3",       Nikon3MakerNote::tagList       },
-        { nikonPvIfdId,      "Makernote", "NikonPreview", ExifTags::ifdTagList           },
-        { nikonVrIfdId,      "Makernote", "NikonVr",      Nikon3MakerNote::tagListVr     },
-        { nikonPcIfdId,      "Makernote", "NikonPc",      Nikon3MakerNote::tagListPc     },
-        { nikonWtIfdId,      "Makernote", "NikonWt",      Nikon3MakerNote::tagListWt     },
-        { nikonIiIfdId,      "Makernote", "NikonIi",      Nikon3MakerNote::tagListIi     },
-        { nikonAfIfdId,      "Makernote", "NikonAf",      Nikon3MakerNote::tagListAf     },
-        { nikonAf2IfdId,     "Makernote", "NikonAf2",     Nikon3MakerNote::tagListAf2    },
-        { nikonFiIfdId,      "Makernote", "NikonFi",      Nikon3MakerNote::tagListFi     },
-        { nikonMeIfdId,      "Makernote", "NikonMe",      Nikon3MakerNote::tagListMe     },
-        { nikonFl1IfdId,     "Makernote", "NikonFl1",     Nikon3MakerNote::tagListFl1    },
-        { nikonFl2IfdId,     "Makernote", "NikonFl2",     Nikon3MakerNote::tagListFl2    },
-        { nikonFl3IfdId,     "Makernote", "NikonFl3",     Nikon3MakerNote::tagListFl3    },
-        { nikonSi1IfdId,     "Makernote", "NikonSiD80",   Nikon3MakerNote::tagListSi1    },
-        { nikonSi2IfdId,     "Makernote", "NikonSiD40",   Nikon3MakerNote::tagListSi2    },
-        { nikonSi3IfdId,     "Makernote", "NikonSiD300a", Nikon3MakerNote::tagListSi3    },
-        { nikonSi4IfdId,     "Makernote", "NikonSiD300b", Nikon3MakerNote::tagListSi4    },
-        { nikonSi5IfdId,     "Makernote", "NikonSi02xx",  Nikon3MakerNote::tagListSi5    },
-        { nikonSi6IfdId,     "Makernote", "NikonSi01xx",  Nikon3MakerNote::tagListSi5    },
-        { nikonCb1IfdId,     "Makernote", "NikonCb1",     Nikon3MakerNote::tagListCb1    },
-        { nikonCb2IfdId,     "Makernote", "NikonCb2",     Nikon3MakerNote::tagListCb2    },
-        { nikonCb2aIfdId,    "Makernote", "NikonCb2a",    Nikon3MakerNote::tagListCb2a   },
-        { nikonCb2bIfdId,    "Makernote", "NikonCb2b",    Nikon3MakerNote::tagListCb2b   },
-        { nikonCb3IfdId,     "Makernote", "NikonCb3",     Nikon3MakerNote::tagListCb3    },
-        { nikonCb4IfdId,     "Makernote", "NikonCb4",     Nikon3MakerNote::tagListCb4    },
-        { nikonLd1IfdId,     "Makernote", "NikonLd1",     Nikon3MakerNote::tagListLd1    },
-        { nikonLd2IfdId,     "Makernote", "NikonLd2",     Nikon3MakerNote::tagListLd2    },
-        { nikonLd3IfdId,     "Makernote", "NikonLd3",     Nikon3MakerNote::tagListLd3    },
-        { olympusIfdId,      "Makernote", "Olympus",      OlympusMakerNote::tagList      },
-        { olympus2IfdId,     "Makernote", "Olympus2",     OlympusMakerNote::tagList      },
-        { olympusCsIfdId,    "Makernote", "OlympusCs",    OlympusMakerNote::tagListCs    },
-        { olympusEqIfdId,    "Makernote", "OlympusEq",    OlympusMakerNote::tagListEq    },
-        { olympusRdIfdId,    "Makernote", "OlympusRd",    OlympusMakerNote::tagListRd    },
-        { olympusRd2IfdId,   "Makernote", "OlympusRd2",   OlympusMakerNote::tagListRd2   },
-        { olympusIpIfdId,    "Makernote", "OlympusIp",    OlympusMakerNote::tagListIp    },
-        { olympusFiIfdId,    "Makernote", "OlympusFi",    OlympusMakerNote::tagListFi    },
-        { olympusFe1IfdId,   "Makernote", "OlympusFe1",   OlympusMakerNote::tagListFe    },
-        { olympusFe2IfdId,   "Makernote", "OlympusFe2",   OlympusMakerNote::tagListFe    },
-        { olympusFe3IfdId,   "Makernote", "OlympusFe3",   OlympusMakerNote::tagListFe    },
-        { olympusFe4IfdId,   "Makernote", "OlympusFe4",   OlympusMakerNote::tagListFe    },
-        { olympusFe5IfdId,   "Makernote", "OlympusFe5",   OlympusMakerNote::tagListFe    },
-        { olympusFe6IfdId,   "Makernote", "OlympusFe6",   OlympusMakerNote::tagListFe    },
-        { olympusFe7IfdId,   "Makernote", "OlympusFe7",   OlympusMakerNote::tagListFe    },
-        { olympusFe8IfdId,   "Makernote", "OlympusFe8",   OlympusMakerNote::tagListFe    },
-        { olympusFe9IfdId,   "Makernote", "OlympusFe9",   OlympusMakerNote::tagListFe    },
-        { olympusRiIfdId,    "Makernote", "OlympusRi",    OlympusMakerNote::tagListRi    },
-        { panasonicIfdId,    "Makernote", "Panasonic",    PanasonicMakerNote::tagList    },
-        { panaRawIfdId,      "PanaRaw",   "PanasonicRaw", PanasonicMakerNote::tagListRaw },
-        { pentaxIfdId,       "Makernote", "Pentax",       PentaxMakerNote::tagList       },
-        { sigmaIfdId,        "Makernote", "Sigma",        SigmaMakerNote::tagList        },
-        { sony1IfdId,        "Makernote", "Sony1",        SonyMakerNote::tagList         },
-        { sony2IfdId,        "Makernote", "Sony2",        SonyMakerNote::tagList         },
-        { sonyMltIfdId,      "Makernote", "SonyMinolta",  MinoltaMakerNote::tagList      },
-        { sony1CsIfdId,      "Makernote", "Sony1Cs",      SonyMakerNote::tagListCs       },
-        { sony1Cs2IfdId,     "Makernote", "Sony1Cs2",     SonyMakerNote::tagListCs2      },
-        { sony1MltCs7DIfdId, "Makernote", "Sony1MltCs7D", MinoltaMakerNote::tagListCs7D  },
-        { sony1MltCsOldIfdId,"Makernote", "Sony1MltCsOld",MinoltaMakerNote::tagListCsStd },
-        { sony1MltCsNewIfdId,"Makernote", "Sony1MltCsNew",MinoltaMakerNote::tagListCsStd },
-        { sony1MltCsA100IfdId,"Makernote","Sony1MltCsA100",MinoltaMakerNote::tagListCsA100},
-        { sony2CsIfdId,      "Makernote", "Sony2Cs",      SonyMakerNote::tagListCs       },
-        { sony2Cs2IfdId,     "Makernote", "Sony2Cs2",     SonyMakerNote::tagListCs2      },
-        { lastIfdId,         "(Last IFD info)", "(Last IFD item)", 0 }
-    };
-
-    const SectionInfo ExifTags::sectionInfo_[] = {
-        { sectionIdNotSet, "(UnknownSection)",     N_("Unknown section")              },
-        { imgStruct,       "ImageStructure",       N_("Image data structure")         },
-        { recOffset,       "RecordingOffset",      N_("Recording offset")             },
-        { imgCharacter,    "ImageCharacteristics", N_("Image data characteristics")   },
-        { otherTags,       "OtherTags",            N_("Other data")                   },
-        { exifFormat,      "ExifFormat",           N_("Exif data structure")          },
-        { exifVersion,     "ExifVersion",          N_("Exif version")                 },
-        { imgConfig,       "ImageConfig",          N_("Image configuration")          },
-        { userInfo,        "UserInfo",             N_("User information")             },
-        { relatedFile,     "RelatedFile",          N_("Related file")                 },
-        { dateTime,        "DateTime",             N_("Date and time")                },
-        { captureCond,     "CaptureConditions",    N_("Picture taking conditions")    },
-        { gpsTags,         "GPS",                  N_("GPS information")              },
-        { iopTags,         "Interoperability",     N_("Interoperability information") },
-        { makerTags,       "Makernote",            N_("Vendor specific information")  },
-        { dngTags,         "DngTags",              N_("Adobe DNG tags")               },
-        { panaRaw,         "PanasonicRaw",         N_("Panasonic RAW tags")           },
-        { tiffEp,          "TIFF/EP",              N_("TIFF/EP tags")                 },
-        { tiffPm6,         "TIFF&PM6",             N_("TIFF PageMaker 6.0 tags")      },
-        { adobeOpi,        "AdobeOPI",             N_("Adobe OPI tags")               },
-        { lastSectionId,   "(LastSection)",        N_("Last section")                 }
-    };
-
-    TagInfo::TagInfo(
-        uint16_t tag,
-        const char* name,
-        const char* title,
-        const char* desc,
-        IfdId ifdId,
-        SectionId sectionId,
-        TypeId typeId,
-        PrintFct printFct
-    )
-        : tag_(tag), name_(name), title_(title), desc_(desc), ifdId_(ifdId),
-          sectionId_(sectionId), typeId_(typeId), printFct_(printFct)
-    {
-    }
-
     //! NewSubfileType, TIFF tag 0x00fe - this is actually a bitmask
     extern const TagDetails exifNewSubfileType[] = {
         {  0, N_("Primary image")                                               },
@@ -1230,11 +1074,6 @@ namespace Exiv2 {
                 ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue)
     };
 
-    const TagInfo* ExifTags::ifdTagList()
-    {
-        return ifdTagInfo;
-    }
-
     //! ExposureProgram, tag 0x8822
     extern const TagDetails exifExposureProgram[] = {
         { 0, N_("Not defined")       },
@@ -1639,11 +1478,6 @@ namespace Exiv2 {
                 ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue)
     };
 
-    const TagInfo* ExifTags::exifTagList()
-    {
-        return exifTagInfo;
-    }
-
     //! GPS latitude reference, tag 0x0001; also GPSDestLatitudeRef, tag 0x0013
     extern const TagDetails exifGPSLatitudeRef[] = {
         { 78, N_("North") },
@@ -1857,11 +1691,6 @@ namespace Exiv2 {
                 ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue)
     };
 
-    const TagInfo* ExifTags::gpsTagList()
-    {
-        return gpsTagInfo;
-    }
-
     // Exif Interoperability IFD Tags
     static const TagInfo iopTagInfo[] = {
         TagInfo(0x0001, "InteroperabilityIndex", N_("Interoperability Index"),
@@ -1889,11 +1718,6 @@ namespace Exiv2 {
                 ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue)
     };
 
-    const TagInfo* ExifTags::iopTagList()
-    {
-        return iopTagInfo;
-    }
-
     // Synthesized Exiv2 Makernote info Tags (read-only)
     static const TagInfo mnTagInfo[] = {
         TagInfo(0x0001, "Offset", N_("Offset"),
@@ -1908,992 +1732,1141 @@ namespace Exiv2 {
                 ifdIdNotSet, sectionIdNotSet, invalidTypeId, printValue)
     };
 
-    const TagInfo* ExifTags::mnTagList()
-    {
-        return mnTagInfo;
-    }
-
     // Unknown Tag
     static const TagInfo unknownTag(0xffff, "Unknown tag", N_("Unknown tag"),
                                     N_("Unknown tag"),
                                     ifdIdNotSet, sectionIdNotSet, asciiString, printValue);
 
-    const TagInfo* ExifTags::tagList(const std::string& group)
+    std::ostream& printValue(std::ostream& os, const Value& value, const ExifData*)
     {
-        const IfdInfo* ii = find(ifdInfo_, IfdInfo::Item(group));
-        if (ii == 0 || ii->tagList_ == 0) return 0;
-        return ii->tagList_();
-    } // ExifTags::tagList
+        return os << value;
+    }
 
-    const TagInfo* ExifTags::tagList(IfdId ifdId)
+    std::ostream& printLong(std::ostream& os, const Value& value, const ExifData*)
     {
-        const IfdInfo* ii = find(ifdInfo_, ifdId);
-        if (ii == 0 || ii->tagList_ == 0) return 0;
-        return ii->tagList_();
-    } // ExifTags::tagList
+        Rational r = value.toRational();
+        if (r.second != 0) return os << static_cast<long>(r.first) / r.second;
+        return os << "(" << value << ")";
+    } // printLong
 
-    const TagInfo* ExifTags::tagInfo(uint16_t tag, IfdId ifdId)
+    std::ostream& printFloat(std::ostream& os, const Value& value, const ExifData*)
     {
-        const TagInfo* ti = tagList(ifdId);
-        if (ti == 0) return 0;
-        for (int idx = 0; ti[idx].tag_ != 0xffff; ++idx) {
-            if (ti[idx].tag_ == tag) return &ti[idx];
-        }
-        return 0;
-    } // ExifTags::tagInfo
+        Rational r = value.toRational();
+        if (r.second != 0) return os << static_cast<float>(r.first) / r.second;
+        return os << "(" << value << ")";
+    } // printFloat
 
-    const TagInfo* ExifTags::tagInfo(const std::string& tagName, IfdId ifdId)
+    std::ostream& printDegrees(std::ostream& os, const Value& value, const ExifData*)
     {
-        const TagInfo* ti = tagList(ifdId);
-        if (ti == 0) return 0;
-        const char* tn = tagName.c_str();
-        if (tn == 0) return 0;
-        for (int idx = 0; ti[idx].tag_ != 0xffff; ++idx) {
-            if (0 == strcmp(ti[idx].name_, tn)) {
-                return &ti[idx];
+        if (value.count() == 3) {
+            std::ostringstream oss;
+            oss.copyfmt(os);
+            static const char* unit[] = { "deg", "'", "\"" };
+            static const int prec[] = { 7, 5, 3 };
+            int n;
+            for (n = 2; n > 0; --n) {
+                if (value.toRational(n).first != 0) break;
+            }
+            for (int i = 0; i < n + 1; ++i) {
+                const int32_t z = value.toRational(i).first;
+                const int32_t d = value.toRational(i).second;
+                if (d == 0) return os << "(" << value << ")";
+                // Hack: Need Value::toDouble
+                double b = static_cast<double>(z)/d;
+                const int p = z % d == 0 ? 0 : prec[i];
+                os << std::fixed << std::setprecision(p) << b
+                   << unit[i] << " ";
             }
+            os.copyfmt(oss);
         }
-        return 0;
-    } // ExifTags::tagInfo
-
-    bool ExifTags::isMakerIfd(IfdId ifdId)
-    {
-        bool rc = false;
-        const IfdInfo* ii = find(ifdInfo_, ifdId);
-        if (ii != 0 && 0 == strcmp(ii->name_, "Makernote")) {
-            rc = true;
+        else {
+            os << value;
         }
-        return rc;
-    } // ExifTags::isMakerIfd
 
-    bool ExifTags::isExifIfd(IfdId ifdId)
-    {
-        bool rc;
-        switch (ifdId) {
-        case ifd0Id:
-        case exifIfdId:
-        case gpsIfdId:
-        case iopIfdId:
-        case ifd1Id:
-        case ifd2Id:
-        case ifd3Id:
-        case subImage1Id:
-        case subImage2Id:
-        case subImage3Id:
-        case subImage4Id:
-        case subImage5Id:
-        case subImage6Id:
-        case subImage7Id:
-        case subImage8Id:
-        case subImage9Id:
-        case panaRawIfdId: rc = true; break;
-        default:           rc = false; break;
-        }
-        return rc;
-    } // ExifTags::isExifIfd
+        return os;
+    } // printDegrees
 
-    std::string ExifTags::tagName(uint16_t tag, IfdId ifdId)
+    std::ostream& printUcs2(std::ostream& os, const Value& value, const ExifData*)
     {
-        const TagInfo* ti = tagInfo(tag, ifdId);
-        if (ti != 0) return ti->name_;
-        std::ostringstream os;
-        os << "0x" << std::setw(4) << std::setfill('0') << std::right
-           << std::hex << tag;
-        return os.str();
-    } // ExifTags::tagName
+#if defined WIN32 && !defined __CYGWIN__
+        // in Windows the WideCharToMultiByte function can be used
+        if (value.typeId() == unsignedByte) {
+            DataBuf ib(value.size());
+            value.copy(ib.pData_, invalidByteOrder);
+            int out_size = WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast<LPWSTR>(ib.pData_),
+                                               ib.size_ / sizeof(WCHAR), NULL, 0, NULL, NULL);
+            if (out_size >= 0) {
+                DataBuf ob(out_size + 1);
+                WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast<LPWSTR>(ib.pData_),
+                                    ib.size_ / sizeof(WCHAR), reinterpret_cast<char*>(ob.pData_),
+                                    ob.size_, NULL, NULL);
+                os << std::string(reinterpret_cast<char*>(ob.pData_));
+            }
+            else {
+                os << value;
+            }
+        }
+        return os;
+#elif defined EXV_HAVE_ICONV // !(defined WIN32 && !defined __CYGWIN__)
+        bool go = true;
+        iconv_t cd = (iconv_t)(-1);
+        if (value.typeId() != unsignedByte) {
+            go = false;
+        }
+        if (go) {
+            cd = iconv_open("UTF-8", "UCS-2LE");
+            if (cd == (iconv_t)(-1)) {
+#ifndef SUPPRESS_WARNINGS
+                std::cerr << "Warning: iconv_open: " << strError() << "
";
+#endif
+                go = false;
+            }
+        }
+        if (go) {
+            DataBuf ib(value.size());
+            value.copy(ib.pData_, invalidByteOrder);
+            DataBuf ob(value.size());
+            char* outptr = reinterpret_cast<char*>(ob.pData_);
+            const char* outbuf = outptr;
+            size_t outbytesleft = ob.size_;
+            EXV_ICONV_CONST char* inbuf
+                = reinterpret_cast<EXV_ICONV_CONST char*>(ib.pData_);
+            size_t inbytesleft = ib.size_;
+            size_t rc = iconv(cd,
+                              &inbuf,
+                              &inbytesleft,
+                              &outptr,
+                              &outbytesleft);
+            if (rc == size_t(-1)) {
+#ifndef SUPPRESS_WARNINGS
+                std::cerr << "Warning: iconv: "
+                          << strError()
+                          << " inbytesleft = " << inbytesleft << "
";
+#endif
+                go = false;
+            }
+            if (go) {
+                if (outptr > outbuf && *(outptr-1) == '

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list