TSdlIOStreamInterface
The function pointers that drive a TSdlIOStream.
Applications can provide this struct to TSdlIOStream.Create to create their own implementation of TSdlIOStream. This is not necessarily required, as SDL already offers several common types of I/O streams, via other constructors of TSdlIOStream.
This structure should be initialized calling Init.
Note that all function pointers uses the "cdecl" calling conventions since these are directly using by the SDL C API.
Definition
Unit: Neslib.Sdl3.IO
Fields
Name | Description |
---|---|
Close | Close and free any allocated resources. |
Flush | If the stream is buffering, make sure the data is written out. |
Read | Read up to ASize bytes from the data stream to the area pointed at by APtr . |
Seek | Seek to AOffset relative to AWhence . |
Size | Return the number of bytes in this TSdlIOStream |
Version | The version of the interface. Is set by calling Init. |
Write | Write exactly ASize bytes from the area pointed at by APtr to data stream. |
Methods
Name | Description |
---|---|
Init | Initializes this interface by setting the Version field and clearing all other fields. |
Field Descriptions
Close
Close and free any allocated resources.
This does not guarantee file writes will sync to physical media; they can be in the system's file cache, waiting to go to disk.
The TSdlIOStream is still destroyed even if this fails, so clean up anything even if flushing buffers, etc, returns an error.
var Close: function
Type: function
Flush
If the stream is buffering, make sure the data is written out.
On failure, you should set AStatus
to a value from the TSdlIOStatus enum. You do not have to explicitly set this on a successful flush.
var Flush: function
Type: function
Read
Read up to ASize
bytes from the data stream to the area pointed at by APtr
.
On an incomplete read, you should set AStatus
to a value from the TSdlIOStatus enum. You do not have to explicitly set this on a complete, successful read.
var Read: function
Type: function
Seek
Seek to AOffset
relative to AWhence
.
var Seek: function
Type: function
Size
Return the number of bytes in this TSdlIOStream
var Size: function
Type: function
Version
The version of the interface. Is set by calling Init.
var Version: Cardinal
Type: Cardinal
Write
Write exactly ASize
bytes from the area pointed at by APtr
to data stream.
On an incomplete write, you should set AStatus
to a value from the TSdlIOStatus enum. You do not have to explicitly set this on a complete, successful write.
var Write: function
Type: function
Method Descriptions
Init
Initializes this interface by setting the Version field and clearing all other fields.
procedure Init