22 #include "rawfile.hpp"
23 #include "metadata.hpp"
27 MetadataIterator::MetadataIterator(RawFile& rf)
28 : m_is_initialized(false)
32 auto ifd = rf.mainIfd();
34 m_ifds.push_back(ifd);
35 auto subifds = ifd->getSubIFDs();
37 auto v = subifds.value();
38 m_ifds.insert(m_ifds.end(), v.begin(), v.end());
43 m_ifds.push_back(ifd);
45 ifd = rf.makerNoteIfd();
47 m_ifds.push_back(ifd);
51 Internals::IfdDir::Ref MetadataIterator::nextIfd()
53 m_is_initialized =
true;
54 if (m_ifds.size() <= m_next_ifd) {
55 return Internals::IfdDir::Ref();
57 auto ifd = m_ifds[m_next_ifd];
59 m_current_entry = ifd->entries().begin();
60 if (m_current_entry == ifd->entries().end()) {
61 LOGWARN(
"IFD is empty\n");
67 bool MetadataIterator::next()
70 LOGDBG1(
"Invalid iterator\n");
77 if (m_current_entry != m_current_ifd->entries().end()) {
80 if (m_current_entry == m_current_ifd->entries().end()) {
81 LOGDBG1(
"end of IFD, moving on\n");
82 m_current_ifd = nextIfd();
85 m_current_ifd = nextIfd();
89 LOGDBG1(
"no more current ifd\n");
99 if (!(isInitialized() && isValid())) {
102 return m_current_ifd;
108 if (!(isInitialized() && isValid())) {
111 return static_cast<ExifTagType>(m_current_entry->second->type());
117 if (!(isInitialized() && isValid())) {
120 return m_current_entry->first;
123 MetaValue* MetadataIterator::getMetaValue()
const
125 if (!(isInitialized() && isValid())) {
128 return m_current_ifd->makeMetaValue(*(m_current_entry->second));
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Tag class to help create an empty Option.
An option type inspired by Rust.
Global namespace for libopenraw.