changeset 676:3a4a7385997c

get processed values from exiv2 http://sourceforge.net/tracker/index.php?func=detail&aid=1962444&group_id=222125&atid=1054680
author nadvornik
date Fri, 16 May 2008 20:09:32 +0000
parents cca86176bf81
children 6304ba358850
files src/exiv2.cc
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/exiv2.cc	Fri May 16 14:59:45 2008 +0000
+++ b/src/exiv2.cc	Fri May 16 20:09:32 2008 +0000
@@ -446,10 +446,25 @@
 {
 	try {
 		if (!item) return NULL;
-//		std::stringstream str;  // does not work with Exiv2::Metadatum because operator<< is not virtual
-//		str << *((Exiv2::Metadatum *)item);
-//		return g_strdup(str.str().c_str());
-		return g_strdup(((Exiv2::Metadatum *)item)->toString().c_str());
+		Exiv2::Metadatum *metadatum = (Exiv2::Metadatum *)item;
+#if EXIV2_TEST_VERSION(0,16,0)
+		return g_strdup(metadatum->print().c_str());
+#else
+		std::stringstream str;
+		Exiv2::Exifdatum *exifdatum;
+		Exiv2::Iptcdatum *iptcdatum;
+		Exiv2::Xmpdatum *xmpdatum;
+		if ((exifdatum = dynamic_cast<Exiv2::Exifdatum *>(metadatum)))
+			str << *exifdatum;
+		else if ((iptcdatum = dynamic_cast<Exiv2::Iptcdatum *>(metadatum)))
+			str << *iptcdatum;
+#if EXIV2_TEST_VERSION(0,16,0)
+		else if ((xmpdatum = dynamic_cast<Exiv2::Xmpdatum *>(metadatum)))
+			str << *xmpdatum;
+#endif
+
+		return g_strdup(str.str().c_str());
+#endif
 	}
 	catch (Exiv2::AnyError& e) {
 		return NULL;