26 #include <sys/types.h>
33 #include "exception.hpp"
35 #include "endianutils.hpp"
36 #include "rawcontainer.hpp"
56 static const uint16_t
type;
58 static T EL(
const uint8_t* d,
size_t len) noexcept;
59 static T BE(
const uint8_t* d,
size_t len) noexcept;
70 inline uint8_t IfdTypeTrait<uint8_t>::BE(
const uint8_t* b,
size_t) noexcept
76 inline int8_t IfdTypeTrait<int8_t>::EL(
const uint8_t* b,
size_t) noexcept
82 inline int8_t IfdTypeTrait<int8_t>::BE(
const uint8_t* b,
size_t) noexcept
88 inline uint16_t IfdTypeTrait<uint16_t>::EL(
const uint8_t* b,
size_t) noexcept
94 inline uint16_t IfdTypeTrait<uint16_t>::BE(
const uint8_t* b,
size_t) noexcept
100 inline int16_t IfdTypeTrait<int16_t>::EL(
const uint8_t* b,
size_t) noexcept
102 uint16_t uns = EL16(b);
103 return *(int16_t*)&uns;
107 inline int16_t IfdTypeTrait<int16_t>::BE(
const uint8_t* b,
size_t) noexcept
109 uint16_t uns = BE16(b);
110 return *(int16_t*)&uns;
114 inline uint32_t IfdTypeTrait<uint32_t>::EL(
const uint8_t* b,
size_t) noexcept
120 inline uint32_t IfdTypeTrait<uint32_t>::BE(
const uint8_t* b,
size_t) noexcept
126 inline int32_t IfdTypeTrait<int32_t>::EL(
const uint8_t* b,
size_t) noexcept
132 inline int32_t IfdTypeTrait<int32_t>::BE(
const uint8_t* b,
size_t) noexcept
138 inline std::string IfdTypeTrait<std::string>::EL(
const uint8_t* b,
size_t len) noexcept
142 s.assign((
const char*)b, strnlen((
const char*)b, len));
150 inline std::string IfdTypeTrait<std::string>::BE(
const uint8_t* b,
size_t len) noexcept
154 s.assign((
const char*)b, strnlen((
const char*)b, len));
162 inline IFD::ORRational IfdTypeTrait<IFD::ORRational>::EL(
const uint8_t* b,
size_t) noexcept
166 r.denom = EL32(b + 4);
171 inline IFD::ORRational IfdTypeTrait<IFD::ORRational>::BE(
const uint8_t* b,
size_t) noexcept
175 r.denom = BE32(b + 4);
180 inline IFD::ORSRational IfdTypeTrait<IFD::ORSRational>::EL(
const uint8_t* b,
size_t) noexcept
184 r.denom = EL32(b + 4);
189 inline IFD::ORSRational IfdTypeTrait<IFD::ORSRational>::BE(
const uint8_t* b,
size_t) noexcept
193 r.denom = BE32(b + 4);
202 typedef std::shared_ptr<IfdEntry>
Ref;
204 IfdEntry(uint16_t _id, int16_t _type, int32_t _count, uint32_t _data,
205 const IfdDir& _dir,
bool synthetic =
false);
209 int16_t
id() const noexcept
246 if (m_dataptr ==
nullptr) {
247 return (uint8_t*)&m_data;
void setData(const uint8_t *dataptr, size_t data_size)
Set the data of the entry.
size_t loadDataInto(uint8_t *dataptr, size_t data_size, off_t offset) const
Load data into a buffer.
int16_t id() const noexcept
id (i.e. tag) of the entry
int16_t type() const noexcept
Type of the entry data.
uint32_t count() const noexcept
The count of items in the entry.
static size_t typeUnitSize(IFD::ExifTagType _type)
Unit size for type.
std::shared_ptr< IfdEntry > Ref
IfdEntry reference (ie shared pointer)
const uint8_t * dataptr() const
Return the raw data pointer.
RawContainer::EndianType endian() const
Get the endian from the owning IfdDir.
bool loadData(size_t unit_size, off_t offset)
Load the data for the entry if m_loaded is false.
off_t offset() noexcept
The offset of the data.
EndianType
Define the endian of the container.
Global namespace for libopenraw.
static const uint16_t type