Custom SFML input stream using PhysFS.
More...
#include <PhysfsStream.hpp>
|
| PhysfsStream () noexcept |
| Constructor.
|
|
| PhysfsStream (const std::string &filename) noexcept |
| Argument constructor.
|
|
virtual | ~PhysfsStream () noexcept |
| Virtual destructor.
|
|
bool | is_open () const noexcept |
| Is the physfs file open.
|
|
bool | open (const std::string &filename) noexcept |
| Open file in physfs.
|
|
void | close () noexcept |
| Close the open physfs handle.
|
|
std::optional< std::size_t > | read (void *data, std::size_t size) override |
| Read data from the stream.
|
|
std::optional< std::size_t > | seek (std::size_t position) override |
| Change the current reading position.
|
|
std::optional< std::size_t > | tell () override |
| Get the current reading position in the stream.
|
|
std::optional< std::size_t > | getSize () override |
| Return the size of the stream.
|
|
|
PHYSFS_File * | m_file |
| Handle to physfs file data.
|
|
Custom SFML input stream using PhysFS.
Definition at line 24 of file PhysfsStream.hpp.
◆ PhysfsStream() [1/4]
galaxy::fs::PhysfsStream::PhysfsStream |
( |
| ) |
|
|
noexcept |
◆ PhysfsStream() [2/4]
galaxy::fs::PhysfsStream::PhysfsStream |
( |
const std::string & | filename | ) |
|
|
noexcept |
Argument constructor.
Does not actually read any data.
- Parameters
-
filename | Name of file in VFS to read. |
Definition at line 23 of file PhysfsStream.cpp.
◆ ~PhysfsStream()
galaxy::fs::PhysfsStream::~PhysfsStream |
( |
| ) |
|
|
virtualnoexcept |
◆ PhysfsStream() [3/4]
galaxy::fs::PhysfsStream::PhysfsStream |
( |
const PhysfsStream & | | ) |
|
|
privatedelete |
◆ PhysfsStream() [4/4]
◆ is_open()
bool galaxy::fs::PhysfsStream::is_open |
( |
| ) |
const |
|
nodiscardnoexcept |
Is the physfs file open.
- Returns
- True if open.
Definition at line 34 of file PhysfsStream.cpp.
◆ open()
bool galaxy::fs::PhysfsStream::open |
( |
const std::string & | filename | ) |
|
|
noexcept |
Open file in physfs.
Does not actually read any data.
- Parameters
-
filename | Name of file in VFS to read. |
- Returns
- True if successful.
Definition at line 39 of file PhysfsStream.cpp.
◆ close()
void galaxy::fs::PhysfsStream::close |
( |
| ) |
|
|
noexcept |
◆ read()
std::optional< std::size_t > galaxy::fs::PhysfsStream::read |
( |
void * | data, |
|
|
std::size_t | size ) |
|
nodiscardoverride |
Read data from the stream.
After reading, the stream's reading position must be advanced by the amount of bytes read.
- Parameters
-
data | Buffer where to copy the read data. |
size | Desired number of bytes to read. |
- Returns
- The number of bytes actually read, or std::nullopt on error.
Definition at line 64 of file PhysfsStream.cpp.
◆ seek()
std::optional< std::size_t > galaxy::fs::PhysfsStream::seek |
( |
std::size_t | position | ) |
|
|
nodiscardoverride |
Change the current reading position.
- Parameters
-
position | The position to seek to, from the beginning. |
- Returns
- The position actually sought to, or std::nullopt on error.
Definition at line 76 of file PhysfsStream.cpp.
◆ tell()
std::optional< std::size_t > galaxy::fs::PhysfsStream::tell |
( |
| ) |
|
|
nodiscardoverride |
Get the current reading position in the stream.
- Returns
- The current position, or std::nullopt on error.
Definition at line 94 of file PhysfsStream.cpp.
◆ getSize()
std::optional< std::size_t > galaxy::fs::PhysfsStream::getSize |
( |
| ) |
|
|
nodiscardoverride |
Return the size of the stream.
- Returns
- The total number of bytes available in the stream, or std::nullopt on error.
Definition at line 105 of file PhysfsStream.cpp.
◆ operator=() [1/2]
Copy assignment operator.
◆ operator=() [2/2]
Move assignment operator.
◆ m_file
PHYSFS_File* galaxy::fs::PhysfsStream::m_file |
|
private |
The documentation for this class was generated from the following files: