|
|
@ -1209,6 +1209,8 @@ namespace Exiv2 {
|
|
|
|
template<> inline TypeId getType<int32_t>() { return signedLong; }
|
|
|
|
template<> inline TypeId getType<int32_t>() { return signedLong; }
|
|
|
|
//! Specialization for a signed rational
|
|
|
|
//! Specialization for a signed rational
|
|
|
|
template<> inline TypeId getType<Rational>() { return signedRational; }
|
|
|
|
template<> inline TypeId getType<Rational>() { return signedRational; }
|
|
|
|
|
|
|
|
//! Specialization for a float
|
|
|
|
|
|
|
|
template<> inline TypeId getType<float>() { return tiffFloat; }
|
|
|
|
|
|
|
|
|
|
|
|
// No default implementation: let the compiler/linker complain
|
|
|
|
// No default implementation: let the compiler/linker complain
|
|
|
|
// template<typename T> inline TypeId getType() { return invalid; }
|
|
|
|
// template<typename T> inline TypeId getType() { return invalid; }
|
|
|
@ -1321,6 +1323,8 @@ namespace Exiv2 {
|
|
|
|
typedef ValueType<int32_t> LongValue;
|
|
|
|
typedef ValueType<int32_t> LongValue;
|
|
|
|
//! Signed rational value type
|
|
|
|
//! Signed rational value type
|
|
|
|
typedef ValueType<Rational> RationalValue;
|
|
|
|
typedef ValueType<Rational> RationalValue;
|
|
|
|
|
|
|
|
//! Float value type
|
|
|
|
|
|
|
|
typedef ValueType<float> FloatValue;
|
|
|
|
|
|
|
|
|
|
|
|
// *****************************************************************************
|
|
|
|
// *****************************************************************************
|
|
|
|
// free functions, template and inline definitions
|
|
|
|
// free functions, template and inline definitions
|
|
|
@ -1373,6 +1377,12 @@ namespace Exiv2 {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return getRational(buf, byteOrder);
|
|
|
|
return getRational(buf, byteOrder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specialization for a 4 byte float value.
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
|
|
|
inline float getValue(const byte* buf, ByteOrder byteOrder)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return getFloat(buf, byteOrder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
@brief Convert a value of type T to data, write the data to the data buffer.
|
|
|
|
@brief Convert a value of type T to data, write the data to the data buffer.
|
|
|
@ -1441,6 +1451,15 @@ namespace Exiv2 {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return r2Data(buf, t, byteOrder);
|
|
|
|
return r2Data(buf, t, byteOrder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
|
|
@brief Specialization to write a float to the data buffer.
|
|
|
|
|
|
|
|
Return the number of bytes written.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
|
|
|
inline long toData(byte* buf, float t, ByteOrder byteOrder)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return f2Data(buf, t, byteOrder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|
ValueType<T>::ValueType()
|
|
|
|
ValueType<T>::ValueType()
|
|
|
@ -1640,6 +1659,14 @@ namespace Exiv2 {
|
|
|
|
ok_ = true;
|
|
|
|
ok_ = true;
|
|
|
|
return Rational(value_[n].first, value_[n].second);
|
|
|
|
return Rational(value_[n].first, value_[n].second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specialization for float.
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
|
|
|
inline Rational ValueType<float>::toRational(long n) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ok_ = true;
|
|
|
|
|
|
|
|
// Warning: This is a very simple conversion, see floatToRationalCast()
|
|
|
|
|
|
|
|
return floatToRationalCast(value_[n]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|
long ValueType<T>::sizeDataArea() const
|
|
|
|
long ValueType<T>::sizeDataArea() const
|
|
|
|