|
Worldstone
|
Wrapper around POSIX file io, same as ifstream but without iostream formatting. More...
#include <FileStream.h>
Public Member Functions | |
| FileStream (const Path &filename) | |
| bool | open (const Path &filename) |
| bool | is_open () const |
| bool | close () |
| long | tell () override |
| Return the current position of the stream pointer. More... | |
| bool | seek (long offset, seekdir origin) override |
| Change the pointer of the stream to a given position. More... | |
| long | size () override |
| Computes the size of the file. More... | |
| size_t | read (void *buffer, size_t size) override |
| Read data from the stream. More... | |
| int | getc () override |
| Read one byte from the stream. More... | |
Public Member Functions inherited from WorldStone::IStream | |
| bool | eof () const |
| True if the end of the stream was reached during the last read operation. | |
| template<typename T > | |
| bool | readRaw (T &out) |
Public Member Functions inherited from WorldStone::IOBase | |
| operator bool () const | |
| bool | operator! () const |
| bool | good () const |
| bool | eof () const |
| bool | fail () const |
| bool | bad () const |
Additional Inherited Members | |
Public Types inherited from WorldStone::IStream | |
| enum | seekdir { beg, cur, end } |
Public Types inherited from WorldStone::IOBase | |
| using | Path = std::string |
| using | iostate = int |
Protected Member Functions inherited from WorldStone::IOBase | |
| void | setstate (iostate state) |
Protected Attributes inherited from WorldStone::IOBase | |
| iostate | _state = goodbit |
Static Protected Attributes inherited from WorldStone::IOBase | |
| static constexpr iostate | goodbit = 0x0 |
| static constexpr iostate | eofbit = 0x1 |
| static constexpr iostate | failbit = 0x2 |
| static constexpr iostate | badbit = 0x4 |
Wrapper around POSIX file io, same as ifstream but without iostream formatting.
Definition at line 16 of file FileStream.h.
|
overridevirtual |
Read one byte from the stream.
Reimplemented from WorldStone::IStream.
Definition at line 72 of file FileStream.cpp.
|
overridevirtual |
Read data from the stream.
| buffer | Pointer to a block of memory to fill. Must be at least 'size' bytes large. |
| size | Number of bytes to copy |
Implements WorldStone::IStream.
Definition at line 29 of file FileStream.cpp.
|
overridevirtual |
Change the pointer of the stream to a given position.
| offset | The new position relative to the given reference position 'origin'. |
| origin | Arbitrary reference to a position in the stream. |
Implements WorldStone::IStream.
Definition at line 52 of file FileStream.cpp.
|
overridevirtual |
Computes the size of the file.
Implements WorldStone::IStream.
Definition at line 59 of file FileStream.cpp.
|
overridevirtual |
Return the current position of the stream pointer.
Implements WorldStone::IStream.
Definition at line 42 of file FileStream.cpp.