 |
Exiv2
|
Go to the documentation of this file.
31 #include "exiv2lib_export.h"
34 #include "metadatum.hpp"
90 Exifdatum& operator=(
const uint16_t& value);
95 Exifdatum& operator=(
const uint32_t& value);
105 Exifdatum& operator=(
const int16_t& value);
110 Exifdatum& operator=(
const int32_t& value);
120 Exifdatum& operator=(
const std::string& value);
134 int setValue(
const std::string& value);
148 int setDataArea(
const byte* buf,
long len);
153 std::string key()
const;
155 const char* familyName()
const;
157 std::string tagName()
const;
158 std::string tagLabel()
const;
159 uint16_t tag()
const;
177 long copy(
byte* buf,
ByteOrder byteOrder)
const;
178 std::ostream& write(std::ostream& os,
const ExifData* pMetadata =0)
const;
182 const char* typeName()
const;
184 long typeSize()
const;
192 long toLong(
long n =0)
const;
193 float toFloat(
long n =0)
const;
194 Rational toRational(
long n =0)
const;
196 const Value& value()
const;
198 long sizeDataArea()
const;
257 long writeFile(
const std::string& path)
const;
258 #ifdef EXV_UNICODE_PATH
263 long writeFile(
const std::wstring& wpath)
const;
269 const char* mimeType()
const;
274 const char* extension()
const;
275 #ifdef EXV_UNICODE_PATH
280 const wchar_t* wextension()
const;
328 void setJpegThumbnail(
329 const std::string& path,
334 #ifdef EXV_UNICODE_PATH
340 void setJpegThumbnail(
341 const std::wstring& wpath,
364 void setJpegThumbnail(
384 void setJpegThumbnail(
const std::string& path);
385 #ifdef EXV_UNICODE_PATH
391 void setJpegThumbnail(
const std::wstring& wpath);
405 void setJpegThumbnail(
const byte* buf,
long size);
451 Exifdatum& operator[](
const std::string& key);
497 iterator findKey(
const ExifKey& key);
502 const_iterator begin()
const {
return exifMetadata_.begin(); }
510 const_iterator findKey(
const ExifKey& key)
const;
512 bool empty()
const {
return count() == 0; }
514 long count()
const {
return static_cast<long>(exifMetadata_.size()); }
620 encode(blob, 0, 0, byteOrder, exifData);
627 #endif // #ifndef EXIF_HPP_
Provides binary IO on blocks of memory by implementing the BasicIo interface. A copy-on-write impleme...
Definition: basicio.hpp:540
void clear()
Delete all Exifdatum instances resulting in an empty container. Note that this also removes thumbnail...
Definition: exif.cpp:611
DataBuf copy() const
Return the thumbnail image in a DataBuf. The caller owns the data buffer and DataBuf ensures that it ...
Definition: exif.cpp:454
const char * typeName() const
Return the name of the type.
Definition: exif.cpp:389
byte * pData_
Pointer to the buffer, 0 if none has been allocated.
Definition: types.hpp:258
Exifdatum & operator=(const Exifdatum &rhs)
Assignment operator.
Definition: exif.cpp:258
Access to a Exif thumbnail image. This class provides higher level accessors to the thumbnail image t...
Definition: exif.hpp:232
ExifThumb(ExifData &exifData)
Constructor.
Definition: exif.cpp:506
long typeSize() const
Return the size in bytes of one component of this type.
Definition: exif.cpp:394
std::string toString() const
Return the value as a string.
Definition: exif.cpp:409
Encoding and decoding of Exif data.
const_iterator end() const
End of the metadata.
Definition: exif.hpp:505
iterator findKey(const ExifKey &key)
Find the first Exifdatum with the given key, return an iterator to it.
Definition: exif.cpp:605
Common interface for all types of values used with metadata.
Definition: value.hpp:51
void add(const ExifKey &key, const Value *pValue)
Add an Exifdatum from the supplied key and value pair. This method copies (clones) key and value....
Definition: exif.cpp:588
float toFloat(long n=0) const
Return the n-th component of the value converted to float. The return value is -1 if the value is not...
Definition: exif.cpp:424
Exifdatum(const ExifKey &key, const Value *pValue=0)
Constructor for new tags created by an application. The Exifdatum is created from a key / value pair....
Definition: exif.cpp:202
int idx() const
Return the index (unique id of this key within the original IFD)
Definition: exif.cpp:374
An Exif metadatum, consisting of an ExifKey and a Value and methods to manipulate these.
Definition: exif.hpp:59
TypeId typeId() const
Return the type id of the value.
Definition: exif.cpp:384
IfdId
Type to specify the IFD to which a metadata belongs.
Definition: tags_int.hpp:46
iterator begin()
Begin of the metadata.
Definition: exif.hpp:490
ExifMetadata::const_iterator const_iterator
ExifMetadata const iterator type.
Definition: exif.hpp:439
bool empty() const
Return true if there is no IPTC metadata.
Definition: iptc.hpp:255
std::ostream & write(std::ostream &os, const ExifData *pMetadata=0) const
Write the interpreted value to an output stream, return the stream.
Definition: exif.cpp:219
std::string tagLabel() const
Return a label for the tag.
Definition: exif.cpp:354
void sortByKey()
Sort metadata by key.
Definition: exif.cpp:616
std::string tagName() const
Return the name of the tag (which is also the third part of the key)
Definition: exif.cpp:349
iterator erase(iterator pos)
Delete the Exifdatum at iterator position pos, return the position of the next exifdatum....
Definition: exif.cpp:631
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:139
static AutoPtr create(TypeId typeId)
A (simple) factory to create a Value type.
Definition: value.cpp:93
long sizeDataArea() const
Return the size of the data area.
Definition: exif.cpp:439
EXIV2API long writeFile(const DataBuf &buf, const std::string &path)
Write DataBuf buf to file path.
Definition: basicio.cpp:2703
std::string groupName() const
Return the name of the metadata group (which is also the second part of the key)
Definition: exif.cpp:344
Unary predicate that matches an Exifdatum with a given IfdId.
Definition: tiffimage_int.hpp:469
int setDataArea(const byte *buf, long len)
Set the data area by copying (cloning) the buffer pointed to by buf.
Definition: exif.cpp:329
static ByteOrder decode(ExifData &exifData, IptcData &iptcData, XmpData &xmpData, const byte *pData, uint32_t size)
Decode metadata from a buffer pData of length size with data in TIFF format to the provided metadata ...
Definition: tiffimage.cpp:248
int ifdId() const
Return the IFD id as an integer. (Do not use, this is meant for library internal use....
Definition: exif.cpp:364
iterator end()
End of the metadata.
Definition: exif.hpp:492
EXIV2API DataBuf readFile(const std::string &path)
Read file path into a DataBuf, which is returned.
Definition: basicio.cpp:2665
static EncoderFct findEncoder(const std::string &make, uint32_t extendedTag, IfdId group)
Find special encoder function for a key.
Definition: tiffimage_int.cpp:1654
const char * groupName(IfdId ifdId)
Return the group name for a group id.
Definition: tags_int.cpp:2540
void setJpegThumbnail(const std::string &path, URational xres, URational yres, uint16_t unit)
Set the Exif thumbnail to the JPEG image path. Set XResolution, YResolution and ResolutionUnit to xre...
Definition: exif.cpp:511
static WriteMethod encode(Blob &blob, const byte *pData, uint32_t size, ByteOrder byteOrder, const ExifData &exifData)
Encode Exif metadata from the provided metadata to binary Exif format.
Definition: exif.cpp:668
void sortByTag()
Sort metadata by tag.
Definition: exif.cpp:621
AutoPtr clone() const
Return an auto-pointer to a copy of itself (deep copy). The caller owns this copy and the auto-pointe...
Definition: value.hpp:110
long count() const
Return the number of components in the value.
Definition: exif.cpp:399
std::ostream &(* PrintFct)(std::ostream &, const Value &, const ExifData *pExifData)
Type for a function pointer for functions interpreting the tag value.
Definition: tags.hpp:49
long copy(byte *buf, ByteOrder byteOrder) const
Write value to a data buffer and return the number of bytes written.
Definition: exif.cpp:379
const char * extension() const
Return the file extension for the format of the thumbnail (".tif" or ".jpg").
Definition: exif.cpp:490
const Value & value() const
Return a constant reference to the value.
Definition: exif.cpp:252
@ invalidTypeId
Invalid type id.
Definition: types.hpp:146
TypeId typeId_
Type id.
Definition: tags.hpp:93
EXIV2API void append(Exiv2::Blob &blob, const byte *buf, uint32_t len)
Append len bytes pointed to by buf to blob.
Definition: image.cpp:1013
friend Exifdatum & setValue(Exifdatum &, const T &)
Set the value of exifDatum to value. If the object already has a value, it is replaced....
Definition: exif.cpp:193
long toLong(long n=0) const
Return the n-th component of the value converted to long. The return value is -1 if the value is not ...
Definition: exif.cpp:419
static void encode(Blob &blob, ByteOrder byteOrder, const ExifData &exifData)
Encode metadata from the provided metadata to Exif format.
Definition: exif.hpp:614
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
std::ostream & printValue(std::ostream &os, const Value &value, const ExifData *)
Default print function, using the Value output operator.
Definition: tags_int.cpp:2547
Concrete keys for Exif metadata and access to Exif tag reference data.
Definition: tags.hpp:140
std::string toString() const
Return the value as a string. Implemented in terms of write(std::ostream& os) const of the concrete c...
Definition: value.cpp:168
long size_
The current size of the buffer.
Definition: types.hpp:260
EXIV2API bool cmpMetadataByKey(const Metadatum &lhs, const Metadatum &rhs)
Compare two metadata by key. Return true if the key of metadatum lhs is less than that of rhs.
Definition: metadatum.cpp:77
const char * ifdName(IfdId ifdId)
Return the name of the IFD.
Definition: tags_int.cpp:2533
std::auto_ptr< ExifKey > AutoPtr
Shortcut for an ExifKey auto pointer.
Definition: tags.hpp:143
const char * familyName() const
Return the name of the metadata family (which is also the first part of the key)
Definition: exif.cpp:339
long count() const
Get the number of metadata entries.
Definition: exif.hpp:514
virtual ~Exifdatum()
Destructor.
Definition: exif.cpp:208
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
virtual std::string key() const
Return the key of the metadatum as a string. The key is of the form 'familyName.groupName....
Definition: tags.cpp:367
A container for XMP data. This is a top-level class of the Exiv2 library.
Definition: xmp_exiv2.hpp:166
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition: types.hpp:99
bool empty() const
Return true if there is no XMP metadata.
Definition: xmp.cpp:528
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:119
long size() const
Return the size of the value in bytes.
Definition: exif.cpp:404
std::string key() const
Return the key of the Exifdatum.
Definition: exif.cpp:334
T getValue(const byte *buf, ByteOrder byteOrder)
Read a value of type T from the data buffer.
Definition: value.hpp:1363
long writeFile(const std::string &path) const
Write the thumbnail image to a file.
Definition: exif.cpp:461
static ByteOrder decode(ExifData &exifData, const byte *pData, uint32_t size)
Decode metadata from a buffer pData of length size with binary Exif data to the provided metadata con...
Definition: exif.cpp:636
static const char * typeName(TypeId typeId)
Return the name of the type, 0 if unknown.
Definition: types.cpp:102
static WriteMethod encode(BasicIo &io, const byte *pData, uint32_t size, ByteOrder byteOrder, const ExifData &exifData, const IptcData &iptcData, const XmpData &xmpData)
Encode metadata from the provided metadata to TIFF format.
Definition: tiffimage.cpp:275
Tag information.
Definition: tags.hpp:74
#define EXV_WARNING
Shorthand for a temp warning log message object and return its ostringstream.
Definition: error.hpp:148
static WriteMethod encode(BasicIo &io, const byte *pData, uint32_t size, const ExifData &exifData, const IptcData &iptcData, const XmpData &xmpData, uint32_t root, FindEncoderFct findEncoderFct, TiffHeaderBase *pHeader, OffsetWriter *pOffsetWriter)
Encode TIFF metadata from the metadata containers into a memory block blob.
Definition: tiffimage_int.cpp:1747
const char * mimeType() const
Return the MIME type of the thumbnail, either "image/tiff" or "image/jpeg".
Definition: exif.cpp:483
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:102
bool empty() const
Return true if there is no Exif metadata.
Definition: exif.hpp:512
const char * ifdName() const
Return the name of the IFD.
Definition: exif.cpp:369
EXIV2API bool cmpMetadataByTag(const Metadatum &lhs, const Metadatum &rhs)
Compare two metadata by tag. Return true if the tag of metadatum lhs is less than that of rhs.
Definition: metadatum.cpp:71
void erase()
Delete the thumbnail from the Exif data. Removes all Exif.Thumbnail.*, i.e., Exif IFD1 tags.
Definition: exif.cpp:572
uint16_t tag() const
Return the tag.
Definition: exif.cpp:359
PrintFct printFct_
Pointer to tag print function.
Definition: tags.hpp:95
const TagInfo * tagInfo(uint16_t tag, IfdId ifdId)
Return the tag info for tag and ifdId.
Definition: tags_int.cpp:2500
std::pair< uint32_t, uint32_t > URational
8 byte unsigned rational type.
Definition: types.hpp:97
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:324
virtual byte * mmap(bool=false)
Allow direct access to the underlying data buffer. The buffer is not protected against write access i...
Definition: basicio.cpp:1338
Exifdatum & operator[](const std::string &key)
Returns a reference to the Exifdatum that is associated with a particular key. If ExifData does not a...
Definition: exif.cpp:577
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:170
ExifThumbC(const ExifData &exifData)
Constructor.
Definition: exif.cpp:449
Exiv2::Exifdatum & setValue(Exiv2::Exifdatum &exifDatum, const T &value)
Set the value of exifDatum to value. If the object already has a value, it is replaced....
Definition: exif.cpp:193
virtual size_t size() const
Get the current memory buffer size in bytes.
Definition: basicio.cpp:1353
std::string toString(const T &arg)
Utility function to convert the argument of any type to a string.
Definition: types.hpp:510
ExifMetadata::iterator iterator
ExifMetadata iterator type.
Definition: exif.hpp:437
Template for a Value of a basic type. This is used for unsigned and signed short, long and rationals.
Definition: value.hpp:1235
DataBuf dataArea() const
Return a copy of the data area of the value. The caller owns this copy and DataBuf ensures that it wi...
Definition: exif.cpp:444
WriteMethod
Type to indicate write method used by TIFF parsers.
Definition: types.hpp:105
Stateless parser class for Exif data. Images use this class to decode and encode binary Exif data.
Definition: exif.hpp:529
IfdId groupId(const std::string &groupName)
Return the group id for a group name.
Definition: tags_int.cpp:2525
Access and modify an Exif thumbnail image. This class implements manipulators to set and erase the th...
Definition: exif.hpp:301
std::list< Exifdatum > ExifMetadata
Container type to hold all metadata.
Definition: exif.hpp:420
static long typeSize(TypeId typeId)
Return the size in bytes of one element of this type.
Definition: types.cpp:116
std::auto_ptr< Value > AutoPtr
Shortcut for a Value auto pointer.
Definition: value.hpp:54
virtual DataBuf read(long rcount)
Read data from the memory block. Reading starts at the current IO position and the position is advanc...
Definition: basicio.cpp:1375
Error class for exceptions, log message class.
std::vector< byte > Blob
Container for binary data.
Definition: types.hpp:151
Rational toRational(long n=0) const
Return the n-th component of the value converted to Rational. The return value is -1/1 if the value i...
Definition: exif.cpp:429
A container for Exif data. This is a top-level class of the Exiv2 library. The container holds Exifda...
Definition: exif.hpp:434
Value::AutoPtr getValue() const
Return an auto-pointer to a copy (clone) of the value. The caller owns this copy and the auto-poiner ...
Definition: exif.cpp:434