|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Base interface for a readable File in a Filesystem. More...
#include <GREM/core/system/File.hpp>

Public Member Functions | |
| InputFile () noexcept=default | |
| Default constructor. | |
| GREM_ALWAYS_INLINE | operator Reader () & |
| Get a reader for the file. | |
| virtual bool | eof () const noexcept=0 |
| Check if the end of the file has been reached. | |
| virtual size_t | size () const noexcept=0 |
| Get the readable length of the full file contents, in bytes. | |
| virtual size_t | tellg () const noexcept=0 |
| Get the current reading position of the file. | |
| virtual void | seekg (size_t position)=0 |
| Set the file reading position to an absolute offset from the beginning of the file. | |
| virtual void | skipg (ptrdiff_t offset)=0 |
| Advance the file reading position by a relative offset, which may be negative in order to go backwards. | |
| virtual Allocation< byte > | readBytesIntoAllocation (size_t maxLength=Limits< size_t >::MAX)=0 |
| Read from an open file into an allocation of bytes. | |
| virtual ArrayList< byte > | readBytesIntoArrayList (size_t maxLength=Limits< size_t >::MAX)=0 |
| Read from an open file into an array list of bytes. | |
| virtual Buffer< byte > | readBytesIntoBuffer (size_t maxLength=Limits< size_t >::MAX)=0 |
| Read from an open file into a buffer of bytes. | |
| virtual String | readBytesIntoString (size_t maxLength=Limits< size_t >::MAX)=0 |
| Read from an open file into a string of bytes. | |
| virtual Allocation< char > | readBytesIntoCString (size_t maxLength=Limits< size_t >::MAX)=0 |
| Read from an open file into an allocated null-terminated string of bytes. | |
| virtual size_t | readSome (Span< byte > data)=0 |
| Read some amount of data from an open file, starting at the current reading position. | |
| virtual size_t | readUntilEOF (Span< byte > data)=0 |
| Read data from an open file into a buffer, starting at the current reading position. | |
| void | read (Span< byte > data) |
| Read an exact amount of data from an open file, starting at the current reading position. | |
| bool | tryRead (Span< byte > data) |
| Try to read an exact amount of data from an open file, starting at the current reading position. | |
| Public Member Functions inherited from grem::File | |
| File () noexcept=default | |
| Default constructor. | |
| virtual | ~File ()=default |
| Virtual destructor. | |
| File (const File &)=default | |
| Copy constructor. | |
| File (File &&) noexcept=default | |
| Move constructor. | |
| File & | operator= (const File &)=default |
| Copy assignment. | |
| File & | operator= (File &&) noexcept=default |
| Move assignment. | |
| operator bool () const noexcept | |
| Check if the file handle has an open file associated with it. | |
| virtual void | close ()=0 |
| Close the associated file so that it can no longer be accessed through this handle, and reset the handle to a closed file handle without an associated file. | |
| virtual bool | isOpen () const noexcept=0 |
| Check if the file handle has an open file associated with it. | |
Additional Inherited Members | |
| Public Types inherited from grem::File | |
| enum class | Kind : uint8_t { REGULAR , DIRECTORY , SYMLINK , OTHER } |
| File entry type. More... | |
| Static Public Attributes inherited from grem::File | |
| static constexpr size_t | npos = static_cast<size_t>(-1) |
| Invalid value for a file offset, used as an end-of-file marker. | |
Base interface for a readable File in a Filesystem.
|
defaultnoexcept |
Default constructor.
|
inlinenodiscard |
Get a reader for the file.
|
nodiscardpure virtualnoexcept |
Check if the end of the file has been reached.
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtualnoexcept |
Get the readable length of the full file contents, in bytes.
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtualnoexcept |
Get the current reading position of the file.
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
pure virtual |
Set the file reading position to an absolute offset from the beginning of the file.
| position | the new reading position to set. |
| File::Error | on failure to seek to the given position. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
pure virtual |
Advance the file reading position by a relative offset, which may be negative in order to go backwards.
| offset | the relative offset to advance the reading position by. |
| File::Error | on failure to skip by the given offset. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read from an open file into an allocation of bytes.
| maxLength | maximum number of bytes to read. |
| File::Error | on failure to read the file contents. |
| std::length_error | if the maximum file size was exceeded. |
| std::bad_alloc | on allocation failure. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read from an open file into an array list of bytes.
| maxLength | maximum number of bytes to read. |
| File::Error | on failure to read the file contents. |
| std::length_error | if the maximum file size was exceeded. |
| std::bad_alloc | on allocation failure. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read from an open file into a buffer of bytes.
| maxLength | maximum number of bytes to read. |
| File::Error | on failure to read the file contents. |
| std::length_error | if the maximum file size was exceeded. |
| std::bad_alloc | on allocation failure. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read from an open file into a string of bytes.
| maxLength | maximum number of bytes to read. |
| File::Error | on failure to read the file contents. |
| std::length_error | if the maximum file size was exceeded. |
| std::bad_alloc | on allocation failure. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read from an open file into an allocated null-terminated string of bytes.
| maxLength | maximum number of bytes to read. |
| File::Error | on failure to read the file contents. |
| std::length_error | if the maximum file size was exceeded. |
| std::bad_alloc | on allocation failure. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read some amount of data from an open file, starting at the current reading position.
The reading position is advanced to the end of the bytes that were read.
| data | writable span over the buffer to read file data into. The size of the span determines the number of bytes that are attempted to be read. |
| File::Error | on failure to read from the file. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
nodiscardpure virtual |
Read data from an open file into a buffer, starting at the current reading position.
The reading position is advanced to the end of the bytes that were read.
| data | writable span over the buffer to read file data into. The size of the span determines the number of bytes that are attempted to be read. |
| File::Error | on failure to read from the file. |
Implemented in grem::application::VirtualInputFile, and grem::NativeInputFile.
|
inline |
Read an exact amount of data from an open file, starting at the current reading position.
The reading position is advanced to the end of the bytes that were read.
| data | writable span to read file data into. The size of the span determines the number of bytes that are read. |
| File::Error | on failure to read from the file, or if not all requested data was read. |
|
inlinenodiscard |
Try to read an exact amount of data from an open file, starting at the current reading position.
The reading position is advanced to the end of the bytes that were read.
| data | writable span to read file data into. The size of the span determines the number of bytes that are attempted to be read. |
| File::Error | on failure to read from the file. |