Public Types | Public Member Functions | Static Public Member Functions

QuillMetadata Class Reference

#include <quillmetadata.h>

Collaboration diagram for QuillMetadata:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Tag {
  Tag_Make, Tag_Model, Tag_ImageWidth, Tag_ImageHeight,
  Tag_FocalLength, Tag_ExposureTime, Tag_TimestampOriginal, Tag_Title,
  Tag_Copyright, Tag_Creator, Tag_Keywords, Tag_Subject,
  Tag_City, Tag_Country, Tag_Location, Tag_Rating,
  Tag_Timestamp, Tag_Orientation, Tag_Description, Tag_GPSLatitude,
  Tag_GPSLatitudeRef, Tag_GPSLongitude, Tag_GPSLongitudeRef, Tag_GPSAltitude,
  Tag_GPSAltitudeRef, Tag_GPSVersionID, Tag_GPSImgDirection, Tag_GPSImgDirectionRef,
  Tag_Undefined
}
enum  TagGroup { TagGroup_All = 0, TagGroup_GPS }
enum  MetadataFormatFlags { ExifFormat = 0x1, XmpFormat = 0x2, AllFormats = ~1 }

Public Member Functions

 QuillMetadata ()
 QuillMetadata (const QString &fileName, MetadataFormatFlags formats=AllFormats)
 QuillMetadata (const QString &fileName, MetadataFormatFlags formats, Tag tagToRead)
 ~QuillMetadata ()
bool isValid () const
QVariant entry (Tag tag) const
void setEntry (Tag tag, const QVariant &entry)
void removeEntry (Tag tag)
void removeEntries (const QList< Tag > &tags)
void removeEntries (TagGroup tagGroup)
bool write (const QString &filePath, MetadataFormatFlags formats=AllFormats) const
QByteArray dump (MetadataFormatFlags formats) const

Static Public Member Functions

static bool canRead (const QString &filePath)

Member Enumeration Documentation

These flags can be used to limit working to a given metadata format.

Enumerator:
ExifFormat 

Operate on EXIF only.

XmpFormat 

Operate on XMP only.

AllFormats 

Operate on all formats.

Enumerator:
Tag_Make 

Camera make, string (EXIF).

Tag_Model 

Camera model, string (EXIF).

Tag_ImageWidth 

Image width, int (EXIF, deprecated).

Tag_ImageHeight 

Image height, int (EXIF, deprecated).

Tag_FocalLength 

Camera focal length, float (EXIF).

Tag_ExposureTime 

Exposure time used, float (EXIF).

Tag_TimestampOriginal 

Time when picture was taken, string (EXIF).

Tag_Title 

Image title, string (XMP/DC).

Tag_Copyright 

Not supported.

Tag_Creator 

Creator of original image, string (XMP/DC).

Tag_Keywords 

Not supported, see Subject.

Tag_Subject 

Subject, keywords or tags, string list (XMP/DC).

Tag_City 

City represented, string (XMP/IPTC or Photoshop).

Tag_Country 

Country represented, string (XMP/IPTC or Photoshop).

Tag_Location 

Precise location (landmark or address), string (XMP/IPTC).

Tag_Rating 

Rating in stars (0-5), float (XMP/XAP).

Tag_Timestamp 

Time of last modification, string (XMP/XAP).

Tag_Orientation 

Image orientation, short (EXIF).

Tag_Description 

Description, string (XMP/DC).

Tag_GPSLatitude 

GPS latitude, string (XMP/EXIF).

Tag_GPSLatitudeRef 

GPS latitude is north or south (EXIF).

Tag_GPSLongitude 

GPS longitude, string (XMP/EXIF).

Tag_GPSLongitudeRef 

GPS longitude is east or west (EXIF).

Tag_GPSAltitude 

GPS altitude, string (XMP/EXIF).

Tag_GPSAltitudeRef 

GPS altitude above or below sea level, string (XMP/EXIF).

Tag_GPSVersionID 

GPS version ID, string (XMP/EXIF).

Tag_GPSImgDirection 

GPS image direction of the image when captured (EXIF).

Tag_GPSImgDirectionRef 

GPS image direction reference (EXIF).

Tag_Undefined 

Undefined tag.

Enumerator:
TagGroup_All 

All defined tags.

TagGroup_GPS 

GPS tags.


Constructor & Destructor Documentation

QuillMetadata::QuillMetadata (  ) 

Constructs an empty metadata object.

QuillMetadata::QuillMetadata ( const QString &  fileName,
MetadataFormatFlags  formats = AllFormats 
)

Constructs a metadata object containing all metadata from a given file.

Parameters:
filePath Local filesystem path to file to be read.
formats Which formats to read (currently only supports ExifFormat and AllFormats)
QuillMetadata::QuillMetadata ( const QString &  fileName,
MetadataFormatFlags  formats,
Tag  tagToRead 
) [explicit]

Constructs a metadata object containing all metadata from a given file.

Parameters:
filePath Local filesystem path to file to be read.
formats Which formats to read (currently only supports ExifFormat and AllFormats)
tagToRead Which tags to read; if undefined, reads all tags
QuillMetadata::~QuillMetadata (  ) 

Removes a metadata object.


Member Function Documentation

bool QuillMetadata::canRead ( const QString &  filePath  )  [static]

Returns true if the image format of a given file is supported by the metadata reader. It will only make a lightweight check of the file headers, and it will not guarantee that any metadata can be actually be read from the file.

QByteArray QuillMetadata::dump ( MetadataFormatFlags  formats  )  const

Dumps an EXIF or XMP block into a byte array.

Parameters:
formats Which metadata block to dump. Currently only supports ExifFormat, other format flags will return an empty byte array.
QVariant QuillMetadata::entry ( Tag  tag  )  const

Returns the value of the metadata entry for a given tag. Currently, only some tags are supported.

bool QuillMetadata::isValid (  )  const

Returns true if the metadata object is valid.

void QuillMetadata::removeEntries ( TagGroup  tagGroup  ) 

Removes a preset group of entries. Currently, instead of removing, overwrites the entry with an empty content.

void QuillMetadata::removeEntries ( const QList< Tag > &  tags  ) 

Removes a list of entries. Currently, instead of removing, overwrites the entry with an empty content.

void QuillMetadata::removeEntry ( Tag  tag  ) 

Removes an entry for a given tag. Currently, instead of removing, overwrites the entry with an empty content.

void QuillMetadata::setEntry ( Tag  tag,
const QVariant &  entry 
)

Sets the value of the metadata entry for a given tag. Use invalid QVariant to clear the entry. Currently, only some tags are supported.

bool QuillMetadata::write ( const QString &  filePath,
MetadataFormatFlags  formats = AllFormats 
) const

Writes the metadata object into an existing file, writes both XMP, IPTC-IIM (transparently by exempi) and EXIF blocks. Any existing metadata in the file will be lost by this overwrite.

Parameters:
filePath Local filesystem path to file to be written into.
formats Which metadata formats to write. If AllFormats is selected, both Exif and XMP metadata will be written. If ExifFormat is selected, it will destroy any existing XMP block in the file. If XmpFormat is selected, it should not affect existing Exif blocks in the file except those affected by automated reconciliation. XmpFormat and AllFormats also include IPTC-IIM reconciliation.

The documentation for this class was generated from the following files: