krita

kis_exif_info.cc

00001 /*
00002  * This file is part of Krita
00003  *
00004  *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 #include "kis_exif_info.h"
00021 
00022 #include <stdlib.h>
00023 
00024 #include <kdebug.h>
00025 
00026 KisExifInfo::KisExifInfo()
00027 {}
00028 
00029 
00030 KisExifInfo::~KisExifInfo()
00031 {}
00032 
00033 
00034 bool KisExifInfo::load(const QDomElement& elmt)
00035 {
00036     if(elmt.tagName() != "ExifInfo")
00037         return false;
00038     for( QDomNode node = elmt.firstChild(); !node.isNull(); node = node.nextSibling() )
00039     {
00040         QDomElement e = node.toElement();
00041         if ( !e.isNull() )
00042         {
00043             if(e.tagName() == "ExifValue")
00044             {
00045                 QString key = e.attribute("name");
00046                 ExifValue eV;
00047                 eV.load(e);
00048                 setValue(key, eV);
00049             }
00050         }
00051     }
00052     return true;
00053 }
00054 
00055 QDomElement KisExifInfo::save(QDomDocument& doc)
00056 {
00057     QDomElement elmt = doc.createElement("ExifInfo");
00058     for( KisExifInfo::evMap::const_iterator it = begin(); it != end(); ++it)
00059     {
00060         ExifValue ev = it.data();
00061         QDomElement evD = ev.save( doc);
00062         evD.setAttribute("name", it.key());
00063         elmt.appendChild(evD);
00064     }
00065     return elmt;
00066 }
KDE Home | KDE Accessibility Home | Description of Access Keys