All pastes #911588 Raw Edit

Something

public cpp v1 · immutable
·published 2008-02-20 20:23 UTC
rendered paste body
StringSet Info::standardKeys(){    static StringSet res;    if ( !res.empty() )        return res;    QList<const Exiv2::TagInfo*> tags;    tags <<        Exiv2::ExifTags::ifdTagList() <<        Exiv2::ExifTags::exifTagList() <<        Exiv2::ExifTags::iopTagList() <<        Exiv2::ExifTags::gpsTagList();    for (QList<const Exiv2::TagInfo*>::iterator it = tags.begin(); it != tags.end(); ++it ) {        while ( (*it)->tag_ != 0xffff ) {            res.insert( Exiv2::ExifKey( (*it)->tag_, Exiv2::ExifTags::ifdItem( (*it)->ifdId_ ) ).key().c_str() );            ++(*it);        }    }    // Now the ugly part -- exiv2 doesn't have any way to get a list of    // MakerNote tags in a reasonable form, so we have to parse it from strings        std::ostringstream s;    for ( Exiv2::IfdId kind = Exiv2::canonIfdId; kind < Exiv2::lastIfdId;            kind = static_cast<Exiv2::IfdId>( kind + 1 ) ) {        Exiv2::ExifTags::makerTaglist( s, kind );    }    QStringList lines = QString( s.str().c_str() ).split( '\n' );    for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) {        if ( it->isEmpty() )            continue;        QStringList fields = it->split( '\t' );        if ( fields.size() != 7 ) {            kDebug() << "Unparsable output from exiv2 library: " << *it;            continue;        }        QString id = fields[4];        if ( id.endsWith( ',' ) )            id.chop(1);        res.insert( id );    }    return res;}