Write
};
struct Offset {
- Offset()
- : chunk(0),
- offsetInChunk(0)
+ Offset(uint64_t _chunk = 0, uint32_t _offsetInChunk = 0)
+ : chunk(_chunk),
+ offsetInChunk(_offsetInChunk)
{}
uint64_t chunk;
uint32_t offsetInChunk;
bool isOpened() const;
File::Mode mode() const;
- std::string filename() const;
-
bool open(const std::string &filename, File::Mode mode);
bool write(const void *buffer, size_t length);
bool read(void *buffer, size_t length);
int percentRead();
virtual bool supportsOffsets() const = 0;
- virtual File::Offset currentOffset();
+ virtual File::Offset currentOffset() = 0;
virtual void setCurrentOffset(const File::Offset &offset);
protected:
virtual bool rawOpen(const std::string &filename, File::Mode mode) = 0;
virtual int rawPercentRead() = 0;
protected:
- std::string m_filename;
File::Mode m_mode;
bool m_isOpened;
};
return m_mode;
}
-inline std::string File::filename() const
-{
- return m_filename;
-}
-
inline bool File::open(const std::string &filename, File::Mode mode)
{
if (m_isOpened) {
virtual bool supportsOffsets() const;
+ virtual File::Offset currentOffset();
protected:
virtual bool rawOpen(const std::string &filename, File::Mode mode);
virtual bool rawWrite(const void *buffer, size_t length);