wavelength 1.0.0
Loading...
Searching...
No Matches
filestream.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "os/binstream.h"
6#include "os/file.h"
7
14class FileStream : public BinStream {
15public:
26 FileStream(const char *pszPath, bool bWrite, bool bLittleEndian, int nFlags);
27
34 ~FileStream() override;
35
44#ifdef VIDEO_STANDARD_PAL
45 void ReadImpl(void *pData, int nBytes) override;
46#else
47 void Read(void *pData, int nBytes) override;
48#endif
49
58#ifdef VIDEO_STANDARD_PAL
59 void WriteImpl(const void *pData, int nBytes) override;
60#else
61 void Write(const void *pData, int nBytes) override;
62#endif
63
70 void Flush() override;
71
80#ifdef VIDEO_STANDARD_PAL
81 void SeekImpl(int nOffset, SeekType eFrom) override;
82#else
83 void Seek(int nOffset, SeekType eFrom) override;
84#endif
85
93 int Tell() override;
94
102 bool Eof() override;
103
111 bool Fail() override;
112
114 File *GetFile() const {
115 return mFile.get();
116 }
117
118private:
119 std::unique_ptr<File> mFile;
120 int mFail;
121};
SeekType
Origins of Seek().
Definition binstream.h:25
BinStream(bool bLittleEndian)
Construct a stream.
Definition binstream.h:38
void Write(const void *pData, int nBytes) override
Write bytes, recording a failure when fewer are written.
void Flush() override
Write out buffered data.
void Seek(int nOffset, SeekType eFrom) override
Move the position.
File * GetFile() const
Definition filestream.h:114
~FileStream() override
Close the file.
bool Eof() override
Report whether the position is at the end.
int Tell() override
Report the position.
void Read(void *pData, int nBytes) override
Read bytes, recording a failure when fewer arrive.
FileStream(const char *pszPath, bool bWrite, bool bLittleEndian, int nFlags)
Open a file.
bool Fail() override
Report whether an operation failed.
Open file of the host or the disc.
Definition file.h:29