|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Generic boxed unique handle to a readable file in any filesystem. More...
#include <GREM/core/system/File.hpp>
Public Member Functions | |
| InputFileHandle () noexcept=default | |
| Construct a null file handle without an associated file. | |
| GREM_ALWAYS_INLINE InputFile * | get () noexcept |
| Get a pointer to the underlying file interface. | |
| GREM_ALWAYS_INLINE const InputFile * | get () const noexcept |
| Get a pointer to the underlying file interface. | |
| GREM_ALWAYS_INLINE | operator InputFile & () |
| Get a reference to the underlying file interface. | |
| GREM_ALWAYS_INLINE | operator const InputFile & () const |
| Get a reference to the underlying file interface. | |
| GREM_ALWAYS_INLINE | operator Reader () & |
| Get a reader for the underlying file interface. | |
| GREM_ALWAYS_INLINE | operator bool () const noexcept |
| Check if the file handle has an open file associated with it. | |
| GREM_ALWAYS_INLINE void | close () |
| 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. | |
| GREM_ALWAYS_INLINE bool | isOpen () const noexcept |
| Check if the file handle has an open file associated with it. | |
| GREM_ALWAYS_INLINE bool | eof () const noexcept |
| Check if the end of the file has been reached. | |
| GREM_ALWAYS_INLINE size_t | size () const noexcept |
| Get the readable length of the full file contents, in bytes. | |
| GREM_ALWAYS_INLINE size_t | tellg () const noexcept |
| Get the current reading position of the file. | |
| GREM_ALWAYS_INLINE void | seekg (size_t position) |
| Set the file reading position to an absolute offset from the beginning of the file. | |
| GREM_ALWAYS_INLINE void | skipg (ptrdiff_t offset) |
| Advance the file reading position by a relative offset, which may be negative in order to go backwards. | |
| GREM_ALWAYS_INLINE Allocation< byte > | readBytesIntoAllocation (size_t maxLength=Limits< size_t >::MAX) |
| Read from an open file into an allocation of bytes. | |
| GREM_ALWAYS_INLINE ArrayList< byte > | readBytesIntoArrayList (size_t maxLength=Limits< size_t >::MAX) |
| Read from an open file into an array list of bytes. | |
| GREM_ALWAYS_INLINE Buffer< byte > | readBytesIntoBuffer (size_t maxLength=Limits< size_t >::MAX) |
| Read from an open file into a buffer of bytes. | |
| GREM_ALWAYS_INLINE String | readBytesIntoString (size_t maxLength=Limits< size_t >::MAX) |
| Read from an open file into a string of bytes. | |
| GREM_ALWAYS_INLINE Allocation< char > | readBytesIntoCString (size_t maxLength=Limits< size_t >::MAX) |
| Read from an open file into an allocated null-terminated string of bytes. | |
| GREM_ALWAYS_INLINE size_t | readSome (Span< byte > data) |
| Read some amount of data from an open file, starting at the current reading position. | |
| GREM_ALWAYS_INLINE size_t | readUntilEOF (Span< byte > data) |
| Read data from an open file into a buffer, starting at the current reading position. | |
| GREM_ALWAYS_INLINE void | read (Span< byte > data) |
| Read an exact amount of data from an open file, starting at the current reading position. | |
| GREM_ALWAYS_INLINE bool | tryRead (Span< byte > data) |
| Try to read an exact amount of data from an open file, starting at the current reading position. | |
Static Public Member Functions | |
| template<typename Implementation, typename... Args> | |
| static GREM_ALWAYS_INLINE InputFileHandle | create (Args &&... args) |
| Create a boxed file with a specific implementation. | |
Generic boxed unique handle to a readable file in any filesystem.
|
defaultnoexcept |
Construct a null file handle without an associated file.
|
inlinestaticnodiscard |
Create a boxed file with a specific implementation.
| Implementation | concrete file type. |
| args | arguments to forward to the concrete file constructor. |
| any | exception thrown by the concrete file's constructor. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscardnoexcept |
Get a pointer to the underlying file interface.
|
inlinenodiscardnoexcept |
Get a pointer to the underlying file interface.
|
inlinenodiscard |
Get a reference to the underlying file interface.
|
inlinenodiscard |
Get a reference to the underlying file interface.
|
inlinenodiscard |
Get a reader for the underlying file interface.
|
inlineexplicitnoexcept |
Check if the file handle has an open file associated with it.
|
inline |
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.
| File::Error | on failure to close the file. |
| std::bad_alloc | on allocation failure. |
|
inlinenodiscardnoexcept |
Check if the file handle has an open file associated with it.
|
inlinenodiscardnoexcept |
Check if the end of the file has been reached.
|
inlinenodiscardnoexcept |
Get the readable length of the full file contents, in bytes.
|
inlinenodiscardnoexcept |
Get the current reading position of the file.
|
inline |
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. |
|
inline |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
inlinenodiscard |
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. |
|
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. |