• Main Page
  • Classes
  • Files
  • File List
  • File Members

exif.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
00004 ** Contact: Alexander Bokovoy <alexander.bokovoy@nokia.com>
00005 **
00006 ** This file is part of the Quill package.
00007 **
00008 ** Commercial Usage
00009 ** Licensees holding valid Qt Commercial licenses may use this file in
00010 ** accordance with the Qt Commercial License Agreement provided with the
00011 ** Software or, alternatively, in accordance with the terms contained in
00012 ** a written agreement between you and Nokia.
00013 **
00014 ** GNU Lesser General Public License Usage
00015 ** Alternatively, this file may be used under the terms of the GNU Lesser
00016 ** General Public License version 2.1 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.LGPL included in the
00018 ** packaging of this file.  Please review the following information to
00019 ** ensure the GNU Lesser General Public License version 2.1 requirements
00020 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00021 **
00022 ** In addition, as a special exception, Nokia gives you certain
00023 ** additional rights. These rights are described in the Nokia Qt LGPL
00024 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
00025 ** package.
00026 **
00027 ** GNU General Public License Usage
00028 ** Alternatively, this file may be used under the terms of the GNU
00029 ** General Public License version 3.0 as published by the Free Software
00030 ** Foundation and appearing in the file LICENSE.GPL included in the
00031 ** packaging of this file.  Please review the following information to
00032 ** ensure the GNU General Public License version 3.0 requirements will be
00033 ** met: http://www.gnu.org/copyleft/gpl.html.
00034 **
00035 ** If you are unsure which license is appropriate for your use, please
00036 ** contact the sales department at qt-sales@nokia.com.
00037 **
00038 ****************************************************************************/
00039 
00040 #ifndef EXIF_H
00041 #define EXIF_H
00042 
00043 #include <libexif/exif-data.h>
00044 #include <QString>
00045 #include <QHash>
00046 
00047 #include "metadatarepresentation.h"
00048 
00049 class ExifTypedTag {
00050 public:
00051     ExifTypedTag();
00052     ExifTypedTag(ExifTag tag, ExifIfd ifd, ExifFormat format);
00053     ExifTypedTag(ExifTag tag, ExifIfd ifd, ExifFormat format, int count);
00054 
00055     ExifTag tag;
00056     ExifIfd ifd;
00057     ExifFormat format;
00058     int count;
00059 };
00060 
00061 class Exif : public MetadataRepresentation
00062 {
00063  public:
00064     Exif();
00065     Exif(const QString &fileName,
00066          QuillMetadata::Tag tagToRead = QuillMetadata::Tag_Undefined);
00067     ~Exif();
00068 
00069     bool isValid() const;
00070 
00071     bool supportsEntry(QuillMetadata::Tag tag) const;
00072     bool hasEntry(QuillMetadata::Tag tag) const;
00073     QVariant entry(QuillMetadata::Tag tag) const;
00074     void setEntry(QuillMetadata::Tag tag, const QVariant &entry);
00075     void removeEntry(QuillMetadata::Tag tag);
00076     void removeEntries(QuillMetadata::TagGroup tagGroup);
00077 
00078     bool write(const QString &fileName) const;
00079     QByteArray dump() const;
00080 
00081  private:
00082     void initTags();
00083 
00084     void setExifEntry(ExifData *data, ExifTypedTag tag, const QVariant &value);
00085 
00086     void updateReferenceTag(ExifTag tag, bool positive);
00087 
00088     bool readShortTagAndByteOrder(const QuillMetadata::Tag tagToRead,
00089                                   const unsigned char *buf, const unsigned int bufSize,
00090                                   short &_tagValue, ExifByteOrder &_byteOrder);
00091 
00092  private:
00093     static QHash<QuillMetadata::Tag,ExifTypedTag> m_exifTags;
00094 
00095     ExifData *m_exifData;
00096     ExifByteOrder m_exifByteOrder;
00097 
00098     static bool m_initialized;
00099 };
00100 
00101 #endif

Generated on Tue Apr 12 2011 17:07:42 for quillmetadatalib by  doxygen 1.7.1