 |
Exiv2
|
Go to the documentation of this file.
33 #include "exiv2lib_export.h"
83 virtual int read(
const byte* buf,
long len,
ByteOrder byteOrder) =0;
107 virtual int setDataArea(
const byte* buf,
long len);
112 TypeId typeId()
const {
return type_; }
130 virtual long copy(
byte* buf,
ByteOrder byteOrder)
const =0;
132 virtual long count()
const =0;
134 virtual long size()
const =0;
141 virtual std::ostream& write(std::ostream& os)
const =0;
161 virtual long toLong(
long n =0)
const =0;
169 virtual float toFloat(
long n =0)
const =0;
177 virtual Rational toRational(
long n =0)
const =0;
179 virtual long sizeDataArea()
const;
192 virtual DataBuf dataArea()
const;
197 bool ok()
const {
return ok_; }
236 static AutoPtr create(
TypeId typeId);
249 virtual Value* clone_()
const =0;
258 return value.
write(os);
270 long len,
ByteOrder byteOrder =invalidByteOrder,
289 virtual int read(
const byte* buf,
312 virtual long copy(
byte* buf,
ByteOrder byteOrder =invalidByteOrder)
const;
313 virtual long count()
const;
314 virtual long size()
const;
315 virtual std::ostream& write(std::ostream& os)
const;
322 virtual long toLong(
long n =0)
const;
323 virtual float toFloat(
long n =0)
const;
324 virtual Rational toRational(
long n =0)
const;
347 typedef std::auto_ptr<StringValueBase>
AutoPtr;
377 virtual int read(
const byte* buf,
398 virtual long copy(
byte* buf,
ByteOrder byteOrder =invalidByteOrder)
const;
399 virtual long count()
const;
400 virtual long size()
const;
401 virtual long toLong(
long n =0)
const;
402 virtual float toFloat(
long n =0)
const;
403 virtual Rational toRational(
long n =0)
const;
404 virtual std::ostream& write(std::ostream& os)
const;
492 virtual std::ostream& write(std::ostream& os)
const;
513 invalidCharsetId, lastCharsetId };
536 static const char* name(
CharsetId charsetId);
538 static const char* code(
CharsetId charsetId);
579 int read(
const byte* buf,
long len,
ByteOrder byteOrder);
585 long copy(
byte* buf,
ByteOrder byteOrder)
const;
590 std::ostream& write(std::ostream& os)
const;
617 CharsetId charsetId()
const;
650 XmpArrayType xmpArrayType()
const;
653 XmpStruct xmpStruct()
const;
654 virtual long size()
const;
668 virtual long copy(
byte* buf,
ByteOrder byteOrder =invalidByteOrder)
const;
673 void setXmpArrayType(XmpArrayType xmpArrayType);
676 void setXmpStruct(XmpStruct xmpStruct =xsStruct);
691 virtual int read(
const byte* buf,
701 static XmpArrayType xmpArrayType(
TypeId typeId);
712 XmpArrayType xmpArrayType_;
713 XmpStruct xmpStruct_;
762 virtual long count()
const;
769 virtual long toLong(
long n =0)
const;
776 virtual float toFloat(
long n =0)
const;
783 virtual Rational toRational(
long n =0)
const;
784 virtual std::ostream& write(std::ostream& os)
const;
836 virtual long count()
const;
843 virtual long toLong(
long n =0)
const;
844 virtual float toFloat(
long n =0)
const;
845 virtual Rational toRational(
long n =0)
const;
852 virtual std::ostream& write(std::ostream& os)
const;
859 std::vector<std::string> value_;
874 int result = str1.size() < str2.size() ? 1
875 : str1.size() > str2.size() ? -1
878 std::string::const_iterator c1 = str1.begin();
879 std::string::const_iterator c2 = str2.begin();
880 if ( result==0 )
for (
881 ; result==0 && c1 != str1.end()
884 result = tolower(*c1) < tolower(*c2) ? 1
885 : tolower(*c1) > tolower(*c2) ? -1
938 virtual long count()
const;
953 virtual long toLong(
long n =0)
const;
954 virtual float toFloat(
long n =0)
const;
955 virtual Rational toRational(
long n =0)
const;
962 virtual std::ostream& write(std::ostream& os)
const;
971 typedef std::map<std::string, std::string,LangAltValueComparator>
ValueType;
1004 Date() : year(0), month(0), day(0) {}
1025 virtual int read(
const byte* buf,
1038 void setDate(
const Date& src);
1057 virtual long copy(
byte* buf,
ByteOrder byteOrder =invalidByteOrder)
const;
1059 virtual const Date& getDate()
const;
1060 virtual long count()
const;
1061 virtual long size()
const;
1062 virtual std::ostream& write(std::ostream& os)
const;
1064 virtual long toLong(
long n =0)
const;
1066 virtual float toFloat(
long n =0)
const;
1068 virtual Rational toRational(
long n =0)
const;
1098 TimeValue(
int hour,
int minute,
int second =0,
1099 int tzHour =0,
int tzMinute =0);
1108 Time() : hour(0), minute(0), second(0), tzHour(0), tzMinute(0) {}
1132 virtual int read(
const byte* buf,
1145 void setTime(
const Time& src);
1164 virtual long copy(
byte* buf,
ByteOrder byteOrder =invalidByteOrder)
const;
1166 virtual const Time& getTime()
const;
1167 virtual long count()
const;
1168 virtual long size()
const;
1169 virtual std::ostream& write(std::ostream& os)
const;
1171 virtual long toLong(
long n =0)
const;
1173 virtual float toFloat(
long n =0)
const;
1175 virtual Rational toRational(
long n =0)
const;
1191 int scanTime3(
const char* buf,
const char* format);
1202 int scanTime6(
const char* buf,
const char* format);
1243 template<
typename T>
1270 virtual int read(
const byte* buf,
long len,
ByteOrder byteOrder);
1282 virtual int setDataArea(
const byte* buf,
long len);
1289 virtual long count()
const;
1290 virtual long size()
const;
1291 virtual std::ostream&
write(std::ostream& os)
const;
1299 virtual long toLong(
long n =0)
const;
1300 virtual float toFloat(
long n =0)
const;
1398 return getLong(buf, byteOrder);
1431 template<
typename T>
long toData(
byte* buf, T t,
ByteOrder byteOrder);
1439 return us2Data(buf, t, byteOrder);
1448 return ul2Data(buf, t, byteOrder);
1457 return ur2Data(buf, t, byteOrder);
1466 return s2Data(buf, t, byteOrder);
1475 return l2Data(buf, t, byteOrder);
1484 return r2Data(buf, t, byteOrder);
1493 return f2Data(buf, t, byteOrder);
1502 return d2Data(buf, t, byteOrder);
1505 template<
typename T>
1511 template<
typename T>
1513 :
Value(typeId), pDataArea_(0), sizeDataArea_(0)
1517 template<
typename T>
1519 :
Value(typeId), pDataArea_(0), sizeDataArea_(0)
1521 read(buf, len, byteOrder);
1524 template<
typename T>
1526 :
Value(typeId), pDataArea_(0), sizeDataArea_(0)
1531 template<
typename T>
1533 :
Value(rhs), value_(rhs.value_), pDataArea_(0), sizeDataArea_(0)
1535 if (rhs.sizeDataArea_ > 0) {
1536 pDataArea_ =
new byte[rhs.sizeDataArea_];
1537 std::memcpy(pDataArea_, rhs.pDataArea_, rhs.sizeDataArea_);
1538 sizeDataArea_ = rhs.sizeDataArea_;
1542 template<
typename T>
1545 delete[] pDataArea_;
1548 template<
typename T>
1551 if (
this == &rhs)
return *
this;
1556 if (rhs.sizeDataArea_ > 0) {
1557 tmp =
new byte[rhs.sizeDataArea_];
1558 std::memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_);
1560 delete[] pDataArea_;
1562 sizeDataArea_ = rhs.sizeDataArea_;
1567 template<
typename T>
1573 if (len % ts != 0) len = (len / ts) * ts;
1574 for (
long i = 0; i < len; i += ts) {
1575 value_.push_back(getValue<T>(buf + i, byteOrder));
1580 template<
typename T>
1583 std::istringstream is(buf);
1586 while (!(is.eof())) {
1588 if (is.fail())
return 1;
1595 template<
typename T>
1599 typename ValueList::const_iterator end = value_.end();
1600 for (
typename ValueList::const_iterator i = value_.begin(); i != end; ++i) {
1601 offset +=
toData(buf + offset, *i, byteOrder);
1606 template<
typename T>
1609 return static_cast<long>(value_.size());
1612 template<
typename T>
1618 template<
typename T>
1624 template<
typename T>
1627 typename ValueList::const_iterator end = value_.end();
1628 typename ValueList::const_iterator i = value_.begin();
1630 os << std::setprecision(15) << *i;
1631 if (++i != end) os <<
" ";
1636 template<
typename T>
1640 return Exiv2::toString<T>(value_[n]);
1644 template<
typename T>
1648 return static_cast<long>(value_[n]);
1651 #define LARGE_INT 1000000
1656 ok_ = (value_[n].second != 0 && INT_MIN < value_[n].first && value_[n].first < INT_MAX );
1658 return value_[n].first / value_[n].second;
1664 ok_ = (value_[n].second != 0 && value_[n].first < LARGE_INT);
1666 return value_[n].first / value_[n].second;
1669 template<
typename T>
1673 return static_cast<float>(value_[n]);
1679 ok_ = (value_[n].second != 0);
1680 if (!ok_)
return 0.0f;
1681 return static_cast<float>(value_[n].first) / value_[n].second;
1687 ok_ = (value_[n].second != 0);
1688 if (!ok_)
return 0.0f;
1689 return static_cast<float>(value_[n].first) / value_[n].second;
1692 template<
typename T>
1703 return Rational(value_[n].first, value_[n].second);
1710 return Rational(value_[n].first, value_[n].second);
1729 template<
typename T>
1732 return sizeDataArea_;
1735 template<
typename T>
1738 return DataBuf(pDataArea_, sizeDataArea_);
1741 template<
typename T>
1746 tmp =
new byte[len];
1747 std::memcpy(tmp, buf, len);
1749 delete[] pDataArea_;
1751 sizeDataArea_ = len;
1756 #endif // #ifndef VALUE_HPP_
virtual Rational toRational(long n=0) const
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition: value.hpp:1693
std::auto_ptr< LangAltValue > AutoPtr
Shortcut for a LangAltValue auto pointer.
Definition: value.hpp:902
virtual float toFloat(long n=0) const
Return the value as a UNIX calender time converted to float.
Definition: value.cpp:1083
EXIV2API URational getURational(const byte *buf, ByteOrder byteOrder)
Read an 8 byte unsigned rational value from the data buffer.
Definition: types.cpp:311
int minute
Minute.
Definition: value.hpp:1111
TypeId getType< uint32_t >()
Specialization for an unsigned long.
Definition: value.hpp:1222
ValueType()
Default Constructor.
Definition: value.hpp:1506
virtual float toFloat(long n=0) const
Convert the value to a float. The optional parameter n is not used and is ignored.
Definition: value.cpp:787
virtual ~StringValue()
Virtual destructor.
Definition: value.cpp:387
virtual long count() const
Return the number of components of the value.
Definition: value.hpp:1607
virtual ~StringValueBase()
Virtual destructor.
Definition: value.cpp:309
std::map< std::string, std::string, LangAltValueComparator > ValueType
Type used to store language alternative arrays.
Definition: value.hpp:971
Value type for simple arrays. Each item in the array is a simple value, without qualifiers....
Definition: value.hpp:806
@ tiffFloat
TIFF FLOAT type, single precision (4-byte) IEEE format.
Definition: types.hpp:141
Base class for all Exiv2 values used to store XMP property values.
Definition: value.hpp:633
EXIV2API Rational parseRational(const std::string &s, bool &ok)
Return a Rational set to the value represented by s.
Definition: types.cpp:676
EXIV2API long d2Data(byte *buf, double d, ByteOrder byteOrder)
Convert a double precision floating point (IEEE 754 binary64) double to data, write the data to the b...
Definition: types.cpp:483
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:1222
Simple Time helper structure.
Definition: value.hpp:1106
XmpStruct xmpStruct() const
Return XMP struct, indicates if an XMP value is a structure.
Definition: value.cpp:668
Common interface for all types of values used with metadata.
Definition: value.hpp:60
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:893
Internal::enable_if< Internal::is_signed< T >::VALUE, T >::type abs(T num)
Calculates the absolute value of a number without producing negative values.
Definition: safe_op.hpp:327
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:213
EXIV2API long ur2Data(byte *buf, URational l, ByteOrder byteOrder)
Convert an unsigned rational to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:425
StringValueBase & operator=(const StringValueBase &rhs)
Assignment operator.
Definition: value.cpp:313
virtual int read(const byte *buf, long len, ByteOrder byteOrder=invalidByteOrder)
Read the value from a character buffer.
Definition: value.cpp:218
Value for simple ISO 8601 times.
Definition: value.hpp:1088
StringValue()
Default constructor.
Definition: value.cpp:377
virtual float toFloat(long n=0) const
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition: value.hpp:1670
virtual long copy(byte *buf, ByteOrder byteOrder=invalidByteOrder) const
Write value to a character data buffer.
Definition: value.cpp:1028
ValueType< int16_t > ShortValue
Signed short value type.
Definition: value.hpp:1345
virtual long size() const
Return the size of the value in bytes.
Definition: value.cpp:691
Type definitions for Exiv2 and related functionality.
virtual long size() const
Return the size of the value in bytes.
Definition: value.cpp:1049
ValueType< float > FloatValue
Float value type.
Definition: value.hpp:1351
@ undefined
Exif UNDEFINED type, an 8-bit byte that may contain anything.
Definition: types.hpp:137
TypeId getType()
Template to determine the TypeId for a type T.
virtual std::ostream & write(std::ostream &os) const
Write all elements of the value to os, separated by commas.
Definition: value.cpp:824
TypeId typeId() const
Return the type identifier (Exif data format type).
Definition: value.hpp:113
virtual long copy(byte *buf, ByteOrder byteOrder=invalidByteOrder) const
Write value to a character data buffer.
Definition: value.cpp:334
virtual DataBuf dataArea() const
Return a copy of the data area in a DataBuf. The caller owns this copy and DataBuf ensures that it wi...
Definition: value.hpp:1736
Simple Date helper structure.
Definition: value.hpp:1003
XmpArrayType
XMP array types.
Definition: value.hpp:639
virtual Rational toRational(long n=0) const
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition: value.cpp:850
void setXmpArrayType(XmpArrayType xmpArrayType)
Set the XMP array type to indicate that an XMP value is an array.
Definition: value.cpp:641
virtual int read(const std::string &buf)
Set the value to that of the string buf. Overrides base class to append a terminating '\0' character ...
Definition: value.cpp:410
virtual int read(const std::string &buf)
Read a simple property value from buf to set the value.
Definition: value.cpp:709
ValueList value_
The container for all values. In your application, if you know what subclass of Value you're dealing ...
Definition: value.hpp:1325
virtual Rational toRational(long n=0) const
Return the value as a UNIX calender time converted to Rational.
Definition: value.cpp:1088
@ signedShort
Exif SSHORT type, a 16-bit (2-byte) signed (twos-complement) integer.
Definition: types.hpp:138
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:150
virtual float toFloat(long n=0) const
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition: value.cpp:281
@ asciiString
Exif ASCII type, 8-bit byte.
Definition: types.hpp:132
virtual long copy(byte *buf, ByteOrder byteOrder=invalidByteOrder) const
Write value to a character data buffer.
Definition: value.cpp:1200
static AutoPtr create(TypeId typeId)
A (simple) factory to create a Value type.
Definition: value.cpp:100
ValueType< T > & operator=(const ValueType< T > &rhs)
Assignment operator.
Definition: value.hpp:1549
XmpArrayType xmpArrayType() const
Return XMP array type, indicates if an XMP value is an array.
Definition: value.cpp:651
virtual const Date & getDate() const
Return date struct containing date information.
Definition: value.cpp:1039
int month
Month.
Definition: value.hpp:1006
virtual long copy(byte *buf, ByteOrder byteOrder=invalidByteOrder) const
Write value to a character data buffer.
Definition: value.cpp:239
LangAltValueComparator
Definition: value.hpp:870
EXIV2API long r2Data(byte *buf, Rational l, ByteOrder byteOrder)
Convert a signed rational to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:462
EXIV2API float parseFloat(const std::string &s, bool &ok)
Return a float set to the value represented by s.
Definition: types.cpp:655
Value type for XMP language alternative properties.
Definition: value.hpp:899
std::string value_
Stores the string values.
Definition: value.hpp:793
virtual long toLong(long n=0) const
Convert the n-th component of the value to a long. The behaviour of this method may be undefined if t...
Definition: value.cpp:275
Value type suitable for simple XMP properties and XMP nodes of complex types which are not parsed int...
Definition: value.hpp:724
std::auto_ptr< StringValueBase > AutoPtr
Shortcut for a StringValueBase auto pointer.
Definition: value.hpp:347
std::auto_ptr< XmpTextValue > AutoPtr
Shortcut for a XmpTextValue auto pointer.
Definition: value.hpp:727
TimeValue()
Default constructor.
Definition: value.cpp:1093
@ unsignedLong
Exif LONG type, 32-bit (4-byte) unsigned integer.
Definition: types.hpp:134
virtual std::ostream & write(std::ostream &os) const
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition: value.cpp:257
EXIV2API long f2Data(byte *buf, float f, ByteOrder byteOrder)
Convert a single precision floating point (IEEE 754 binary32) float to data, write the data to the bu...
Definition: types.cpp:469
TypeId getType< int32_t >()
Specialization for a signed long.
Definition: value.hpp:1228
virtual float toFloat(long n=0) const
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition: value.cpp:944
virtual std::ostream & write(std::ostream &os) const
Write the ASCII value up to the the first '\0' character to an output stream. Any further characters ...
Definition: value.cpp:422
ValueType< uint32_t > ULongValue
Unsigned long value type.
Definition: value.hpp:1341
void setTime(const Time &src)
Set the time.
Definition: value.cpp:1195
@ tiffDouble
TIFF DOUBLE type, double precision (8-byte) IEEE format.
Definition: types.hpp:142
int hour
Hour.
Definition: value.hpp:1110
virtual ~DateValue()
Virtual destructor.
Definition: value.cpp:974
virtual long toLong(long n=0) const
Convert the n-th component of the value to a long. The behaviour of this method may be undefined if t...
Definition: value.cpp:840
Value for an Ascii string type.
Definition: value.hpp:458
void setDate(const Date &src)
Set the date.
Definition: value.cpp:1021
Value for an undefined data type.
Definition: value.hpp:262
DateValue()
Default constructor.
Definition: value.cpp:961
ValueType< URational > URationalValue
Unsigned rational value type.
Definition: value.hpp:1343
long size() const
Return the size of the value in bytes.
Definition: value.cpp:749
ValueType value_
Map to store the language alternative values. The language qualifier is used as the key for the map e...
Definition: value.hpp:977
Port of D's enforce() to C++ & Exiv2.
TypeId getType< URational >()
Specialization for an unsigned rational.
Definition: value.hpp:1224
virtual std::ostream & write(std::ostream &os) const
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition: value.hpp:1625
@ tiffIfd
TIFF IFD type, 32-bit (4-byte) unsigned integer.
Definition: types.hpp:143
virtual Rational toRational(long n=0) const
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition: value.cpp:371
TypeId getType< double >()
Specialization for a double.
Definition: value.hpp:1234
virtual DataBuf dataArea() const
Return a copy of the data area if the value has one. The caller owns this copy and DataBuf ensures th...
Definition: value.cpp:193
TypeId getType< int16_t >()
Specialization for a signed short.
Definition: value.hpp:1226
virtual float toFloat(long n=0) const
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition: value.cpp:845
virtual int read(const byte *buf, long len, ByteOrder byteOrder=invalidByteOrder)
Read the value from a character buffer.
Definition: value.cpp:683
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:119
@ unsignedRational
Exif RATIONAL type, two LONGs: numerator and denumerator of a fraction.
Definition: types.hpp:135
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:754
Value for string type.
Definition: value.hpp:426
virtual long size() const
Return the size of the value in bytes.
Definition: value.hpp:1613
EXIV2API bool convertStringCharset(std::string &str, const char *from, const char *to)
Convert character encoding of str from from to to. If the function succeeds, str contains the result ...
Definition: convert.cpp:1348
virtual float toFloat(long n=0) const
Returns number of seconds in the day in UTC converted to float.
Definition: value.cpp:1267
virtual int read(const std::string &buf)
Read a simple property value from buf and append it to the value.
Definition: value.cpp:871
@ invalidTypeId
Invalid type id.
Definition: types.hpp:157
Value(TypeId typeId)
Constructor, taking a type id to initialize the base class with.
Definition: value.cpp:83
std::auto_ptr< XmpValue > AutoPtr
Shortcut for a XmpValue auto pointer.
Definition: value.hpp:636
EXIV2API long parseLong(const std::string &s, bool &ok)
Return a long set to the value represented by s.
Definition: types.cpp:631
EXIV2API int16_t getShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte signed short value from the data buffer.
Definition: types.cpp:318
std::vector< T > ValueList
Container for values.
Definition: value.hpp:1312
void enforce(bool condition, const T &arg1)
Ensure that condition is true, otherwise throw an exception of the type exception_t.
Definition: enforce.hpp:43
virtual std::ostream & write(std::ostream &os) const =0
Write the value to an output stream. You do not usually have to use this function; it is used for the...
@ xmpBag
XMP bag type.
Definition: types.hpp:154
virtual Rational toRational(long n=0) const
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition: value.cpp:950
AsciiValue()
Default constructor.
Definition: value.cpp:396
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
EXIV2API long l2Data(byte *buf, int32_t l, ByteOrder byteOrder)
Convert a signed long to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:445
virtual long toLong(long n=0) const
Convert the value to a long. The optional parameter n is not used and is ignored.
Definition: value.cpp:782
@ unsignedByte
Exif BYTE type, 8-bit unsigned integer.
Definition: types.hpp:131
EXIV2API long us2Data(byte *buf, uint16_t s, ByteOrder byteOrder)
Convert an unsigned short to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:395
@ signedByte
Exif SBYTE type, an 8-bit signed (twos-complement) integer.
Definition: types.hpp:136
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:175
int tzMinute
Minutes ahead or behind UTC.
Definition: value.hpp:1114
EXIV2API int32_t getLong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte signed long value from the data buffer.
Definition: types.cpp:328
virtual Rational toRational(long n=0) const
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition: value.cpp:287
virtual std::ostream & write(std::ostream &os) const
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition: value.cpp:354
@ langAlt
XMP language alternative type.
Definition: types.hpp:156
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition: datasets.cpp:709
@ unsignedShort
Exif SHORT type, 16-bit (2-byte) unsigned integer.
Definition: types.hpp:133
XmpStruct
XMP structure indicator.
Definition: value.hpp:641
virtual ~TimeValue()
Virtual destructor.
Definition: value.cpp:1110
virtual int setDataArea(const byte *buf, long len)
Set the data area, if the value has one by copying (cloning) the buffer pointed to by buf.
Definition: value.cpp:170
bool ok_
Indicates the status of the previous to<Type> conversion.
Definition: value.hpp:245
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
virtual long copy(byte *buf, ByteOrder byteOrder) const
Write value to a data buffer.
Definition: value.hpp:1596
EXIV2API float getFloat(const byte *buf, ByteOrder byteOrder)
Read a 4 byte single precision floating point value (IEEE 754 binary32) from the data buffer.
Definition: types.cpp:347
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:1044
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition: types.hpp:110
Value interface and concrete subclasses.
@ signedLong
Exif SLONG type, a 32-bit (4-byte) signed (twos-complement) integer.
Definition: types.hpp:139
Exif and IPTC conversions to and from XMP.
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:130
ValueType< uint16_t > UShortValue
Unsigned short value type.
Definition: value.hpp:1339
virtual int read(const std::string &buf)
Read the value from buf. This default implementation uses buf as it is.
Definition: value.cpp:321
TypeId getType< uint16_t >()
Specialization for an unsigned short.
Definition: value.hpp:1220
T getValue(const byte *buf, ByteOrder byteOrder)
Read a value of type T from the data buffer.
Definition: value.hpp:1372
EXIV2API long ul2Data(byte *buf, uint32_t l, ByteOrder byteOrder)
Convert an unsigned long to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:408
TypeId getType< float >()
Specialization for a float.
Definition: value.hpp:1232
virtual ~AsciiValue()
Virtual destructor.
Definition: value.cpp:406
int second
Second.
Definition: value.hpp:1112
@ signedRational
Exif SRATIONAL type, two SLONGs: numerator and denumerator of a fraction.
Definition: types.hpp:140
virtual float toFloat(long n=0) const
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition: value.cpp:365
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:819
bool operator()(const std::string &str1, const std::string &str2) const
LangAltValueComparator comparison case insensitive function.
Definition: value.hpp:872
virtual std::ostream & write(std::ostream &os) const
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition: value.cpp:1059
virtual long size() const
Return the size of the value in bytes.
Definition: value.cpp:1227
virtual long toLong(long n=0) const
Convert the n-th component of the value to a long. The behaviour of this method may be undefined if t...
Definition: value.cpp:359
std::auto_ptr< TimeValue > AutoPtr
Shortcut for a TimeValue auto pointer.
Definition: value.hpp:1091
long toData(byte *buf, T t, ByteOrder byteOrder)
Convert a value of type T to data, write the data to the data buffer.
virtual const Time & getTime() const
Return time struct containing time information.
Definition: value.cpp:1217
#define EXV_WARNING
Shorthand for a temp warning log message object and return its ostringstream.
Definition: error.hpp:148
virtual Rational toRational(long n=0) const
Convert the value to a Rational. The optional parameter n is not used and is ignored.
Definition: value.cpp:792
virtual int read(const std::string &buf)
Read a simple property value from buf and append it to the value.
Definition: value.cpp:808
Value & operator=(const Value &rhs)
Assignment operator. Protected so that it can only be used by subclasses but not directly.
Definition: value.cpp:92
LangAltValue()
Constructor.
Definition: value.cpp:860
EXIV2API uint16_t getUShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte unsigned short value from the data buffer.
Definition: types.cpp:278
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:113
@ time
IPTC time type.
Definition: types.hpp:149
@ date
IPTC date type.
Definition: types.hpp:148
virtual int read(const byte *buf, long len, ByteOrder byteOrder=invalidByteOrder)
Read the value from a character buffer.
Definition: value.cpp:978
virtual long size() const
Return the size of the value in bytes.
Definition: value.cpp:349
Abstract base class for a string based Value type.
Definition: value.hpp:344
std::auto_ptr< XmpArrayValue > AutoPtr
Shortcut for a XmpArrayValue auto pointer.
Definition: value.hpp:809
Value for simple ISO 8601 dates
Definition: value.hpp:987
virtual int read(const byte *buf, long len, ByteOrder byteOrder)
Read the value from a character buffer.
Definition: value.hpp:1568
virtual std::ostream & write(std::ostream &os) const
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition: value.cpp:759
TypeId getType< Rational >()
Specialization for a signed rational.
Definition: value.hpp:1230
virtual long copy(byte *buf, ByteOrder byteOrder=invalidByteOrder) const
Write value to a character data buffer.
Definition: value.cpp:673
ValueType< Rational > RationalValue
Signed rational value type.
Definition: value.hpp:1349
std::pair< uint32_t, uint32_t > URational
8 byte unsigned rational type.
Definition: types.hpp:108
std::auto_ptr< StringValue > AutoPtr
Shortcut for a StringValue auto pointer.
Definition: value.hpp:429
void setXmpStruct(XmpStruct xmpStruct=xsStruct)
Set the XMP struct type to indicate that an XMP value is a structure.
Definition: value.cpp:646
virtual long sizeDataArea() const
Return the size of the data area.
Definition: value.hpp:1730
virtual std::ostream & write(std::ostream &os) const
Write all elements of the value to os, separated by commas.
Definition: value.cpp:900
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:323
virtual ~Value()
Virtual destructor.
Definition: value.cpp:88
EXIV2API Rational getRational(const byte *buf, ByteOrder byteOrder)
Read an 8 byte signed rational value from the data buffer.
Definition: types.cpp:340
virtual long count() const
Return the number of components of the value.
Definition: value.cpp:344
virtual long sizeDataArea() const
Return the size of the data area, 0 if there is none.
Definition: value.cpp:188
virtual long toLong(long n=0) const
Convert the n-th component of the value to a long. The behaviour of this method may be undefined if t...
Definition: value.cpp:938
XmpTextValue()
Constructor.
Definition: value.cpp:698
@ xmpText
XMP text type.
Definition: types.hpp:152
ValueType< int32_t > LongValue
Signed long value type.
Definition: value.hpp:1347
std::auto_ptr< ValueType< T > > AutoPtr
Shortcut for a ValueType<T> auto pointer.
Definition: value.hpp:1247
std::vector< T >::iterator iterator
Iterator type defined for convenience.
Definition: value.hpp:1314
@ string
IPTC string type.
Definition: types.hpp:147
std::vector< T >::const_iterator const_iterator
Const iterator type defined for convenience.
Definition: value.hpp:1316
virtual long toLong(long n=0) const
Return the value as a UNIX calender time converted to long.
Definition: value.cpp:1069
StringValueBase(TypeId typeId)
Constructor for subclasses.
Definition: value.cpp:293
EXIV2API double getDouble(const byte *buf, ByteOrder byteOrder)
Read an 8 byte double precision floating point value (IEEE 754 binary64) from the data buffer.
Definition: types.cpp:361
@ xmpSeq
XMP sequence type.
Definition: types.hpp:155
std::auto_ptr< DateValue > AutoPtr
Shortcut for a DateValue auto pointer.
Definition: value.hpp:990
std::string toString(const T &arg)
Utility function to convert the argument of any type to a string.
Definition: types.hpp:521
virtual std::ostream & write(std::ostream &os) const
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition: value.cpp:1237
virtual int setDataArea(const byte *buf, long len)
Set the data area. This method copies (clones) the buffer pointed to by buf.
Definition: value.hpp:1742
virtual int read(const byte *buf, long len, ByteOrder byteOrder)=0
Read the value from a character buffer.
int tzHour
Hours ahead or behind UTC.
Definition: value.hpp:1113
std::string value_
Stores the string value.
Definition: value.hpp:415
EXIV2API Rational floatToRationalCast(float f)
Very simple conversion of a float to a Rational.
Definition: types.cpp:694
bool ok() const
Check the ok status indicator. After a to<Type> conversion, this indicator shows whether the conversi...
Definition: value.hpp:197
Template for a Value of a basic type. This is used for unsigned and signed short, long and rationals.
Definition: value.hpp:1244
std::auto_ptr< DataValue > AutoPtr
Shortcut for a DataValue auto pointer.
Definition: value.hpp:265
virtual Rational toRational(long n=0) const
Returns number of seconds in the day in UTC converted to Rational.
Definition: value.cpp:1272
@ xmpAlt
XMP alternative type.
Definition: types.hpp:153
int day
Day.
Definition: value.hpp:1007
XmpValue & operator=(const XmpValue &rhs)
Assignment operator. Protected so that it can only be used by subclasses but not directly.
Definition: value.cpp:633
int year
Year.
Definition: value.hpp:1005
XmpArrayValue(TypeId typeId=xmpBag)
Constructor. typeId can be one of xmpBag, xmpSeq or xmpAlt.
Definition: value.cpp:802
ValueType< double > DoubleValue
Double value type.
Definition: value.hpp:1353
virtual ~ValueType()
Virtual destructor.
Definition: value.hpp:1543
static long typeSize(TypeId typeId)
Return the size in bytes of one element of this type.
Definition: types.cpp:121
virtual int read(const byte *buf, long len, ByteOrder byteOrder=invalidByteOrder)
Read the value from a character buffer.
Definition: value.cpp:1114
std::auto_ptr< Value > AutoPtr
Shortcut for a Value auto pointer.
Definition: value.hpp:63
virtual long toLong(long n=0) const
Convert the n-th component of the value to a long. The behaviour of this method may be undefined if t...
Definition: value.hpp:1645
virtual long size() const
Return the size of the value in bytes.
Definition: value.cpp:247
EXIV2API uint32_t getULong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte unsigned long value from the data buffer.
Definition: types.cpp:283
EXIV2API long s2Data(byte *buf, int16_t s, ByteOrder byteOrder)
Convert a signed short to data, write the data to the buffer, return number of bytes written.
Definition: types.cpp:432
Error class for exceptions, log message class.
std::auto_ptr< AsciiValue > AutoPtr
Shortcut for a AsciiValue auto pointer.
Definition: value.hpp:461
virtual long toLong(long n=0) const
Returns number of seconds in the day in UTC.
Definition: value.cpp:1254