From a6a3da9df8780f75a7d72e7c86535b3f65195952 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 20 Apr 2015 08:54:52 +0000 Subject: [PATCH] #1054. Write LangAltValue as json object "lang" : { "en-US":"...." , ... } --- samples/exiv2json.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index 4bf35d5c..6fb433fb 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -3,7 +3,8 @@ // Sample program to print metadata in JSON format #include -#include +#include +#include #include #include @@ -176,6 +177,21 @@ void push(Jzon::Node& node,const std::string& key,T i) STORE(node,key,arr); } break; + case Exiv2::langAlt: { + Jzon::Object l ; + const Exiv2::LangAltValue& langs = dynamic_cast(i->value()); + for ( Exiv2::LangAltValue::ValueType::const_iterator lang = langs.value_.begin() + ; lang != langs.value_.end() + ; lang++ + ) { + l.Add(lang->first,lang->second); + } + Jzon::Object o ; + o.Add("lang",l); + STORE(node,key,o); + } + break; + default: case Exiv2::date: case Exiv2::time: @@ -188,7 +204,6 @@ void push(Jzon::Node& node,const std::string& key,T i) case Exiv2::xmpAlt: case Exiv2::xmpBag: case Exiv2::xmpSeq: - case Exiv2::langAlt: // http://dev.exiv2.org/boards/3/topics/1367#message-1373 if ( key == "UserComment" ) { size_t pos = value.find('\0') ;