26 #include "io/stream.hpp"
27 #include "libopenraw/consts.h"
29 #include "streamclone.hpp"
37 :
Stream(clone->get_path().c_str()),
38 m_cloned(clone), m_offset(offset)
43 StreamClone::~StreamClone()
50 if (m_cloned == NULL) {
54 m_cloned->seek(m_offset, SEEK_SET);
70 if (m_cloned == NULL) {
74 if (whence == SEEK_SET) {
77 int new_pos = m_cloned->seek(offset, whence);
85 if (m_cloned == NULL) {
89 return m_cloned->read(buf, count);
95 if (m_cloned == NULL) {
99 return m_cloned->filesize() - m_offset;
virtual Error open() override
open the file
virtual int read(void *buf, size_t count) override
read in the file. Semantics are similar to POSIX read()
virtual int close() override
close the file
virtual int seek(off_t offset, int whence) override
seek in the file. Semantics are similar to POSIX lseek()
StreamClone(const Stream::Ptr &clone, off_t offset)
virtual off_t filesize() override
Return the filesize.
base virtual class for IO
std::shared_ptr< Stream > Ptr
void set_error(Error error)
Set the error. This is calld by implementations.
or_error
Error codes returned by libopenraw.
Global namespace for libopenraw.