|
SDL3pp
A slim C++ wrapper for SDL3
|
The read/write operation structure. More...
Public Member Functions | |
| constexpr | IOStream (IOStreamRaw resource) noexcept |
| Constructs from raw IOStream. | |
| constexpr | IOStream (IOStream &&other) noexcept |
| Move constructor. | |
| ~IOStream () | |
| Destructor. | |
| constexpr IOStream & | operator= (IOStream &&other) noexcept |
| Assignment operator. | |
| Public Member Functions inherited from SDL::IOStreamBase | |
| void | Close () |
| Close and free an allocated IOStream structure. | |
| PropertiesRef | GetProperties () const |
| Get the properties associated with an IOStream. | |
| IOStatus | GetStatus () const |
| Query the stream status of an IOStream. | |
| Sint64 | GetSize () const |
| Use this function to get the size of the data stream in an IOStream. | |
| Sint64 | Seek (Sint64 offset, IOWhence whence) |
| Seek within an IOStream data stream. | |
| Sint64 | Tell () const |
| Determine the current read/write offset in an IOStream data stream. | |
| std::string | Read (size_t size=-1) |
| Read from a data source. | |
| size_t | Read (TargetBytes buf) |
| Read from a data source. | |
| size_t | Write (SourceBytes buf) |
| Write to an IOStream data stream. | |
| size_t | print (std::string_view fmt, auto... args) |
| Prints formatted string. | |
| size_t | println (std::string_view fmt, auto... args) |
| Prints formatted string. | |
| size_t | printf (SDL_PRINTF_FORMAT_STRING const char *fmt,...) |
| Print to an IOStream data stream. | |
| size_t | vprintf (SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) |
| Print to an IOStream data stream. | |
| void | Flush () |
| Flush any buffered data in the stream. | |
| StringResult | LoadFile () |
| Load all the data from an SDL data stream. | |
| template<class T> | |
| OwnArray< T > | LoadFileAs () |
| Load all the data from an SDL data stream. | |
| void | SaveFile (SourceBytes data) |
| Save all the data into an SDL data stream. | |
| Uint8 | ReadU8 () |
| Use this function to read a byte from an IOStream. | |
| Sint8 | ReadS8 () |
| Use this function to read a signed byte from an IOStream. | |
| Uint16 | ReadU16LE () |
| Use this function to read 16 bits of little-endian data from an IOStream and return in native format. | |
| Sint16 | ReadS16LE () |
| Use this function to read 16 bits of little-endian data from an IOStream and return in native format. | |
| Uint16 | ReadU16BE () |
| Use this function to read 16 bits of big-endian data from an IOStream and return in native format. | |
| Sint16 | ReadS16BE () |
| Use this function to read 16 bits of big-endian data from an IOStream and return in native format. | |
| Uint32 | ReadU32LE () |
| Use this function to read 32 bits of little-endian data from an IOStream and return in native format. | |
| Sint32 | ReadS32LE () |
| Use this function to read 32 bits of little-endian data from an IOStream and return in native format. | |
| Uint32 | ReadU32BE () |
| Use this function to read 32 bits of big-endian data from an IOStream and return in native format. | |
| Sint32 | ReadS32BE () |
| Use this function to read 32 bits of big-endian data from an IOStream and return in native format. | |
| Uint64 | ReadU64LE () |
| Use this function to read 64 bits of little-endian data from an IOStream and return in native format. | |
| Sint64 | ReadS64LE () |
| Use this function to read 64 bits of little-endian data from an IOStream and return in native format. | |
| Uint64 | ReadU64BE () |
| Use this function to read 64 bits of big-endian data from an IOStream and return in native format. | |
| Sint64 | ReadS64BE () |
| Use this function to read 64 bits of big-endian data from an IOStream and return in native format. | |
| std::optional< Uint8 > | TryReadU8 () const |
| Use this function to read a byte from an IOStreamRef. | |
| std::optional< Sint8 > | TryReadS8 () const |
| Use this function to read a byte from an IOStreamRef. | |
| std::optional< Uint16 > | TryReadU16LE () const |
| Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native format. | |
| std::optional< Sint16 > | TryReadS16LE () const |
| Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native format. | |
| std::optional< Uint16 > | TryReadU16BE () const |
| Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format. | |
| std::optional< Sint16 > | TryReadS16BE () const |
| Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format. | |
| std::optional< Uint32 > | TryReadU32LE () const |
| Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native format. | |
| std::optional< Sint32 > | TryReadS32LE () const |
| Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native format. | |
| std::optional< Uint32 > | TryReadU32BE () const |
| Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format. | |
| std::optional< Sint32 > | TryReadS32BE () const |
| Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format. | |
| std::optional< Uint64 > | TryReadU64LE () const |
| Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native format. | |
| std::optional< Sint64 > | TryReadS64LE () const |
| Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native format. | |
| std::optional< Uint64 > | TryReadU64BE () const |
| Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format. | |
| std::optional< Sint64 > | TryReadS64BE () const |
| Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format. | |
| void | WriteU8 (Uint8 value) |
| Use this function to write a byte to an IOStream. | |
| void | WriteS8 (Sint8 value) |
| Use this function to write a signed byte to an IOStream. | |
| void | WriteU16LE (Uint16 value) |
| Use this function to write 16 bits in native format to an IOStream as little-endian data. | |
| void | WriteS16LE (Sint16 value) |
| Use this function to write 16 bits in native format to an IOStream as little-endian data. | |
| void | WriteU16BE (Uint16 value) |
| Use this function to write 16 bits in native format to an IOStream as big-endian data. | |
| void | WriteS16BE (Sint16 value) |
| Use this function to write 16 bits in native format to an IOStream as big-endian data. | |
| void | WriteU32LE (Uint32 value) |
| Use this function to write 32 bits in native format to an IOStream as little-endian data. | |
| void | WriteS32LE (Sint32 value) |
| Use this function to write 32 bits in native format to an IOStream as little-endian data. | |
| void | WriteU32BE (Uint32 value) |
| Use this function to write 32 bits in native format to an IOStream as big-endian data. | |
| void | WriteS32BE (Sint32 value) |
| Use this function to write 32 bits in native format to an IOStream as big-endian data. | |
| void | WriteU64LE (Uint64 value) |
| Use this function to write 64 bits in native format to an IOStream as little-endian data. | |
| void | WriteS64LE (Sint64 value) |
| Use this function to write 64 bits in native format to an IOStream as little-endian data. | |
| void | WriteU64BE (Uint64 value) |
| Use this function to write 64 bits in native format to an IOStream as big-endian data. | |
| void | WriteS64BE (Sint64 value) |
| Use this function to write 64 bits in native format to an IOStream as big-endian data. | |
| constexpr | ResourceBaseT ()=default |
| Default constructor, creates null/invalid resource. | |
| constexpr | ResourceBaseT (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | ResourceBaseT (std::nullptr_t) |
| Constructs null/invalid. | |
| constexpr | ResourceBaseT (const ResourceBaseT &)=default |
| Copy constructor. | |
| constexpr | ResourceBaseT (ResourceBaseT &&) noexcept=default |
| Move constructor. | |
| Public Member Functions inherited from SDL::ResourceBaseT< IOStreamRaw > | |
| constexpr | ResourceBaseT ()=default |
| Default constructor, creates null/invalid resource. | |
| constexpr | operator bool () const |
| Converts to bool. | |
| constexpr auto | operator<=> (const ResourceBaseT &other) const=default |
| Comparison. | |
| constexpr RawConstPointer | operator-> () const noexcept |
| member access to underlying resource pointer. | |
| constexpr RawPointer | get () const noexcept |
| Retrieves underlying resource pointer. | |
| constexpr RawPointer | release () noexcept |
| Retrieves underlying resource pointer and clear this. | |
Static Public Member Functions | |
| static IOStream | FromFile (StringParam file, StringParam mode) |
| Use this function to create a new IOStream structure for reading from and/or writing to a named file. | |
| static IOStream | FromMem (TargetBytes mem) |
| Use this function to prepare a read-write memory buffer for use with IOStream. | |
| static IOStream | FromConstMem (SourceBytes mem) |
| Use this function to prepare a read-only memory buffer for use with IOStream. | |
| static IOStream | FromDynamicMem () |
| Use this function to create an IOStream that is backed by dynamically allocated memory. | |
| static IOStream | Open (const IOStreamInterface &iface, void *userdata) |
| Create a custom IOStream. | |
Additional Inherited Members | |
| Public Types inherited from SDL::ResourceBaseT< IOStreamRaw > | |
| using | RawPointer |
| The underlying raw pointer type. | |
| using | RawConstPointer |
| The underlying const raw pointer type. | |
| Protected Member Functions inherited from SDL::ResourceBaseT< IOStreamRaw > | |
| constexpr | ~ResourceBaseT ()=default |
| Destructor. | |
| constexpr ResourceBaseT & | operator= (const ResourceBaseT &)=default |
| Assignment operator. | |
The read/write operation structure.
This operates as an opaque handle. There are several APIs to create various types of I/O streams, or an app can supply an IOStreamInterface to OpenIO() to provide their own stream implementation behind this struct's abstract interface.
|
inlineexplicitconstexprnoexcept |
Constructs from raw IOStream.
| resource | a IOStreamRaw to be wrapped. |
This assumes the ownership, call release() if you need to take back.