Loading...
Searching...
No Matches
value.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef VALUE_HPP_
#define VALUE_HPP_
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "types.hpp"
// + standard includes
#include <cmath>
#include <cstring>
#include <iomanip>
#include <map>
#include <memory>
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
class EXIV2API Value {
public:
using UniquePtr = std::unique_ptr<Value>;
explicit Value(TypeId typeId);
virtual ~Value() = default;
virtual int read(const byte* buf, size_t len, ByteOrder byteOrder) = 0;
virtual int read(const std::string& buf) = 0;
virtual int setDataArea(const byte* buf, size_t len);
TypeId typeId() const {
return type_;
}
UniquePtr clone() const {
return UniquePtr(clone_());
}
virtual size_t copy(byte* buf, ByteOrder byteOrder) const = 0;
virtual size_t count() const = 0;
virtual size_t size() const = 0;
virtual std::ostream& write(std::ostream& os) const = 0;
std::string toString() const;
virtual std::string toString(size_t n) const;
virtual int64_t toInt64(size_t n = 0) const = 0;
virtual uint32_t toUint32(size_t n = 0) const = 0;
virtual float toFloat(size_t n = 0) const = 0;
virtual Rational toRational(size_t n = 0) const = 0;
virtual size_t sizeDataArea() const;
virtual DataBuf dataArea() const;
bool ok() const {
return ok_;
}
static UniquePtr create(TypeId typeId);
protected:
Value(const Value&) = default;
Value& operator=(const Value&) = default;
// DATA
mutable bool ok_{true};
private:
virtual Value* clone_() const = 0;
// DATA
TypeId type_;
};
inline std::ostream& operator<<(std::ostream& os, const Value& value) {
return value.write(os);
}
class EXIV2API DataValue : public Value {
public:
using UniquePtr = std::unique_ptr<DataValue>;
explicit DataValue(TypeId typeId = undefined);
DataValue(const byte* buf, size_t len, ByteOrder byteOrder = invalidByteOrder, TypeId typeId = undefined);
int read(const byte* buf, size_t len, ByteOrder byteOrder = invalidByteOrder) override;
int read(const std::string& buf) override;
UniquePtr clone() const {
return UniquePtr(clone_());
}
size_t copy(byte* buf, ByteOrder byteOrder = invalidByteOrder) const override;
size_t count() const override;
size_t size() const override;
std::ostream& write(std::ostream& os) const override;
std::string toString(size_t n) const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
private:
DataValue* clone_() const override;
public:
using ValueType = std::vector<byte>;
// DATA
ValueType value_;
}; // class DataValue
class EXIV2API StringValueBase : public Value {
using Value::Value;
public:
using UniquePtr = std::unique_ptr<StringValueBase>;
StringValueBase(TypeId typeId, const std::string& buf);
int read(const std::string& buf) override;
int read(const byte* buf, size_t len, ByteOrder byteOrder = invalidByteOrder) override;
UniquePtr clone() const {
return UniquePtr(clone_());
}
size_t copy(byte* buf, ByteOrder byteOrder = invalidByteOrder) const override;
size_t count() const override;
size_t size() const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
std::ostream& write(std::ostream& os) const override;
protected:
StringValueBase* clone_() const override = 0;
public:
// DATA
std::string value_;
}; // class StringValueBase
class EXIV2API StringValue : public StringValueBase {
public:
using UniquePtr = std::unique_ptr<StringValue>;
StringValue();
explicit StringValue(const std::string& buf);
UniquePtr clone() const {
return UniquePtr(clone_());
}
private:
StringValue* clone_() const override;
}; // class StringValue
class EXIV2API AsciiValue : public StringValueBase {
public:
using UniquePtr = std::unique_ptr<AsciiValue>;
AsciiValue();
explicit AsciiValue(const std::string& buf);
using StringValueBase::read;
int read(const std::string& buf) override;
UniquePtr clone() const {
return UniquePtr(clone_());
}
std::ostream& write(std::ostream& os) const override;
private:
AsciiValue* clone_() const override;
}; // class AsciiValue
class EXIV2API CommentValue : public StringValueBase {
public:
enum CharsetId { ascii, jis, unicode, undefined, invalidCharsetId, lastCharsetId };
struct CharsetTable {
CharsetId charsetId_;
const char* name_;
const char* code_;
};
class EXIV2API CharsetInfo {
public:
static const char* name(CharsetId charsetId);
static const char* code(CharsetId charsetId);
static CharsetId charsetIdByName(const std::string& name);
static CharsetId charsetIdByCode(const std::string& code);
private:
static const CharsetTable charsetTable_[];
}; // class CharsetInfo
using UniquePtr = std::unique_ptr<CommentValue>;
CommentValue();
explicit CommentValue(const std::string& comment);
int read(const std::string& comment) override;
int read(const byte* buf, size_t len, ByteOrder byteOrder) override;
UniquePtr clone() const {
return UniquePtr(clone_());
}
size_t copy(byte* buf, ByteOrder byteOrder) const override;
std::ostream& write(std::ostream& os) const override;
std::string comment(const char* encoding = nullptr) const;
const char* detectCharset(std::string& c) const;
CharsetId charsetId() const;
private:
CommentValue* clone_() const override;
public:
// DATA
ByteOrder byteOrder_{littleEndian};
}; // class CommentValue
class EXIV2API XmpValue : public Value {
using Value::Value;
public:
using UniquePtr = std::unique_ptr<XmpValue>;
enum XmpArrayType { xaNone, xaAlt, xaBag, xaSeq };
enum XmpStruct { xsNone, xsStruct };
XmpArrayType xmpArrayType() const;
XmpStruct xmpStruct() const;
size_t size() const override;
size_t copy(byte* buf, ByteOrder byteOrder = invalidByteOrder) const override;
void setXmpArrayType(XmpArrayType xmpArrayType);
void setXmpStruct(XmpStruct xmpStruct = xsStruct);
int read(const byte* buf, size_t len, ByteOrder byteOrder = invalidByteOrder) override;
int read(const std::string& buf) override = 0;
static XmpArrayType xmpArrayType(TypeId typeId);
private:
// DATA
XmpArrayType xmpArrayType_{xaNone};
XmpStruct xmpStruct_{xsNone};
}; // class XmpValue
class EXIV2API XmpTextValue : public XmpValue {
public:
using UniquePtr = std::unique_ptr<XmpTextValue>;
XmpTextValue();
explicit XmpTextValue(const std::string& buf);
using XmpValue::read;
int read(const std::string& buf) override;
UniquePtr clone() const;
size_t size() const override;
size_t count() const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
std::ostream& write(std::ostream& os) const override;
private:
XmpTextValue* clone_() const override;
public:
// DATA
std::string value_;
}; // class XmpTextValue
class EXIV2API XmpArrayValue : public XmpValue {
public:
using UniquePtr = std::unique_ptr<XmpArrayValue>;
explicit XmpArrayValue(TypeId typeId = xmpBag);
using XmpValue::read;
int read(const std::string& buf) override;
UniquePtr clone() const;
size_t count() const override;
std::string toString(size_t n) const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
std::ostream& write(std::ostream& os) const override;
private:
XmpArrayValue* clone_() const override;
std::vector<std::string> value_;
}; // class XmpArrayValue
struct LangAltValueComparator {
bool operator()(const std::string& str1, const std::string& str2) const {
int result = str1.size() < str2.size() ? 1 : str1.size() > str2.size() ? -1 : 0;
if (result == 0) {
for (auto c1 = str1.begin(), c2 = str2.begin(); result == 0 && c1 != str1.end(); ++c1, ++c2) {
result = tolower(*c1) < tolower(*c2) ? 1 : tolower(*c1) > tolower(*c2) ? -1 : 0;
}
}
return result < 0;
}
};
class EXIV2API LangAltValue : public XmpValue {
public:
using UniquePtr = std::unique_ptr<LangAltValue>;
LangAltValue();
explicit LangAltValue(const std::string& buf);
using XmpValue::read;
int read(const std::string& buf) override;
UniquePtr clone() const;
size_t count() const override;
std::string toString(size_t n) const override;
std::string toString(const std::string& qualifier) const;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
std::ostream& write(std::ostream& os) const override;
private:
LangAltValue* clone_() const override;
public:
using ValueType = std::map<std::string, std::string, LangAltValueComparator>;
// DATA
ValueType value_;
}; // class LangAltValue
class EXIV2API DateValue : public Value {
public:
using UniquePtr = std::unique_ptr<DateValue>;
DateValue();
DateValue(int32_t year, int32_t month, int32_t day);
struct EXIV2API Date {
int32_t year;
int32_t month;
int32_t day;
};
int read(const byte* buf, size_t len, ByteOrder byteOrder = invalidByteOrder) override;
int read(const std::string& buf) override;
void setDate(const Date& src);
UniquePtr clone() const {
return UniquePtr(clone_());
}
size_t copy(byte* buf, ByteOrder byteOrder = invalidByteOrder) const override;
virtual const Date& getDate() const;
size_t count() const override;
size_t size() const override;
std::ostream& write(std::ostream& os) const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
private:
DateValue* clone_() const override;
// DATA
Date date_;
}; // class DateValue
class EXIV2API TimeValue : public Value {
public:
using UniquePtr = std::unique_ptr<TimeValue>;
TimeValue();
TimeValue(int32_t hour, int32_t minute, int32_t second = 0, int32_t tzHour = 0, int32_t tzMinute = 0);
struct Time {
int32_t hour;
int32_t minute;
int32_t second;
int32_t tzHour;
int32_t tzMinute;
};
int read(const byte* buf, size_t len, ByteOrder byteOrder = invalidByteOrder) override;
int read(const std::string& buf) override;
void setTime(const Time& src);
UniquePtr clone() const {
return UniquePtr(clone_());
}
size_t copy(byte* buf, ByteOrder byteOrder = invalidByteOrder) const override;
virtual const Time& getTime() const;
size_t count() const override;
size_t size() const override;
std::ostream& write(std::ostream& os) const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
private:
TimeValue* clone_() const override;
// DATA
Time time_;
}; // class TimeValue
template <typename T>
TypeId getType();
template <>
inline TypeId getType<uint16_t>() {
return unsignedShort;
}
template <>
inline TypeId getType<uint32_t>() {
return unsignedLong;
}
template <>
inline TypeId getType<URational>() {
return unsignedRational;
}
template <>
inline TypeId getType<int16_t>() {
return signedShort;
}
template <>
inline TypeId getType<int32_t>() {
return signedLong;
}
template <>
inline TypeId getType<Rational>() {
return signedRational;
}
template <>
inline TypeId getType<float>() {
return tiffFloat;
}
template <>
inline TypeId getType<double>() {
return tiffDouble;
}
// No default implementation: let the compiler/linker complain
// template<typename T> inline TypeId getType() { return invalid; }
template <typename T>
class ValueType : public Value {
using Value::Value;
public:
using UniquePtr = std::unique_ptr<ValueType<T>>;
ValueType();
ValueType(const byte* buf, size_t len, ByteOrder byteOrder, TypeId typeId = getType<T>());
explicit ValueType(const T& val, TypeId typeId = getType<T>());
ValueType(const ValueType<T>& rhs);
~ValueType() override;
ValueType<T>& operator=(const ValueType<T>& rhs);
int read(const byte* buf, size_t len, ByteOrder byteOrder) override;
int read(const std::string& buf) override;
int setDataArea(const byte* buf, size_t len) override;
UniquePtr clone() const {
return UniquePtr(clone_());
}
size_t copy(byte* buf, ByteOrder byteOrder) const override;
size_t count() const override;
size_t size() const override;
std::ostream& write(std::ostream& os) const override;
std::string toString(size_t n) const override;
int64_t toInt64(size_t n = 0) const override;
uint32_t toUint32(size_t n = 0) const override;
float toFloat(size_t n = 0) const override;
Rational toRational(size_t n = 0) const override;
size_t sizeDataArea() const override;
DataBuf dataArea() const override;
using ValueList = std::vector<T>;
using iterator = typename std::vector<T>::iterator;
using const_iterator = typename std::vector<T>::const_iterator;
// DATA
ValueList value_;
private:
template <typename I>
inline I float_to_integer_helper(size_t n) const {
const auto v = value_.at(n);
if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
return static_cast<I>(std::lround(v));
}
return 0;
}
template <typename I>
inline I rational_to_integer_helper(size_t n) const {
auto a = value_.at(n).first;
auto b = value_.at(n).second;
// Protect against divide-by-zero.
if (b <= 0) {
return 0;
}
// Check for integer overflow.
#ifdef __cpp_if_constexpr
if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
#else
if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
#endif
// conversion does not change sign
const auto imin = std::numeric_limits<I>::min();
const auto imax = std::numeric_limits<I>::max();
if (imax < b || a < imin || imax < a) {
return 0;
}
#ifdef __cpp_if_constexpr
} else if constexpr (std::is_signed_v<I>) {
#else
} else if (std::is_signed<I>::value) {
#endif
// conversion is from unsigned to signed
#if __cplusplus >= 201402L || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201402L))
const auto imax = static_cast<std::make_unsigned_t<I>>(std::numeric_limits<I>::max());
#else
const auto imax = static_cast<typename std::make_unsigned<I>::type>(std::numeric_limits<I>::max());
#endif
if (imax < b || imax < a) {
return 0;
}
} else {
// conversion is from signed to unsigned
const auto imax = std::numeric_limits<I>::max();
if (a < 0) {
return 0;
}
// Inputs are not negative so convert them to unsigned.
#if __cplusplus >= 201402L || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201402L))
const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
#else
const auto a_u = static_cast<typename std::make_unsigned<decltype(a)>::type>(a);
const auto b_u = static_cast<typename std::make_unsigned<decltype(b)>::type>(b);
#endif
if (imax < b_u || imax < a_u) {
return 0;
}
}
return static_cast<I>(a) / static_cast<I>(b);
}
ValueType<T>* clone_() const override;
// DATA
byte* pDataArea_{nullptr};
size_t sizeDataArea_{0};
}; // class ValueType
using UShortValue = ValueType<uint16_t>;
using ULongValue = ValueType<uint32_t>;
using URationalValue = ValueType<URational>;
using ShortValue = ValueType<int16_t>;
using LongValue = ValueType<int32_t>;
using RationalValue = ValueType<Rational>;
using FloatValue = ValueType<float>;
using DoubleValue = ValueType<double>;
// *****************************************************************************
// free functions, template and inline definitions
template <typename T>
T getValue(const byte* buf, ByteOrder byteOrder);
// Specialization for a 2 byte unsigned short value.
template <>
inline uint16_t getValue(const byte* buf, ByteOrder byteOrder) {
return getUShort(buf, byteOrder);
}
// Specialization for a 4 byte unsigned long value.
template <>
inline uint32_t getValue(const byte* buf, ByteOrder byteOrder) {
return getULong(buf, byteOrder);
}
// Specialization for an 8 byte unsigned rational value.
template <>
inline URational getValue(const byte* buf, ByteOrder byteOrder) {
return getURational(buf, byteOrder);
}
// Specialization for a 2 byte signed short value.
template <>
inline int16_t getValue(const byte* buf, ByteOrder byteOrder) {
return getShort(buf, byteOrder);
}
// Specialization for a 4 byte signed long value.
template <>
inline int32_t getValue(const byte* buf, ByteOrder byteOrder) {
return getLong(buf, byteOrder);
}
// Specialization for an 8 byte signed rational value.
template <>
inline Rational getValue(const byte* buf, ByteOrder 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);
}
// Specialization for a 8 byte double value.
template <>
inline double getValue(const byte* buf, ByteOrder byteOrder) {
return getDouble(buf, byteOrder);
}
template <typename T>
size_t toData(byte* buf, T t, ByteOrder byteOrder);
template <>
inline size_t toData(byte* buf, uint16_t t, ByteOrder byteOrder) {
return us2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, uint32_t t, ByteOrder byteOrder) {
return ul2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, URational t, ByteOrder byteOrder) {
return ur2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, int16_t t, ByteOrder byteOrder) {
return s2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, int32_t t, ByteOrder byteOrder) {
return l2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, Rational t, ByteOrder byteOrder) {
return r2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, float t, ByteOrder byteOrder) {
return f2Data(buf, t, byteOrder);
}
template <>
inline size_t toData(byte* buf, double t, ByteOrder byteOrder) {
return d2Data(buf, t, byteOrder);
}
template <typename T>
ValueType<T>::ValueType() : Value(getType<T>()) {
}
template <typename T>
ValueType<T>::ValueType(const byte* buf, size_t len, ByteOrder byteOrder, TypeId typeId) : Value(typeId) {
read(buf, len, byteOrder);
}
template <typename T>
ValueType<T>::ValueType(const T& val, TypeId typeId) : Value(typeId) {
value_.push_back(val);
}
template <typename T>
ValueType<T>::ValueType(const ValueType<T>& rhs) :
Value(rhs.typeId()),
value_(rhs.value_)
{
if (rhs.sizeDataArea_ > 0) {
pDataArea_ = new byte[rhs.sizeDataArea_];
std::memcpy(pDataArea_, rhs.pDataArea_, rhs.sizeDataArea_);
sizeDataArea_ = rhs.sizeDataArea_;
}
}
template <typename T>
ValueType<T>::~ValueType() {
delete[] pDataArea_;
}
template <typename T>
ValueType<T>& ValueType<T>::operator=(const ValueType<T>& rhs) {
if (this == &rhs)
return *this;
Value::operator=(rhs);
value_ = rhs.value_;
byte* tmp = nullptr;
if (rhs.sizeDataArea_ > 0) {
tmp = new byte[rhs.sizeDataArea_];
std::memcpy(tmp, rhs.pDataArea_, rhs.sizeDataArea_);
}
delete[] pDataArea_;
pDataArea_ = tmp;
sizeDataArea_ = rhs.sizeDataArea_;
return *this;
}
template <typename T>
int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
value_.clear();
size_t ts = TypeInfo::typeSize(typeId());
if (ts > 0 && len % ts != 0)
len = (len / ts) * ts;
for (size_t i = 0; i < len; i += ts) {
value_.push_back(getValue<T>(buf + i, byteOrder));
}
return 0;
}
template <typename T>
int ValueType<T>::read(const std::string& buf) {
std::istringstream is(buf);
T tmp = T();
ValueList val;
while (!(is.eof())) {
is >> tmp;
if (is.fail())
return 1;
val.push_back(tmp);
}
value_.swap(val);
return 0;
}
template <typename T>
size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
size_t offset = 0;
for (auto i = value_.begin(); i != value_.end(); ++i) {
offset += toData(buf + offset, *i, byteOrder);
}
return offset;
}
template <typename T>
size_t ValueType<T>::count() const {
return value_.size();
}
template <typename T>
size_t ValueType<T>::size() const {
return TypeInfo::typeSize(typeId()) * value_.size();
}
template <typename T>
ValueType<T>* ValueType<T>::clone_() const {
return new ValueType<T>(*this);
}
template <typename T>
std::ostream& ValueType<T>::write(std::ostream& os) const {
auto end = value_.end();
auto i = value_.begin();
while (i != end) {
os << std::setprecision(15) << *i;
if (++i != end)
os << " ";
}
return os;
}
template <typename T>
std::string ValueType<T>::toString(size_t n) const {
ok_ = true;
return Exiv2::toString<T>(value_.at(n));
}
// Default implementation
template <typename T>
int64_t ValueType<T>::toInt64(size_t n) const {
ok_ = true;
return static_cast<int64_t>(value_.at(n));
}
template <typename T>
uint32_t ValueType<T>::toUint32(size_t n) const {
ok_ = true;
return static_cast<uint32_t>(value_.at(n));
}
// #55 crash when value_.at(n).first == LONG_MIN
#define LARGE_INT 1000000
// Specialization for double
template <>
inline int64_t ValueType<double>::toInt64(size_t n) const {
return float_to_integer_helper<int64_t>(n);
}
template <>
inline uint32_t ValueType<double>::toUint32(size_t n) const {
return float_to_integer_helper<uint32_t>(n);
}
// Specialization for float
template <>
inline int64_t ValueType<float>::toInt64(size_t n) const {
return float_to_integer_helper<int64_t>(n);
}
template <>
inline uint32_t ValueType<float>::toUint32(size_t n) const {
return float_to_integer_helper<uint32_t>(n);
}
// Specialization for rational
template <>
inline int64_t ValueType<Rational>::toInt64(size_t n) const {
return rational_to_integer_helper<int64_t>(n);
}
template <>
inline uint32_t ValueType<Rational>::toUint32(size_t n) const {
return rational_to_integer_helper<uint32_t>(n);
}
// Specialization for unsigned rational
template <>
inline int64_t ValueType<URational>::toInt64(size_t n) const {
return rational_to_integer_helper<int64_t>(n);
}
template <>
inline uint32_t ValueType<URational>::toUint32(size_t n) const {
return rational_to_integer_helper<uint32_t>(n);
}
// Default implementation
template <typename T>
float ValueType<T>::toFloat(size_t n) const {
ok_ = true;
return static_cast<float>(value_.at(n));
}
// Specialization for rational
template <>
inline float ValueType<Rational>::toFloat(size_t n) const {
ok_ = (value_.at(n).second != 0);
if (!ok_)
return 0.0f;
return static_cast<float>(value_.at(n).first) / value_.at(n).second;
}
// Specialization for unsigned rational
template <>
inline float ValueType<URational>::toFloat(size_t n) const {
ok_ = (value_.at(n).second != 0);
if (!ok_)
return 0.0f;
return static_cast<float>(value_.at(n).first) / value_.at(n).second;
}
// Default implementation
template <typename T>
Rational ValueType<T>::toRational(size_t n) const {
ok_ = true;
return {value_.at(n), 1};
}
// Specialization for rational
template <>
inline Rational ValueType<Rational>::toRational(size_t n) const {
ok_ = true;
return {value_.at(n).first, value_.at(n).second};
}
// Specialization for unsigned rational
template <>
inline Rational ValueType<URational>::toRational(size_t n) const {
ok_ = true;
return {value_.at(n).first, value_.at(n).second};
}
// Specialization for float.
template <>
inline Rational ValueType<float>::toRational(size_t n) const {
ok_ = true;
// Warning: This is a very simple conversion, see floatToRationalCast()
return floatToRationalCast(value_.at(n));
}
// Specialization for double.
template <>
inline Rational ValueType<double>::toRational(size_t n) const {
ok_ = true;
// Warning: This is a very simple conversion, see floatToRationalCast()
return floatToRationalCast(static_cast<float>(value_.at(n)));
}
template <typename T>
size_t ValueType<T>::sizeDataArea() const {
return sizeDataArea_;
}
template <typename T>
DataBuf ValueType<T>::dataArea() const {
return {pDataArea_, sizeDataArea_};
}
template <typename T>
int ValueType<T>::setDataArea(const byte* buf, size_t len) {
byte* tmp = nullptr;
if (len > 0) {
tmp = new byte[len];
std::memcpy(tmp, buf, len);
}
delete[] pDataArea_;
pDataArea_ = tmp;
sizeDataArea_ = len;
return 0;
}
} // namespace Exiv2
#endif // #ifndef VALUE_HPP_
Exiv2::AsciiValue
Value for an Ascii string type.
Definition value.hpp:412
Exiv2::AsciiValue::AsciiValue
AsciiValue()
Default constructor.
Definition value.cpp:237
Exiv2::AsciiValue::UniquePtr
std::unique_ptr< AsciiValue > UniquePtr
Shortcut for a AsciiValue auto pointer.
Definition value.hpp:415
Exiv2::AsciiValue::read
int read(const std::string &buf) override
Set the value to that of the string buf. Overrides base class to append a terminating '\0' character ...
Definition value.cpp:243
Exiv2::CommentValue::CharsetInfo
Charset information lookup functions. Implemented as a static class.
Definition value.hpp:475
Exiv2::CommentValue::CharsetInfo::name
static const char * name(CharsetId charsetId)
Return the name for a charset id.
Definition value.cpp:274
Exiv2::CommentValue::CharsetInfo::code
static const char * code(CharsetId charsetId)
Return the code for a charset id.
Definition value.cpp:278
Exiv2::CommentValue::CharsetInfo::charsetIdByName
static CharsetId charsetIdByName(const std::string &name)
Return the charset id for a name.
Definition value.cpp:282
Exiv2::CommentValue::CharsetInfo::charsetIdByCode
static CharsetId charsetIdByCode(const std::string &code)
Return the charset id for a code.
Definition value.cpp:289
Exiv2::CommentValue
Value for an Exif comment.
Definition value.hpp:463
Exiv2::CommentValue::UniquePtr
std::unique_ptr< CommentValue > UniquePtr
Shortcut for a CommentValue auto pointer.
Definition value.hpp:491
Exiv2::CommentValue::read
int read(const std::string &comment) override
Read the value from a comment.
Definition value.cpp:303
Exiv2::CommentValue::CommentValue
CommentValue()
Default constructor.
Definition value.cpp:296
Exiv2::CommentValue::charsetId
CharsetId charsetId() const
Return the Exif charset id of the comment.
Definition value.cpp:385
Exiv2::CommentValue::byteOrder_
ByteOrder byteOrder_
Byte order of the comment string that was read.
Definition value.hpp:565
Exiv2::CommentValue::comment
std::string comment(const char *encoding=nullptr) const
Return the comment (without a charset="..." prefix).
Definition value.cpp:364
Exiv2::CommentValue::CharsetId
CharsetId
Character set identifiers for the character sets defined by Exif.
Definition value.hpp:466
Exiv2::DataValue
Value for an undefined data type.
Definition value.hpp:247
Exiv2::DataValue::value_
ValueType value_
Stores the data value.
Definition value.hpp:305
Exiv2::DataValue::ValueType
std::vector< byte > ValueType
Type used to store the data.
Definition value.hpp:303
Exiv2::DataValue::UniquePtr
std::unique_ptr< DataValue > UniquePtr
Shortcut for a DataValue auto pointer.
Definition value.hpp:250
Exiv2::DataValue::read
int read(const byte *buf, size_t len, ByteOrder byteOrder=invalidByteOrder) override
Read the value from a character buffer.
Definition value.cpp:102
Exiv2::DateValue
Value for simple ISO 8601 dates
Definition value.hpp:901
Exiv2::DateValue::UniquePtr
std::unique_ptr< DateValue > UniquePtr
Shortcut for a DateValue auto pointer.
Definition value.hpp:904
Exiv2::DateValue::DateValue
DateValue()
Default constructor.
Definition value.cpp:746
Exiv2::DateValue::read
int read(const byte *buf, size_t len, ByteOrder byteOrder=invalidByteOrder) override
Definition value.cpp:754
Exiv2::DateValue::setDate
void setDate(const Date &src)
Set the date.
Definition value.cpp:813
Exiv2::LangAltValue::toString
std::string toString(size_t n) const override
Return the text value associated with the default language qualifier x-default. The parameter n is no...
Definition value.cpp:709
Exiv2::LangAltValue::ValueType
std::map< std::string, std::string, LangAltValueComparator > ValueType
Type used to store language alternative arrays.
Definition value.hpp:885
Exiv2::LangAltValue::toFloat
float toFloat(size_t n=0) const override
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition value.cpp:732
Exiv2::LangAltValue::count
size_t count() const override
Return the number of components of the value.
Definition value.cpp:684
Exiv2::LangAltValue::toUint32
uint32_t toUint32(size_t n=0) const override
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition value.cpp:727
Exiv2::LangAltValue::UniquePtr
std::unique_ptr< LangAltValue > UniquePtr
Shortcut for a LangAltValue auto pointer.
Definition value.hpp:815
Exiv2::LangAltValue::LangAltValue
LangAltValue()
Constructor.
Definition value.cpp:630
Exiv2::LangAltValue::read
int read(const std::string &buf) override
Read a simple property value from buf and append it to the value.
Definition value.cpp:637
Exiv2::LangAltValue::value_
ValueType value_
Map to store the language alternative values. The language qualifier is used as the key for the map e...
Definition value.hpp:891
Exiv2::LangAltValue::write
std::ostream & write(std::ostream &os) const override
Write all elements of the value to os, separated by commas.
Definition value.cpp:688
Exiv2::LangAltValue::toInt64
int64_t toInt64(size_t n=0) const override
Convert the n-th component of the value to an int64_t. The behaviour of this method may be undefined ...
Definition value.cpp:722
Exiv2::LangAltValue::toRational
Rational toRational(size_t n=0) const override
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition value.cpp:737
Exiv2::StringValueBase::clone_
StringValueBase * clone_() const override=0
Internal virtual copy constructor.
Exiv2::StringValueBase::UniquePtr
std::unique_ptr< StringValueBase > UniquePtr
Shortcut for a StringValueBase auto pointer.
Definition value.hpp:320
Exiv2::StringValueBase::value_
std::string value_
Stores the string value.
Definition value.hpp:369
Exiv2::StringValueBase::StringValueBase
StringValueBase(TypeId typeId, const std::string &buf)
Constructor for subclasses.
Definition value.cpp:172
Exiv2::StringValueBase::read
int read(const std::string &buf) override
Read the value from buf. This default implementation uses buf as it is.
Definition value.cpp:176
Exiv2::StringValue
Value for string type.
Definition value.hpp:380
Exiv2::StringValue::UniquePtr
std::unique_ptr< StringValue > UniquePtr
Shortcut for a StringValue auto pointer.
Definition value.hpp:383
Exiv2::StringValue::StringValue
StringValue()
Default constructor.
Definition value.cpp:227
Exiv2::TimeValue
Value for simple ISO 8601 times.
Definition value.hpp:992
Exiv2::TimeValue::read
int read(const byte *buf, size_t len, ByteOrder byteOrder=invalidByteOrder) override
Definition value.cpp:895
Exiv2::TimeValue::UniquePtr
std::unique_ptr< TimeValue > UniquePtr
Shortcut for a TimeValue auto pointer.
Definition value.hpp:995
Exiv2::TimeValue::setTime
void setTime(const Time &src)
Set the time.
Definition value.cpp:985
Exiv2::TimeValue::TimeValue
TimeValue()
Default constructor.
Definition value.cpp:887
Exiv2::TypeInfo::typeSize
static size_t typeSize(TypeId typeId)
Return the size in bytes of one element of this type.
Definition types.cpp:87
Exiv2::ValueType
Template for a Value of a basic type. This is used for unsigned and signed short, long and rationals.
Definition value.hpp:1132
Exiv2::ValueType::toFloat
float toFloat(size_t n=0) const override
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition value.hpp:1623
Exiv2::ValueType::toString
std::string toString(size_t n) const override
Return the n-th component of the value as a string. The behaviour of this method may be undefined if ...
Definition value.hpp:1566
Exiv2::ValueType::operator=
ValueType< T > & operator=(const ValueType< T > &rhs)
Assignment operator.
Definition value.hpp:1484
Exiv2::ValueType::const_iterator
typename std::vector< T >::const_iterator const_iterator
Const iterator type defined for convenience.
Definition value.hpp:1206
Exiv2::ValueType::ValueType
ValueType(const T &val, TypeId typeId=getType< T >())
Constructor.
Definition value.hpp:1461
Exiv2::ValueType::toRational
Rational toRational(size_t n=0) const override
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition value.hpp:1645
Exiv2::ValueType::dataArea
DataBuf dataArea() const override
Return a copy of the data area in a DataBuf. The caller owns this copy and DataBuf ensures that it wi...
Definition value.hpp:1682
Exiv2::ValueType::ValueList
std::vector< T > ValueList
Container for values.
Definition value.hpp:1202
Exiv2::ValueType::count
size_t count() const override
Return the number of components of the value.
Definition value.hpp:1539
Exiv2::ValueType::ValueType
ValueType(const ValueType< T > &rhs)
Copy constructor.
Definition value.hpp:1466
Exiv2::ValueType::ValueType
ValueType(const byte *buf, size_t len, ByteOrder byteOrder, TypeId typeId=getType< T >())
Constructor.
Definition value.hpp:1456
Exiv2::ValueType::ValueType
ValueType()
Default Constructor.
Definition value.hpp:1452
Exiv2::ValueType::~ValueType
~ValueType() override
Virtual destructor.
Definition value.hpp:1479
Exiv2::ValueType::size
size_t size() const override
Return the size of the value in bytes.
Definition value.hpp:1544
Exiv2::ValueType::toUint32
uint32_t toUint32(size_t n=0) const override
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition value.hpp:1578
Exiv2::ValueType::read
int read(const std::string &buf) override
Set the data from a string of values of type T (e.g., "0 1 2 3" or "1/2 1/3 1/4" depending on what T ...
Definition value.hpp:1515
Exiv2::ValueType::UniquePtr
std::unique_ptr< ValueType< T > > UniquePtr
Shortcut for a ValueType<T> auto pointer.
Definition value.hpp:1137
Exiv2::ValueType::setDataArea
int setDataArea(const byte *buf, size_t len) override
Set the data area. This method copies (clones) the buffer pointed to by buf.
Definition value.hpp:1687
Exiv2::ValueType::copy
size_t copy(byte *buf, ByteOrder byteOrder) const override
Write value to a data buffer.
Definition value.hpp:1530
Exiv2::ValueType::sizeDataArea
size_t sizeDataArea() const override
Return the size of the data area.
Definition value.hpp:1677
Exiv2::ValueType::iterator
typename std::vector< T >::iterator iterator
Iterator type defined for convenience.
Definition value.hpp:1204
Exiv2::ValueType< uint16_t >::value_
ValueList value_
Definition value.hpp:1215
Exiv2::ValueType::write
std::ostream & write(std::ostream &os) const override
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition value.hpp:1554
Exiv2::ValueType::read
int read(const byte *buf, size_t len, ByteOrder byteOrder) override
Read the value from a character buffer.
Definition value.hpp:1503
Exiv2::ValueType::toInt64
int64_t toInt64(size_t n=0) const override
Convert the n-th component of the value to an int64_t. The behaviour of this method may be undefined ...
Definition value.hpp:1573
Exiv2::Value
Common interface for all types of values used with metadata.
Definition value.hpp:33
Exiv2::Value::typeId
TypeId typeId() const
Return the type identifier (Exif data format type).
Definition value.hpp:85
Exiv2::Value::~Value
virtual ~Value()=default
Virtual destructor.
Exiv2::Value::write
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...
Exiv2::Value::count
virtual size_t count() const =0
Return the number of components of the value.
Exiv2::Value::read
virtual int read(const std::string &buf)=0
Set the value from a string buffer. The format of the string corresponds to that of the write() metho...
Exiv2::Value::read
virtual int read(const byte *buf, size_t len, ByteOrder byteOrder)=0
Read the value from a character buffer.
Exiv2::Value::ok_
bool ok_
Indicates the status of the previous to<Type> conversion.
Definition value.hpp:232
Exiv2::Value::ok
bool ok() const
Check the ok status indicator. After a to<Type> conversion, this indicator shows whether the conversi...
Definition value.hpp:181
Exiv2::Value::toString
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:72
Exiv2::Value::toFloat
virtual float toFloat(size_t n=0) const =0
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Exiv2::Value::toRational
virtual Rational toRational(size_t n=0) const =0
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Exiv2::Value::toUint32
virtual uint32_t toUint32(size_t n=0) const =0
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Exiv2::Value::size
virtual size_t size() const =0
Return the size of the value in bytes.
Exiv2::Value::copy
virtual size_t copy(byte *buf, ByteOrder byteOrder) const =0
Write value to a data buffer.
Exiv2::Value::setDataArea
virtual int setDataArea(const byte *buf, size_t len)
Set the data area, if the value has one by copying (cloning) the buffer pointed to by buf.
Definition value.cpp:68
Exiv2::Value::Value
Value(TypeId typeId)
Constructor, taking a type id to initialize the base class with.
Definition value.cpp:17
Exiv2::Value::toInt64
virtual int64_t toInt64(size_t n=0) const =0
Convert the n-th component of the value to an int64_t. The behaviour of this method may be undefined ...
Exiv2::Value::operator=
Value & operator=(const Value &)=default
Assignment operator. Protected so that it can only be used by subclasses but not directly.
Exiv2::Value::UniquePtr
std::unique_ptr< Value > UniquePtr
Shortcut for a Value auto pointer.
Definition value.hpp:36
Exiv2::Value::sizeDataArea
virtual size_t sizeDataArea() const
Return the size of the data area, 0 if there is none.
Definition value.cpp:83
Exiv2::Value::dataArea
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:87
Exiv2::Value::clone
UniquePtr 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:93
Exiv2::XmpArrayValue::XmpArrayValue
XmpArrayValue(TypeId typeId=xmpBag)
Constructor. typeId can be one of xmpBag, xmpSeq or xmpAlt.
Definition value.cpp:578
Exiv2::XmpArrayValue::toUint32
uint32_t toUint32(size_t n=0) const override
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition value.cpp:614
Exiv2::XmpArrayValue::toFloat
float toFloat(size_t n=0) const override
Convert the n-th component of the value to a float. The behaviour of this method may be undefined if ...
Definition value.cpp:618
Exiv2::XmpArrayValue::toRational
Rational toRational(size_t n=0) const override
Convert the n-th component of the value to a Rational. The behaviour of this method may be undefined ...
Definition value.cpp:622
Exiv2::XmpArrayValue::UniquePtr
std::unique_ptr< XmpArrayValue > UniquePtr
Shortcut for a XmpArrayValue auto pointer.
Definition value.hpp:731
Exiv2::XmpArrayValue::toString
std::string toString(size_t n) const override
Return the n-th component of the value as a string. The behaviour of this method may be undefined if ...
Definition value.cpp:605
Exiv2::XmpArrayValue::toInt64
int64_t toInt64(size_t n=0) const override
Convert the n-th component of the value to an int64_t. The behaviour of this method may be undefined ...
Definition value.cpp:610
Exiv2::XmpArrayValue::write
std::ostream & write(std::ostream &os) const override
Write all elements of the value to os, separated by commas.
Definition value.cpp:596
Exiv2::XmpArrayValue::read
int read(const std::string &buf) override
Read a simple property value from buf and append it to the value.
Definition value.cpp:582
Exiv2::XmpArrayValue::count
size_t count() const override
Return the number of components of the value.
Definition value.cpp:592
Exiv2::XmpTextValue::count
size_t count() const override
Return the number of components of the value.
Definition value.cpp:522
Exiv2::XmpTextValue::UniquePtr
std::unique_ptr< XmpTextValue > UniquePtr
Shortcut for a XmpTextValue auto pointer.
Definition value.hpp:642
Exiv2::XmpTextValue::XmpTextValue
XmpTextValue()
Constructor.
Definition value.cpp:472
Exiv2::XmpTextValue::read
int read(const std::string &buf) override
Read a simple property value from buf to set the value.
Definition value.cpp:479
Exiv2::XmpTextValue::write
std::ostream & write(std::ostream &os) const override
Write the value to an output stream. You do not usually have to use this function; it is used for the...
Definition value.cpp:526
Exiv2::XmpTextValue::size
size_t size() const override
Return the size of the value in bytes.
Definition value.cpp:516
Exiv2::XmpTextValue::toInt64
int64_t toInt64(size_t n=0) const override
Convert the value to an int64_t. The optional parameter n is not used and is ignored.
Definition value.cpp:558
Exiv2::XmpTextValue::toFloat
float toFloat(size_t n=0) const override
Convert the value to a float. The optional parameter n is not used and is ignored.
Definition value.cpp:566
Exiv2::XmpTextValue::toRational
Rational toRational(size_t n=0) const override
Convert the value to a Rational. The optional parameter n is not used and is ignored.
Definition value.cpp:570
Exiv2::XmpTextValue::value_
std::string value_
Stores the string values.
Definition value.hpp:715
Exiv2::XmpTextValue::toUint32
uint32_t toUint32(size_t n=0) const override
Convert the value to an uint32_t. The optional parameter n is not used and is ignored.
Definition value.cpp:562
Exiv2::XmpValue
Base class for all Exiv2 values used to store XMP property values.
Definition value.hpp:572
Exiv2::XmpValue::read
int read(const std::string &buf) override=0
Set the value from a string buffer. The format of the string corresponds to that of the write() metho...
Exiv2::XmpValue::XmpStruct
XmpStruct
XMP structure indicator.
Definition value.hpp:582
Exiv2::XmpValue::UniquePtr
std::unique_ptr< XmpValue > UniquePtr
Shortcut for a XmpValue auto pointer.
Definition value.hpp:577
Exiv2::XmpValue::xmpArrayType
XmpArrayType xmpArrayType() const
Return XMP array type, indicates if an XMP value is an array.
Definition value.cpp:426
Exiv2::XmpValue::XmpArrayType
XmpArrayType
XMP array types.
Definition value.hpp:580
Exiv2::XmpValue::read
int read(const byte *buf, size_t len, ByteOrder byteOrder=invalidByteOrder) override
Definition value.cpp:461
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::operator<<
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition datasets.cpp:590
Exiv2::getDouble
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:312
Exiv2::getType< int32_t >
TypeId getType< int32_t >()
Specialization for a signed long.
Definition value.hpp:1105
Exiv2::ul2Data
EXIV2API size_t 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:346
Exiv2::getFloat
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:300
Exiv2::getType< int16_t >
TypeId getType< int16_t >()
Specialization for a signed short.
Definition value.hpp:1100
Exiv2::toData
size_t toData(byte *buf, T t, ByteOrder byteOrder)
Convert a value of type T to data, write the data to the data buffer.
Exiv2::d2Data
EXIV2API size_t 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:426
Exiv2::ShortValue
ValueType< int16_t > ShortValue
Signed short value type.
Definition value.hpp:1305
Exiv2::floatToRationalCast
EXIV2API Rational floatToRationalCast(float f)
Very simple conversion of a float to a Rational.
Definition types.cpp:611
Exiv2::f2Data
EXIV2API size_t 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:414
Exiv2::getShort
EXIV2API int16_t getShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte signed short value from the data buffer.
Definition types.cpp:280
Exiv2::URationalValue
ValueType< URational > URationalValue
Unsigned rational value type.
Definition value.hpp:1303
Exiv2::getType< uint32_t >
TypeId getType< uint32_t >()
Specialization for an unsigned long.
Definition value.hpp:1090
Exiv2::getULong
EXIV2API uint32_t getULong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte unsigned long value from the data buffer.
Definition types.cpp:254
Exiv2::getValue
T getValue(const byte *buf, ByteOrder byteOrder)
Read a value of type T from the data buffer.
Exiv2::TypeId
TypeId
Exiv2 value type identifiers.
Definition types.hpp:70
Exiv2::unsignedShort
@ unsignedShort
Exif SHORT type, 16-bit (2-byte) unsigned integer.
Definition types.hpp:73
Exiv2::signedRational
@ signedRational
Exif SRATIONAL type, two SLONGs: numerator and denominator of a fraction.
Definition types.hpp:80
Exiv2::unsignedLong
@ unsignedLong
Exif LONG type, 32-bit (4-byte) unsigned integer.
Definition types.hpp:74
Exiv2::signedShort
@ signedShort
Exif SSHORT type, a 16-bit (2-byte) signed (twos-complement) integer.
Definition types.hpp:78
Exiv2::signedLong
@ signedLong
Exif SLONG type, a 32-bit (4-byte) signed (twos-complement) integer.
Definition types.hpp:79
Exiv2::comment
@ comment
Exiv2 type for the Exif user comment.
Definition types.hpp:90
Exiv2::tiffDouble
@ tiffDouble
TIFF DOUBLE type, double precision (8-byte) IEEE format.
Definition types.hpp:82
Exiv2::undefined
@ undefined
Exif UNDEFINED type, an 8-bit byte that may contain anything.
Definition types.hpp:77
Exiv2::xmpBag
@ xmpBag
XMP bag type.
Definition types.hpp:94
Exiv2::tiffFloat
@ tiffFloat
TIFF FLOAT type, single precision (4-byte) IEEE format.
Definition types.hpp:81
Exiv2::unsignedRational
@ unsignedRational
Exif RATIONAL type, two LONGs: numerator and denominator of a fraction.
Definition types.hpp:75
Exiv2::Rational
std::pair< int32_t, int32_t > Rational
8 byte signed rational type.
Definition types.hpp:31
Exiv2::getUShort
EXIV2API uint16_t getUShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte unsigned short value from the data buffer.
Definition types.cpp:250
Exiv2::ur2Data
EXIV2API size_t 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:376
Exiv2::s2Data
EXIV2API size_t 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:382
Exiv2::FloatValue
ValueType< float > FloatValue
Float value type.
Definition value.hpp:1311
Exiv2::ByteOrder
ByteOrder
Type to express the byte order (little or big endian).
Definition types.hpp:34
Exiv2::getType< uint16_t >
TypeId getType< uint16_t >()
Specialization for an unsigned short.
Definition value.hpp:1085
Exiv2::l2Data
EXIV2API size_t 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:393
Exiv2::getRational
EXIV2API Rational getRational(const byte *buf, ByteOrder byteOrder)
Read an 8 byte signed rational value from the data buffer.
Definition types.cpp:294
Exiv2::r2Data
EXIV2API size_t 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:408
Exiv2::DoubleValue
ValueType< double > DoubleValue
Double value type.
Definition value.hpp:1313
Exiv2::getType< URational >
TypeId getType< URational >()
Specialization for an unsigned rational.
Definition value.hpp:1095
Exiv2::getType< float >
TypeId getType< float >()
Specialization for a float.
Definition value.hpp:1115
Exiv2::UShortValue
ValueType< uint16_t > UShortValue
Unsigned short value type.
Definition value.hpp:1299
Exiv2::getLong
EXIV2API int32_t getLong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte signed long value from the data buffer.
Definition types.cpp:287
Exiv2::getType< Rational >
TypeId getType< Rational >()
Specialization for a signed rational.
Definition value.hpp:1110
Exiv2::getType< double >
TypeId getType< double >()
Specialization for a double.
Definition value.hpp:1120
Exiv2::getType
TypeId getType()
Template to determine the TypeId for a type T.
Exiv2::getURational
EXIV2API URational getURational(const byte *buf, ByteOrder byteOrder)
Read an 8 byte unsigned rational value from the data buffer.
Definition types.cpp:274
Exiv2::us2Data
EXIV2API size_t 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:335
Exiv2::RationalValue
ValueType< Rational > RationalValue
Signed rational value type.
Definition value.hpp:1309
Exiv2::URational
std::pair< uint32_t, uint32_t > URational
8 byte unsigned rational type.
Definition types.hpp:29
Exiv2::ULongValue
ValueType< uint32_t > ULongValue
Unsigned long value type.
Definition value.hpp:1301
Exiv2::LongValue
ValueType< int32_t > LongValue
Signed long value type.
Definition value.hpp:1307
Exiv2::CommentValue::CharsetTable
Information pertaining to the defined character sets.
Definition value.hpp:468
Exiv2::CommentValue::CharsetTable::charsetId_
CharsetId charsetId_
Charset id.
Definition value.hpp:469
Exiv2::CommentValue::CharsetTable::name_
const char * name_
Name of the charset.
Definition value.hpp:470
Exiv2::CommentValue::CharsetTable::code_
const char * code_
Code of the charset.
Definition value.hpp:471
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Exiv2::DateValue::Date
Simple Date helper structure.
Definition value.hpp:915
Exiv2::DateValue::Date::month
int32_t month
Month.
Definition value.hpp:917
Exiv2::DateValue::Date::day
int32_t day
Day.
Definition value.hpp:918
Exiv2::DateValue::Date::year
int32_t year
Year.
Definition value.hpp:916
Exiv2::LangAltValueComparator
LangAltValueComparator
Definition value.hpp:793
Exiv2::LangAltValueComparator::operator()
bool operator()(const std::string &str1, const std::string &str2) const
LangAltValueComparator comparison case insensitive function.
Definition value.hpp:795
Exiv2::TimeValue::Time
Simple Time helper structure.
Definition value.hpp:1006
Exiv2::TimeValue::Time::hour
int32_t hour
Hour.
Definition value.hpp:1007
Exiv2::TimeValue::Time::tzMinute
int32_t tzMinute
Minutes ahead or behind UTC.
Definition value.hpp:1011
Exiv2::TimeValue::Time::minute
int32_t minute
Minute.
Definition value.hpp:1008
Exiv2::TimeValue::Time::second
int32_t second
Second.
Definition value.hpp:1009
Exiv2::TimeValue::Time::tzHour
int32_t tzHour
Hours ahead or behind UTC.
Definition value.hpp:1010