25 #include <libopenraw/consts.h>
26 #include <libopenraw/debug.h>
28 #include "memstream.hpp"
31 using namespace Debug;
36 MemStream::MemStream(
const uint8_t* ptr,
size_t s)
62 if (m_current ==
nullptr) {
69 m_current = m_ptr + offset;
73 m_current = m_ptr + m_size + offset;
74 newpos = m_size + offset;
78 newpos = (m_current - m_ptr);
90 if ((m_current ==
nullptr) || (m_ptr ==
nullptr)) {
91 LOGDBG1(
"MemStream::failed\n");
95 const uint8_t* end = m_ptr + m_size;
96 if ((off_t)count > (end - m_current)) {
97 count = end - m_current;
100 memcpy(buf, m_current, count);
virtual int close() override
close the file
virtual off_t filesize() override
Return the filesize.
virtual int read(void *buf, size_t count) override
read in the file. Semantics are similar to POSIX read()
virtual or_error open() override
open the file
virtual int seek(off_t offset, int whence) override
seek in the file. Semantics are similar to POSIX lseek()
base virtual class for IO
or_error
Error codes returned by libopenraw.
Global namespace for libopenraw.