Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
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