chalk

kis_exif_info.cpp
1/*
2 * This file is part of Chalk
3 *
4 * Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20#include "kis_exif_info.h"
21
22#include <stdlib.h>
23
24#include <kdebug.h>
25
26KisExifInfo::KisExifInfo()
27{}
28
29
30KisExifInfo::~KisExifInfo()
31{}
32
33
34bool KisExifInfo::load(const TQDomElement& elmt)
35{
36 if(elmt.tagName() != "ExifInfo")
37 return false;
38 for( TQDomNode node = elmt.firstChild(); !node.isNull(); node = node.nextSibling() )
39 {
40 TQDomElement e = node.toElement();
41 if ( !e.isNull() )
42 {
43 if(e.tagName() == "ExifValue")
44 {
45 TQString key = e.attribute("name");
46 ExifValue eV;
47 eV.load(e);
48 setValue(key, eV);
49 }
50 }
51 }
52 return true;
53}
54
55TQDomElement KisExifInfo::save(TQDomDocument& doc)
56{
57 TQDomElement elmt = doc.createElement("ExifInfo");
58 for( KisExifInfo::evMap::const_iterator it = begin(); it != end(); ++it)
59 {
60 ExifValue ev = it.data();
61 TQDomElement evD = ev.save( doc);
62 evD.setAttribute("name", it.key());
63 elmt.appendChild(evD);
64 }
65 return elmt;
66}