|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Unique handle to a readable file in the native Filesystem. More...
#include <GREM/core/system/NativeInputFile.hpp>

Public Member Functions | |
| NativeInputFile () noexcept=default | |
| Construct a closed file handle without an associated file. | |
| ~NativeInputFile () override=default | |
| Destructor. | |
| NativeInputFile (const NativeInputFile &)=delete | |
| Copying a file handle is not allowed. | |
| NativeInputFile (NativeInputFile &&other) | |
| Move constructor. | |
| NativeInputFile & | operator= (const NativeInputFile &)=delete |
| Copying a file handle is not allowed. | |
| NativeInputFile & | operator= (NativeInputFile &&)=default |
| Move assignment. | |
| void | close () override |
| 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. | |
| bool | isOpen () const noexcept override |
| Check if the file handle has an open file associated with it. | |
| bool | eof () const noexcept override |
| Check if the end of the file has been reached. | |
| size_t | size () const noexcept override |
| Get the readable length of the full file contents, in bytes. | |
| size_t | tellg () const noexcept override |
| Get the current reading position of the file. | |
| void | seekg (size_t position) override |
| Set the file reading position to an absolute offset from the beginning of the file. | |
| void | skipg (ptrdiff_t offset) override |
| Advance the file reading position by a relative offset, which may be negative in order to go backwards. | |
| Allocation< byte > | readBytesIntoAllocation (size_t maxLength=Limits< size_t >::MAX) override |
| Read from an open file into an allocation of bytes. | |
| ArrayList< byte > | readBytesIntoArrayList (size_t maxLength=Limits< size_t >::MAX) override |
| Read from an open file into an array list of bytes. | |
| Buffer< byte > | readBytesIntoBuffer (size_t maxLength=Limits< size_t >::MAX) override |
| Read from an open file into a buffer of bytes. | |
| String | readBytesIntoString (size_t maxLength=Limits< size_t >::MAX) override |
| Read from an open file into a string of bytes. | |
| Allocation< char > | readBytesIntoCString (size_t maxLength=Limits< size_t >::MAX) override |
| Read from an open file into an allocated null-terminated string of bytes. | |
| size_t | readSome (Span< byte > data) override |
| Read some amount of data from an open file, starting at the current reading position. | |
| size_t | readUntilEOF (Span< byte > data) override |
| 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. | |
| Public Member Functions inherited from grem::InputFile | |
| InputFile () noexcept=default | |
| Default constructor. | |
| GREM_ALWAYS_INLINE | operator Reader () & |
| Get a reader for the file. | |
| 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. | |
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. | |
Unique handle to a readable file in the native Filesystem.
|
defaultnoexcept |
Construct a closed file handle without an associated file.
|
overridedefault |
Destructor.
|
delete |
Copying a file handle is not allowed.
|
inline |
Move constructor.
|
delete |
Copying a file handle is not allowed.
|
default |
Move assignment.
|
inlineoverridevirtual |
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. |
Implements grem::File.
|
inlinenodiscardoverridevirtualnoexcept |
Check if the file handle has an open file associated with it.
Implements grem::File.
|
inlinenodiscardoverridevirtualnoexcept |
Check if the end of the file has been reached.
Implements grem::InputFile.
|
inlinenodiscardoverridevirtualnoexcept |
Get the readable length of the full file contents, in bytes.
Implements grem::InputFile.
|
inlinenodiscardoverridevirtualnoexcept |
Get the current reading position of the file.
Implements grem::InputFile.
|
inlineoverridevirtual |
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. |
Implements grem::InputFile.
|
inlineoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
inlinenodiscardoverridevirtual |
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. |
Implements grem::InputFile.
|
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. |