SDL3pp
A slim C++ wrapper for SDL3
All Classes Namespaces Functions Variables Typedefs Modules Pages Concepts
Public Member Functions | List of all members
SDL::IOStream Struct Reference

Handle to an owned iOStream. More...

Inheritance diagram for SDL::IOStream:
Inheritance graph
[legend]

Public Member Functions

constexpr IOStream (SDL_IOStream *resource)
 Constructs from the underlying resource.
 
constexpr IOStream (const IOStream &other)=delete
 
constexpr IOStream (IOStream &&other)=default
 Move constructor.
 
 ~IOStream ()
 Frees up resource when object goes out of scope.
 
IOStreamoperator= (IOStream other)
 Assignment operator.
 
- Public Member Functions inherited from SDL::IOStreamUnsafe
void Close ()
 Close and free an allocated IOStreamRef structure.
 
constexpr IOStreamRef (const IOStreamRef &other)
 Copy constructor.
 
constexpr IOStreamRef (IOStreamRef &&other)
 Move constructor.
 
 IOStreamRef (StringParam file, StringParam mode)
 Use this function to create a new IOStreamRef structure for reading from and/or writing to a named file.
 
 IOStreamRef (const IOStreamInterface &iface, void *userdata)
 Create a custom IOStreamRef.
 
void reset (SDL_IOStream *newResource={})
 Close and free an allocated IOStreamRef structure.
 
- Public Member Functions inherited from SDL::IOStreamRef
constexpr IOStreamRef (const IOStreamRef &other)
 Copy constructor.
 
constexpr IOStreamRef (IOStreamRef &&other)
 Move constructor.
 
 IOStreamRef (StringParam file, StringParam mode)
 Use this function to create a new IOStreamRef structure for reading from and/or writing to a named file.
 
 IOStreamRef (const IOStreamInterface &iface, void *userdata)
 Create a custom IOStreamRef.
 
IOStreamRefoperator= (IOStreamRef other)
 Assignment operator.
 
PropertiesRef GetProperties () const
 Get the properties associated with an IOStreamRef.
 
IOStatus GetStatus () const
 Query the stream status of an IOStreamRef.
 
Sint64 GetSize () const
 Use this function to get the size of the data stream in an IOStreamRef.
 
Sint64 Seek (Sint64 offset, IOWhence whence)
 Seek within an IOStreamRef data stream.
 
Sint64 Tell () const
 Determine the current read/write offset in an IOStreamRef 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 IOStreamRef data stream.
 
size_t print (std::string_view fmt, auto... args)
 
size_t println (std::string_view fmt, auto... args)
 
size_t printf (SDL_PRINTF_FORMAT_STRING const char *fmt,...)
 Print to an IOStreamRef data stream.
 
size_t vprintf (SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
 Print to an IOStreamRef 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 IOStreamRef.
 
Sint8 ReadS8 ()
 Use this function to read a signed byte from an IOStreamRef.
 
Uint16 ReadU16LE ()
 Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native format.
 
Sint16 ReadS16LE ()
 Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native format.
 
Uint16 ReadU16BE ()
 Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format.
 
Sint16 ReadS16BE ()
 Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format.
 
Uint32 ReadU32LE ()
 Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native format.
 
Sint32 ReadS32LE ()
 Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native format.
 
Uint32 ReadU32BE ()
 Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format.
 
Sint32 ReadS32BE ()
 Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format.
 
Uint64 ReadU64LE ()
 Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native format.
 
Sint64 ReadS64LE ()
 Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native format.
 
Uint64 ReadU64BE ()
 Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format.
 
Sint64 ReadS64BE ()
 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 IOStreamRef.
 
void WriteS8 (Sint8 value)
 Use this function to write a signed byte to an IOStreamRef.
 
void WriteU16LE (Uint16 value)
 Use this function to write 16 bits in native format to an IOStreamRef as little-endian data.
 
void WriteS16LE (Sint16 value)
 Use this function to write 16 bits in native format to an IOStreamRef as little-endian data.
 
void WriteU16BE (Uint16 value)
 Use this function to write 16 bits in native format to an IOStreamRef as big-endian data.
 
void WriteS16BE (Sint16 value)
 Use this function to write 16 bits in native format to an IOStreamRef as big-endian data.
 
void WriteU32LE (Uint32 value)
 Use this function to write 32 bits in native format to an IOStreamRef as little-endian data.
 
void WriteS32LE (Sint32 value)
 Use this function to write 32 bits in native format to an IOStreamRef as little-endian data.
 
void WriteU32BE (Uint32 value)
 Use this function to write 32 bits in native format to an IOStreamRef as big-endian data.
 
void WriteS32BE (Sint32 value)
 Use this function to write 32 bits in native format to an IOStreamRef as big-endian data.
 
void WriteU64LE (Uint64 value)
 Use this function to write 64 bits in native format to an IOStreamRef as little-endian data.
 
void WriteS64LE (Sint64 value)
 Use this function to write 64 bits in native format to an IOStreamRef as little-endian data.
 
void WriteU64BE (Uint64 value)
 Use this function to write 64 bits in native format to an IOStreamRef as big-endian data.
 
void WriteS64BE (Sint64 value)
 Use this function to write 64 bits in native format to an IOStreamRef as big-endian data.
 
std::optional< Uint8 > TryReadU8 ()
 Use this function to read a byte from an IOStreamRef.
 
std::optional< Sint8 > TryReadS8 ()
 Use this function to read a byte from an IOStreamRef.
 
std::optional< Uint16 > TryReadU16LE ()
 Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native format.
 
std::optional< Sint16 > TryReadS16LE ()
 Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native format.
 
std::optional< Uint16 > TryReadU16BE ()
 Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format.
 
std::optional< Sint16 > TryReadS16BE ()
 Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format.
 
std::optional< Uint32 > TryReadU32LE ()
 Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native format.
 
std::optional< Sint32 > TryReadS32LE ()
 Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native format.
 
std::optional< Uint32 > TryReadU32BE ()
 Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format.
 
std::optional< Sint32 > TryReadS32BE ()
 Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format.
 
std::optional< Uint64 > TryReadU64LE ()
 Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native format.
 
std::optional< Sint64 > TryReadS64LE ()
 Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native format.
 
std::optional< Uint64 > TryReadU64BE ()
 Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format.
 
std::optional< Sint64 > TryReadS64BE ()
 Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< SDL_IOStream * >
constexpr Resource (SDL_IOStream * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_IOStream * get () const
 Return contained resource;.
 
constexpr SDL_IOStream * release (SDL_IOStream * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_IOStream * operator-> () const
 Access to fields.
 
constexpr SDL_IOStream * operator-> ()
 Access to fields.
 

Additional Inherited Members

- Protected Member Functions inherited from SDL::IOStreamRef
void Close ()
 Close and free an allocated IOStreamRef structure.
 
void reset (SDL_IOStream *newResource={})
 Close and free an allocated IOStreamRef structure.
 

Detailed Description

Category:
Resource
See also
IOStreamRef

The documentation for this struct was generated from the following file: