|
wavelength 1.0.0
|
File of the host or the disc file system, read and written through a buffer with non-blocking I/O. More...
#include <asyncfile.h>


Public Member Functions | |
| AsyncFile (const char *pszFile, int nMode) | |
| Allocate the buffer and open a file. | |
| ~AsyncFile () override | |
| Close the file and release the buffer. | |
| int | Read (void *pBuffer, int nBytes) override |
| Read bytes and wait for them. | |
| bool | ReadAsync (void *pBuffer, int nBytes) override |
| Start reading bytes. | |
| int | Write (const void *pBuffer, int nBytes) override |
| Write bytes into the buffer, writing out each full buffer. | |
| int | Seek (int nOffset, int nOrigin) override |
| Move the position, clamped to the file, and refill the buffer of a file opened to read. | |
| int | Tell () override |
| Report the position. | |
| void | Flush () override |
| Write out the buffer of a file opened to write, or start refilling the buffer of a file opened to read. | |
| bool | Eof () override |
| Report whether the position is at the end. | |
| bool | Fail () override |
| Report whether an operation failed. | |
| int | Size () override |
| Report the size. | |
| int | UncompressedSize () override |
| Report the size before compression. | |
| bool | ReadDone (int *pnBytes) override |
| Copy what the buffer has of the read, refilling the buffer when the read needs more. | |
| void | Open (const char *pszFile, int nMode) |
| Open a file, and read the size before compression of a .gz file opened to read. | |
| void | Close () |
| Write out the buffer of a file opened to write, close the file, and reset the state. | |
| AsyncFile (const char *name, int mode) | |
| Allocate the buffer and open a file. | |
| virtual | ~AsyncFile () |
| Close the file and free the buffer. | |
| virtual int | Read (void *data, int bytes) |
| Read bytes and wait for them. | |
| virtual bool | ReadAsync (void *data, int bytes) |
| Start reading bytes, at most up to the end of the file. | |
| virtual int | Write (const void *data, int bytes) |
| Write bytes through the buffer. | |
| virtual int | Seek (int offset, int origin) |
| Move the position, clamped to the file. | |
| virtual int | Tell () |
| Report the position. | |
| virtual void | Flush () |
| Write the buffer when writing, or refill it when reading. | |
| virtual bool | Eof () |
| Report whether the position is at the end. | |
| virtual bool | Fail () |
| Report whether an operation failed. | |
| virtual int | Size () |
| Report the size. | |
| virtual int | UncompressedSize () |
| Report the size a .gz file records in its last four bytes, or zero for other files. | |
| virtual bool | ReadDone (int *bytes) |
| Copy buffered bytes of the read ReadAsync() started, refilling the buffer when it runs out. | |
| void | Open (const char *name, int mode) |
| Open a file. | |
| void | Close () |
| Write out a written file and close it. | |
| Public Member Functions inherited from File | |
| virtual | ~File () |
| Close the file. | |
| virtual | ~File () |
| Close the file. | |
Static Public Member Functions | |
| static void | Init () |
| Read the buf_size setting of the file block of the system configuration. | |
| static void | Terminate () |
| Shut the file layer down. | |
| Static Public Member Functions inherited from File | |
| static File * | New (const char *pszPath, int nMode, int nFlags) |
| Open a file. | |
Additional Inherited Members | |
| Public Types inherited from File | |
| enum | Mode { kModeRead = 1 , kModeWrite = 2 } |
| Open modes of New(). More... | |
| Static Public Attributes inherited from File | |
| static constexpr int | kFlagNoArchive = 1 |
| The open flags New() takes to read even a disc file through AsyncFile. | |
File of the host or the disc file system, read and written through a buffer with non-blocking I/O.
Buffered file of the host file system.
The RTTI includes the class name and records File as the base. The size before compression of a .gz file opened to read is its last four bytes.
The RTTI records the class as deriving from File. The object is 0x44 bytes. Reads and writes go through a buffer of gAsyncBufSize bytes. The reads complete at once on this platform.
| AsyncFile::AsyncFile | ( | const char * | pszFile, |
| int | nMode ) |
Allocate the buffer and open a file.
| pszFile | The file, relative to the root of the game files. |
| nMode | The open mode, one or more of File::Mode. |
|
override |
Close the file and release the buffer.
| AsyncFile::AsyncFile | ( | const char * | name, |
| int | mode ) |
Allocate the buffer and open a file.
| name | The path. |
| mode | The open mode, a combination of FileOpenMode bits. |
|
virtual |
Close the file and free the buffer.
|
static |
Read the buf_size setting of the file block of the system configuration.
|
static |
Shut the file layer down.
The body does nothing.
|
overridevirtual |
Read bytes and wait for them.
| pBuffer | Receives the bytes. |
| nBytes | The number of bytes. |
Implements File.
|
overridevirtual |
Start reading bytes.
| pBuffer | Receives the bytes. |
| nBytes | The number of bytes, cut at the end of the file. |
Implements File.
|
overridevirtual |
Write bytes into the buffer, writing out each full buffer.
| pBuffer | The bytes. |
| nBytes | The number of bytes. |
Implements File.
|
overridevirtual |
Move the position, clamped to the file, and refill the buffer of a file opened to read.
| nOffset | The offset. |
| nOrigin | The origin of the offset. Another value leaves the position unchanged. |
Implements File.
|
inlineoverridevirtual |
Report the position.
Implements File.
|
overridevirtual |
Write out the buffer of a file opened to write, or start refilling the buffer of a file opened to read.
Implements File.
|
inlineoverridevirtual |
Report whether the position is at the end.
Implements File.
|
inlineoverridevirtual |
Report whether an operation failed.
Implements File.
|
inlineoverridevirtual |
Report the size.
Implements File.
|
inlineoverridevirtual |
Report the size before compression.
Implements File.
|
overridevirtual |
Copy what the buffer has of the read, refilling the buffer when the read needs more.
| pnBytes | Receives the number of bytes read so far, except when a refill starts. |
Implements File.
| void AsyncFile::Open | ( | const char * | pszFile, |
| int | nMode ) |
Open a file, and read the size before compression of a .gz file opened to read.
| pszFile | The file, relative to the root of the game files. |
| nMode | The open mode. |
| void AsyncFile::Close | ( | ) |
Write out the buffer of a file opened to write, close the file, and reset the state.
|
virtual |
Read bytes and wait for them.
| data | Receives the bytes. |
| bytes | The number of bytes. |
Implements File.
|
virtual |
Start reading bytes, at most up to the end of the file.
| data | Receives the bytes. |
| bytes | The number of bytes. |
Implements File.
|
virtual |
Write bytes through the buffer.
| data | The bytes. |
| bytes | The number of bytes. |
Implements File.
|
virtual |
Move the position, clamped to the file.
| offset | The offset. |
| origin | The origin, one of BinStream::SeekType. |
Implements File.
|
virtual |
|
virtual |
Write the buffer when writing, or refill it when reading.
Implements File.
|
virtual |
Report whether the position is at the end.
Implements File.
|
virtual |
Report whether an operation failed.
Implements File.
|
virtual |
|
virtual |
Report the size a .gz file records in its last four bytes, or zero for other files.
Implements File.
|
virtual |
Copy buffered bytes of the read ReadAsync() started, refilling the buffer when it runs out.
| bytes | Receives the number of bytes read so far. |
Implements File.
| void AsyncFile::Open | ( | const char * | name, |
| int | mode ) |
Open a file.
| name | The path. |
| mode | The open mode. |
| void AsyncFile::Close | ( | ) |
Write out a written file and close it.