MauiKit Image Tools

exiv2extractor.h
1// SPDX-License-Identifier: LGPL-3.0-or-later
2
3/*
4 Copyright (C) 2012-15 Vishesh Handa <vhanda@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library 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 GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19*/
20
21#pragma once
22
23#include <exiv2/exiv2.hpp>
24
25#include <QString>
26#include <QVariant>
27#include <QUrl>
28
29#include "imagetools_export.h"
30
32typedef QPair<double, double> Coordinates;
33
34class City;
35
36/**
37 * @brief Image metadata extractor.
38 */
39class IMAGETOOLS_EXPORT Exiv2Extractor : public QObject
40{
41public:
42 Exiv2Extractor(const QUrl &url, QObject * parent = nullptr);
43 explicit Exiv2Extractor(QObject * parent = nullptr);
44
45 void setUrl(const QUrl &url);
46
47 Coordinates extractGPS() const;
48
49 bool error() const;
50
51 QString getExifTagString (const char *exifTagName, bool escapeCR=true) const;
52 QByteArray getExifTagData (const char *exifTagName) const;
53 QVariant getExifTagVariant (const char *exifTagName, bool rationalAsListOfInts=true, bool escapeCR=true, int component=0) const;
54 MetaDataMap getExifTagsDataList( const QStringList & exifKeysFilter = QStringList(), bool invertSelection = false ) const;
55 QString getExifComment() const;
56
57 bool writeTag(const char *tagName, const QVariant &value);
58 bool removeTag(const char *tagName);
59
60 QString GPSString() const;
61 QString cityId() const;
62 City city() const;
63
64private:
65 double fetchGpsDouble(const char *name) const;
66
67 bool m_error;
68
69 QUrl m_url;
70
71 #if EXIV2_TEST_VERSION(0, 27, 99)
72 Exiv2::Image::UniquePtr m_image;
73 #else
74 Exiv2::Image::AutoPtr m_image;
75 #endif
76
77 Exiv2::ExifData & exifData() const;
78};
A class for representing the GPS coordinates and information of a city.
Image metadata extractor.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.