From 593d7ac3a2a3c916eda486352bbcc25c4aede678 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Nov 2010 23:29:09 +0100 Subject: rawfile.h/cpp: add virtual baseclass for data sources (iDataSource) let eRawFile inherit from iDataSource --- lib/base/rawfile.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/base/rawfile.cpp') diff --git a/lib/base/rawfile.cpp b/lib/base/rawfile.cpp index c7e11feb..1552203a 100644 --- a/lib/base/rawfile.cpp +++ b/lib/base/rawfile.cpp @@ -4,7 +4,10 @@ #include #include +DEFINE_REF(eRawFile); + eRawFile::eRawFile() + :m_lock(true) { m_fd = -1; m_file = 0; @@ -232,3 +235,20 @@ off_t eRawFile::length() { return m_totallength; } + +off_t eRawFile::position() +{ + if (m_nrfiles < 2) + { + if (!m_cached) + return ::lseek(m_fd, 0, SEEK_CUR); + else + return ::fseeko(m_file, 0, SEEK_CUR); + } + return m_current_offset; +} + +eSingleLock &eRawFile::getLock() +{ + return m_lock; +} -- cgit v1.2.3