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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:45:01 UTC 2017


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

The following commit has been merged in the master branch:
commit 779a10454d2f8bc350d46100255e8802061f7312
Author: Robin Mills <robin at clanmills.com>
Date:   Fri Apr 10 09:12:01 2015 +0000

    #1054.  Overhauled exiv2json to recursively build a JSON tree.  See discussion: http://dev.exiv2.org/boards/3/topics/1951
---
 samples/exiv2json.cpp | 576 +++++++++++++++++++++++++++++---------------------
 1 file changed, 330 insertions(+), 246 deletions(-)

diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp
index 6d6991e..ee24408 100644
--- a/samples/exiv2json.cpp
+++ b/samples/exiv2json.cpp
@@ -1,246 +1,330 @@
-// ***************************************************************** -*- C++ -*-
-// exif2json.cpp, $Id: exif2json.cpp 518 2013-05-10 23:53:00Z robinwmills at gmail.com $
-// Sample program to print the Exif metadata in JSON format
-
-#include <exiv2/exiv2.hpp>
-#include <Jzon.h>
-
-#include <iostream>
-#include <iomanip>
-#include <cassert>
-#include <string>
-
-#if defined(__MINGW32__) || defined(__MINGW64__)
-# ifndef  __MINGW__
-#  define __MINGW__
-# endif
-#endif
-
-#include <stdlib.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#if defined(_MSC_VER) || defined(__MINGW__)
-#include <windows.h>
-#ifndef  PATH_MAX
-# define  PATH_MAX 512
-#endif
-const char* realpath(const char* file,char* path)
-{
-	GetFullPathName(file,PATH_MAX,path,NULL);
-	return path;
-}
-#else
-#include <unistd.h>
-#endif
-
-using namespace std;
-using namespace Jzon;
-using namespace Exiv2;
-
-// http://stackoverflow.com/questions/236129/splitting-a-string-in-c
-static size_t split(const std::string& s, char delim, std::vector<std::string>& elems)
-{
-    std::stringstream ss(s);
-    std::string       item;
-    while (std::getline(ss, item, delim)) {
-        elems.push_back(item);
-    }
-    return elems.size();
-}
-
-Jzon::Object& objectForKey(std::string Key,std::string& name,Jzon::Object& root)
-{
-    static Jzon::Object object;
-    
-    std::vector<std::string> keys ;
-    size_t l = split(Key,'.',keys);
-    if   ( l < 3 || l > 7 ) return object; // maybe we should throw
-    
-    name     = keys[l-1];
-    size_t k = 0;
-    Jzon::Object& r1 = root;
-    
-    // this is horrible  References are pointers that don't work properly!
-    if ( !r1.Has(keys[k]) )             r1.Add(keys[k],object);
-    Jzon::Object& r2 = (Jzon::Object&)  r1.Get(keys[k]);
-    if  ( l == 2 ) return r2;
-    
-    if ( !r2.Has(keys[++k]))             r2.Add(keys[k],object);
-    Jzon::Object&   r3 = (Jzon::Object&) r2.Get(keys[k]);
-    if  ( l == 3 ) return r3;
-    
-    if ( !r3.Has(keys[++k]))             r3.Add(keys[k],object);
-    Jzon::Object&   r4 = (Jzon::Object&) r3.Get(keys[k]);
-    if  ( l == 4 ) return r4;
-    
-    if ( !r4.Has(keys[++k]))             r4.Add(keys[k],object);
-    Jzon::Object&   r5 = (Jzon::Object&) r4.Get(keys[k]);
-    if  ( l == 5 ) return r5;
-    
-    if ( !r5.Has(keys[++k]))             r5.Add(keys[k],object);
-    Jzon::Object&   r6 = (Jzon::Object&) r5.Get(keys[k]);
-    if  ( l == 6 ) return r6;
-    
-    if ( !r6.Has(keys[++k]))             r6.Add(keys[k],object);
-    Jzon::Object&   r7 = (Jzon::Object&) r6.Get(keys[k]);
-    if  ( l == 7 ) return r7;
-
-    return object;
-}
-
-// ExifData::const_iterator i
-template <class T>
-void push(Jzon::Object& json,const std::string& key,T i)
-{
-    std::string value = i->value().toString();
-
-    switch ( i->typeId() ) {
-        case Exiv2::xmpText:
-        case Exiv2::asciiString : 
-        case Exiv2::string:
-        case Exiv2::comment:
-             json.Add(key,value);
-        break;
-
-        case Exiv2::unsignedByte:
-        case Exiv2::unsignedShort:
-        case Exiv2::unsignedLong:
-        case Exiv2::signedByte:
-        case Exiv2::signedShort:
-        case Exiv2::signedLong:
-             json.Add(key,(int)i->value().toLong());
-        break;
-        
-        case Exiv2::tiffFloat:
-        case Exiv2::tiffDouble:
-             json.Add(key,i->value().toFloat());
-        break;
-
-        case Exiv2::unsignedRational:
-        case Exiv2::signedRational: {
-             Jzon::Array arr;
-             Rational rat = i->value().toRational();
-             arr.Add (rat.first );
-             arr.Add (rat.second);
-             json.Add(key,arr);
-        } break;
-
-        case Exiv2::date:
-        case Exiv2::time:
-             json.Add(key,i->value().toString());
-        break;
-
-        default:
-        case Exiv2::undefined:
-        case Exiv2::tiffIfd:
-        case Exiv2::directory:
-        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('

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list