[go: up one dir, main page]

File: kexififd.cpp

package info (click to toggle)
libkexif 0.2.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,020 kB
  • ctags: 209
  • sloc: sh: 9,906; perl: 2,760; cpp: 1,157; makefile: 151
file content (114 lines) | stat: -rw-r--r-- 2,694 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//////////////////////////////////////////////////////////////////////////////
//
//    KEXIFUTILS.CPP
//
//    Copyright (C) 2002-2004 Renchi Raju <renchi at pooh.tam.uiuc.edu>
//                            Gilles CAULIER <caulier dot gilles at free.fr>
//                            Ralf Hoelzer <kde at ralfhoelzer.com>
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin Steet, Fifth Floor, Cambridge, MA 02110-1301, USA.
//
//////////////////////////////////////////////////////////////////////////////

extern "C" {
#include <libexif/exif-content.h>
}

#include "kexifentry.h"
#include "kexififd.h"

KExifIfd::KExifIfd()
{
    mName = "";
    mEntryList.setAutoDelete(true);
    mExifContent = 0;
}

KExifIfd::KExifIfd(const QString& name, ExifContent* content)
{
    mName = name;
    mEntryList.setAutoDelete(true);
    mExifContent = 0;

    setContent(content);
}

KExifIfd::~KExifIfd()
{
    mEntryList.clear();

    if (mExifContent)
        exif_content_unref(mExifContent);
}

KExifIfd::KExifIfd(const KExifIfd& ifd)
{
    if (this != &ifd) {
        mName = ifd.mName;
        mEntryList.setAutoDelete(true);
        setContent(ifd.mExifContent);
    }
}

KExifIfd& KExifIfd::operator=(const KExifIfd& ifd)
{
    if (this != &ifd) {
        mName = ifd.mName;
        mEntryList.setAutoDelete(true);
        setContent(ifd.mExifContent);
    }
    return (*this);
}


void KExifIfd::setName(const QString& name)
{
    mName = name;
}

void KExifIfd::setContent(ExifContent* content)
{
    if (!content) return;

    if (mExifContent) {
        exif_content_unref(mExifContent);
        mExifContent = 0;
    }

    mExifContent = content;
    exif_content_ref(mExifContent);
    mEntryList.clear();

    for (unsigned int i=0; i<content->count; i++) {
        mEntryList.append(new KExifEntry(content->entries[i]));
    }

}

int KExifIfd::numberEntries()
{
    return mEntryList.count();
}


QPtrList<KExifEntry> KExifIfd::entryList() const
{
    return mEntryList;
}

QString KExifIfd::getName() const
{
    return mName;
}