1#ifndef SDL3PP_IOSTREAM_H_
2#define SDL3PP_IOSTREAM_H_
4#include <SDL3/SDL_iostream.h>
5#include "SDL3pp_properties.h"
6#include "SDL3pp_stdinc.h"
55 SDL_IO_STATUS_NOT_READY;
58 SDL_IO_STATUS_READONLY;
61 SDL_IO_STATUS_WRITEONLY;
247 std::string
Read(
size_t size = -1)
250 if (
auto curSize = SDL_GetIOSize(
get()); curSize < 0 || pos < 0) {
251 if (size ==
size_t(-1))
return {};
252 }
else if (curSize - pos <= 0) {
254 }
else if (
size_t(curSize - pos) < size) {
255 size = curSize - pos;
257 std::string result(size, 0);
258 if (
auto actualSize =
Read(result); actualSize < size) {
259 result.resize(actualSize);
333 size_t print(std::string_view fmt,
auto... args)
335 return Write(std::vformat(fmt, std::make_format_args(args...)));
345 size_t println(std::string_view fmt,
auto... args)
348 std::vformat(fmt, std::make_format_args(args...)) +
"\n";
349 return Write(result);
372 size_t printf(SDL_PRINTF_FORMAT_STRING
const char* fmt, ...)
378 result = SDL_IOvprintf(
get(), fmt, ap);
403 size_t vprintf(SDL_PRINTF_FORMAT_STRING
const char* fmt, va_list ap);
462 auto data =
static_cast<T*
>(SDL_LoadFile_IO(
get(), &datasize,
false));
784 if (
Uint8 value; SDL_ReadU8(
get(), &value))
return value;
804 if (
Sint8 value; SDL_ReadS8(
get(), &value))
return value;
828 if (
Uint16 value; SDL_ReadU16LE(
get(), &value))
return value;
852 if (
Sint16 value; SDL_ReadS16LE(
get(), &value))
return value;
876 if (
Uint16 value; SDL_ReadU16BE(
get(), &value))
return value;
900 if (
Sint16 value; SDL_ReadS16BE(
get(), &value))
return value;
924 if (
Uint32 value; SDL_ReadU32LE(
get(), &value))
return value;
948 if (
Sint32 value; SDL_ReadS32LE(
get(), &value))
return value;
972 if (
Uint32 value; SDL_ReadU32BE(
get(), &value))
return value;
996 if (
Sint32 value; SDL_ReadS32BE(
get(), &value))
return value;
1020 if (
Uint64 value; SDL_ReadU64LE(
get(), &value))
return value;
1044 if (
Sint64 value; SDL_ReadS64LE(
get(), &value))
return value;
1068 if (
Uint64 value; SDL_ReadU64BE(
get(), &value))
return value;
1092 if (
Sint64 value; SDL_ReadS64BE(
get(), &value))
return value;
1333 using IOStreamBase::IOStreamBase;
1685 return IOStream(SDL_IOFromFile(file, mode));
1710 SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER;
1713 SDL_PROP_IOSTREAM_STDIO_FILE_POINTER;
1716 SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER;
1719 SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER;
1722 SDL_PROP_IOSTREAM_MEMORY_POINTER;
1725 SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER;
1727#if SDL_VERSION_ATLEAST(3, 4, 0)
1730 SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC_POINTER;
1735 SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER;
1738 SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER;
1961 return CheckError(SDL_GetIOProperties(context));
1989 return SDL_GetIOStatus(context);
2043 return SDL_SeekIO(context, offset, whence);
2175 SDL_PRINTF_FORMAT_STRING
const char* fmt,
2182 result = SDL_IOvprintf(context, fmt, ap);
2207 SDL_PRINTF_FORMAT_STRING
const char* fmt,
2210 return SDL_IOvprintf(context, fmt, ap);
2264 size_t datasize = 0;
2265 auto data =
static_cast<char*
>(SDL_LoadFile_IO(src, &datasize, closeio));
2292 size_t datasize = 0;
2293 auto data =
static_cast<T*
>(SDL_LoadFile(file, &datasize));
2317 size_t datasize = 0;
2318 auto data =
static_cast<char*
>(SDL_LoadFile(file, &datasize));
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Source byte stream.
Definition SDL3pp_strings.h:246
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:310
constexpr const char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:313
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:58
Target byte stream.
Definition SDL3pp_strings.h:332
constexpr char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:418
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:415
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
void WriteS16BE(IOStreamRef dst, Sint16 value)
Use this function to write 16 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2892
IOStream IOFromMem(TargetBytes mem)
Use this function to prepare a read-write memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1785
size_t ReadIO(IOStreamRef context, TargetBytes buf)
Read from a data source.
Definition SDL3pp_iostream.h:2100
void WriteS16BE(Sint16 value)
Use this function to write 16 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2897
void FlushIO(IOStreamRef context)
Flush any buffered data in the stream.
Definition SDL3pp_iostream.h:2236
void WriteS64BE(IOStreamRef dst, Sint64 value)
Use this function to write 64 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:3092
SDL_IOWhence IOWhence
Possible whence values for IOStream seeking.
Definition SDL3pp_iostream.h:71
Uint32 ReadU32LE()
Use this function to read 32 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2561
Uint32 ReadU32BE()
Use this function to read 32 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2619
Uint16 ReadU16LE()
Use this function to read 16 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2445
StringResult LoadFile(StringParam file)
Load all the data from a file path.
Definition SDL3pp_iostream.h:2315
void WriteS16LE(Sint16 value)
Use this function to write 16 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2847
void WriteU64LE(IOStreamRef dst, Uint64 value)
Use this function to write 64 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:3017
Sint64 ReadS64BE()
Use this function to read 64 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2764
void WriteU32BE(Uint32 value)
Use this function to write 32 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2972
void WriteU64BE(IOStreamRef dst, Uint64 value)
Use this function to write 64 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:3067
IOStream OpenIO(const IOStreamInterface &iface, void *userdata)
Create a custom IOStream.
Definition SDL3pp_iostream.h:1906
ResourceRefT< IOStreamBase > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:37
PropertiesRef GetIOProperties(IOStreamRef context)
Get the properties associated with an IOStream.
Definition SDL3pp_iostream.h:1959
SDL_IOStatus IOStatus
IOStream status, set by a read or write operation.
Definition SDL3pp_iostream.h:44
void WriteU32BE(IOStreamRef dst, Uint32 value)
Use this function to write 32 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2967
size_t WriteIO(IOStreamRef context, SourceBytes buf)
Write to an IOStream data stream.
Definition SDL3pp_iostream.h:2143
void WriteU8(IOStreamRef dst, Uint8 value)
Use this function to write a byte to an IOStream.
Definition SDL3pp_iostream.h:2777
Sint64 Seek(Sint64 offset, IOWhence whence)
Seek within an IOStream data stream.
Definition SDL3pp_iostream.h:2046
Sint64 TellIO(IOStreamRef context)
Determine the current read/write offset in an IOStream data stream.
Definition SDL3pp_iostream.h:2069
void SaveFile_IO(IOStreamRef src, SourceBytes data, bool closeio=true)
Save all the data into an SDL data stream.
Definition SDL3pp_iostream.h:2339
Sint64 ReadS64BE(IOStreamRef src)
Use this function to read 64 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2757
size_t Write(SourceBytes buf)
Write to an IOStream data stream.
Definition SDL3pp_iostream.h:2148
void WriteS32LE(IOStreamRef dst, Sint32 value)
Use this function to write 32 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2942
SDL_IOStream * IOStreamRaw
Alias to raw representation for IOStream.
Definition SDL3pp_iostream.h:30
size_t IOprintf(IOStreamRef context, SDL_PRINTF_FORMAT_STRING const char *fmt,...)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:2174
void WriteU16BE(Uint16 value)
Use this function to write 16 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2872
Uint32 ReadU32BE(IOStreamRef src)
Use this function to read 32 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2612
StringResult LoadFile()
Load all the data from an SDL data stream.
Definition SDL3pp_iostream.h:2269
IOStream IOFromConstMem(SourceBytes mem)
Use this function to prepare a read-only memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1838
void WriteU64LE(Uint64 value)
Use this function to write 64 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:3022
IOStatus GetStatus() const
Query the stream status of an IOStream.
Definition SDL3pp_iostream.h:1992
Sint32 ReadS32LE(IOStreamRef src)
Use this function to read 32 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2583
Sint32 ReadS32BE(IOStreamRef src)
Use this function to read 32 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2641
void WriteS32BE(IOStreamRef dst, Sint32 value)
Use this function to write 32 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2992
IOStream IOFromDynamicMem()
Use this function to create an IOStream that is backed by dynamically allocated memory.
Definition SDL3pp_iostream.h:1875
OwnArray< T > LoadFileAs(StringParam file)
Load all the data from a file path.
Definition SDL3pp_iostream.h:2290
Uint8 ReadU8(IOStreamRef src)
Use this function to read a byte from an IOStream.
Definition SDL3pp_iostream.h:2384
constexpr IOStatus IO_STATUS_ERROR
Read or write I/O error.
Definition SDL3pp_iostream.h:49
Uint16 ReadU16LE(IOStreamRef src)
Use this function to read 16 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2438
PropertiesRef GetProperties() const
Get the properties associated with an IOStream.
Definition SDL3pp_iostream.h:1964
static IOStream Open(const IOStreamInterface &iface, void *userdata)
Create a custom IOStream.
Definition SDL3pp_iostream.h:1911
Uint64 ReadU64LE()
Use this function to read 64 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2677
void WriteS64LE(IOStreamRef dst, Sint64 value)
Use this function to write 64 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:3042
IOStream IOFromFile(StringParam file, StringParam mode)
Use this function to create a new IOStream structure for reading from and/or writing to a named file.
Definition SDL3pp_iostream.h:1683
constexpr IOStatus IO_STATUS_EOF
End of file.
Definition SDL3pp_iostream.h:52
void WriteS16LE(IOStreamRef dst, Sint16 value)
Use this function to write 16 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2842
IOStatus GetIOStatus(IOStreamRef context)
Query the stream status of an IOStream.
Definition SDL3pp_iostream.h:1987
Sint64 GetIOSize(IOStreamRef context)
Use this function to get the size of the data stream in an IOStream.
Definition SDL3pp_iostream.h:2008
Sint64 GetSize() const
Use this function to get the size of the data stream in an IOStream.
Definition SDL3pp_iostream.h:2013
void Flush()
Flush any buffered data in the stream.
Definition SDL3pp_iostream.h:2238
Sint8 ReadS8()
Use this function to read a signed byte from an IOStream.
Definition SDL3pp_iostream.h:2416
Uint32 ReadU32LE(IOStreamRef src)
Use this function to read 32 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2554
Uint16 ReadU16BE()
Use this function to read 16 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2503
void WriteS8(IOStreamRef dst, Sint8 value)
Use this function to write a signed byte to an IOStream.
Definition SDL3pp_iostream.h:2795
Sint64 ReadS64LE(IOStreamRef src)
Use this function to read 64 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2699
size_t IOvprintf(IOStreamRef context, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:2206
SDL_IOStreamInterface IOStreamInterface
The function pointers that drive an IOStream.
Definition SDL3pp_iostream.h:96
constexpr IOStatus IO_STATUS_WRITEONLY
Tried to read a write-only buffer.
Definition SDL3pp_iostream.h:60
Uint16 ReadU16BE(IOStreamRef src)
Use this function to read 16 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2496
void WriteU64BE(Uint64 value)
Use this function to write 64 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:3072
Sint8 ReadS8(IOStreamRef src)
Use this function to read a signed byte from an IOStream.
Definition SDL3pp_iostream.h:2409
Sint16 ReadS16BE(IOStreamRef src)
Use this function to read 16 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2525
void WriteU16LE(IOStreamRef dst, Uint16 value)
Use this function to write 16 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2817
Sint64 SeekIO(IOStreamRef context, Sint64 offset, IOWhence whence)
Seek within an IOStream data stream.
Definition SDL3pp_iostream.h:2041
Sint16 ReadS16LE()
Use this function to read 16 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2474
size_t vprintf(SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:2213
Sint64 ReadS64LE()
Use this function to read 64 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2706
static IOStream FromDynamicMem()
Use this function to create an IOStream that is backed by dynamically allocated memory.
Definition SDL3pp_iostream.h:1877
Sint32 ReadS32BE()
Use this function to read 32 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2648
void WriteU32LE(Uint32 value)
Use this function to write 32 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2922
void WriteU32LE(IOStreamRef dst, Uint32 value)
Use this function to write 32 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2917
static IOStream FromConstMem(SourceBytes mem)
Use this function to prepare a read-only memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1843
Sint32 ReadS32LE()
Use this function to read 32 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2590
Uint64 ReadU64BE(IOStreamRef src)
Use this function to read 64 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2728
void SaveFile(StringParam file, SourceBytes data)
Save all the data into a file path.
Definition SDL3pp_iostream.h:2363
Sint64 Tell() const
Determine the current read/write offset in an IOStream data stream.
Definition SDL3pp_iostream.h:2071
Sint16 ReadS16LE(IOStreamRef src)
Use this function to read 16 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2467
constexpr IOWhence IO_SEEK_CUR
Seek relative to current read point.
Definition SDL3pp_iostream.h:76
void WriteS64LE(Sint64 value)
Use this function to write 64 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:3047
StringResult LoadFile_IO(IOStreamRef src, bool closeio=true)
Load all the data from an SDL data stream.
Definition SDL3pp_iostream.h:2262
Uint64 ReadU64LE(IOStreamRef src)
Use this function to read 64 bits of little-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2670
Uint64 ReadU64BE()
Use this function to read 64 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2735
void WriteU16BE(IOStreamRef dst, Uint16 value)
Use this function to write 16 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2867
void WriteS64BE(Sint64 value)
Use this function to write 64 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:3097
constexpr IOStatus IO_STATUS_READONLY
Tried to write a read-only buffer.
Definition SDL3pp_iostream.h:57
Uint8 ReadU8()
Use this function to read a byte from an IOStream.
Definition SDL3pp_iostream.h:2391
constexpr IOStatus IO_STATUS_READY
Everything is ready (no errors and not EOF).
Definition SDL3pp_iostream.h:46
constexpr IOStatus IO_STATUS_NOT_READY
Non blocking I/O, not ready.
Definition SDL3pp_iostream.h:54
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.
Definition SDL3pp_iostream.h:1688
void CloseIO(IOStreamRaw context)
Close and free an allocated IOStream structure.
Definition SDL3pp_iostream.h:1944
void WriteU16LE(Uint16 value)
Use this function to write 16 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2822
void WriteS32BE(Sint32 value)
Use this function to write 32 bits in native format to an IOStream as big-endian data.
Definition SDL3pp_iostream.h:2997
void SaveFile(SourceBytes data)
Save all the data into an SDL data stream.
Definition SDL3pp_iostream.h:2344
static IOStream FromMem(TargetBytes mem)
Use this function to prepare a read-write memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1790
void Close()
Close and free an allocated IOStream structure.
Definition SDL3pp_iostream.h:1946
void WriteS8(Sint8 value)
Use this function to write a signed byte to an IOStream.
Definition SDL3pp_iostream.h:2800
void WriteU8(Uint8 value)
Use this function to write a byte to an IOStream.
Definition SDL3pp_iostream.h:2782
void WriteS32LE(Sint32 value)
Use this function to write 32 bits in native format to an IOStream as little-endian data.
Definition SDL3pp_iostream.h:2947
constexpr IOWhence IO_SEEK_SET
Seek from the beginning of data.
Definition SDL3pp_iostream.h:73
Sint16 ReadS16BE()
Use this function to read 16 bits of big-endian data from an IOStream and return in native format.
Definition SDL3pp_iostream.h:2532
constexpr IOWhence IO_SEEK_END
Seek relative to the end of data.
Definition SDL3pp_iostream.h:79
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:55
::Sint32 Sint32
A signed 32-bit integer type.
Definition SDL3pp_stdinc.h:283
::Sint64 Sint64
A signed 64-bit integer type.
Definition SDL3pp_stdinc.h:311
::Uint16 Uint16
An unsigned 16-bit integer type.
Definition SDL3pp_stdinc.h:270
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:296
::Sint16 Sint16
A signed 16-bit integer type.
Definition SDL3pp_stdinc.h:257
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:244
::Sint8 Sint8
A signed 8-bit integer type.
Definition SDL3pp_stdinc.h:231
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:326
Properties for IOStream.
Definition SDL3pp_iostream.h:1707
constexpr auto FILE_DESCRIPTOR_NUMBER
Number for file descriptor.
Definition SDL3pp_iostream.h:1715
constexpr auto ANDROID_AASSET_POINTER
Pointer to android aasset.
Definition SDL3pp_iostream.h:1718
constexpr auto MEMORY_POINTER
Pointer to memory.
Definition SDL3pp_iostream.h:1721
constexpr auto DYNAMIC_MEMORY_POINTER
Pointer to dynamic memory.
Definition SDL3pp_iostream.h:1734
constexpr auto DYNAMIC_CHUNKSIZE_NUMBER
Number for dynamic chunksize.
Definition SDL3pp_iostream.h:1737
constexpr auto STDIO_FILE_POINTER
Pointer to stdio file.
Definition SDL3pp_iostream.h:1712
constexpr auto MEMORY_FREE_FUNC_POINTER
Pointer to memory free func.
Definition SDL3pp_iostream.h:1729
constexpr auto MEMORY_SIZE_NUMBER
Number for memory size.
Definition SDL3pp_iostream.h:1724
constexpr auto WINDOWS_HANDLE_POINTER
Pointer to windows handle.
Definition SDL3pp_iostream.h:1709
Main include header for the SDL3pp library.
Base class to IOStream.
Definition SDL3pp_iostream.h:104
std::string Read(size_t size=-1)
Read from a data source.
Definition SDL3pp_iostream.h:247
std::optional< Sint64 > TryReadS64LE() const
Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native form...
Definition SDL3pp_iostream.h:1042
std::optional< Sint16 > TryReadS16BE() const
Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format.
Definition SDL3pp_iostream.h:898
std::optional< Uint32 > TryReadU32LE() const
Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native form...
Definition SDL3pp_iostream.h:922
OwnArray< T > LoadFileAs()
Load all the data from an SDL data stream.
Definition SDL3pp_iostream.h:459
std::optional< Uint16 > TryReadU16LE() const
Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native form...
Definition SDL3pp_iostream.h:826
size_t println(std::string_view fmt, auto... args)
Prints formatted string.
Definition SDL3pp_iostream.h:345
std::optional< Uint64 > TryReadU64BE() const
Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format.
Definition SDL3pp_iostream.h:1066
std::optional< Uint64 > TryReadU64LE() const
Use this function to read 64 bits of little-endian data from an IOStreamRef and return in native form...
Definition SDL3pp_iostream.h:1018
size_t printf(SDL_PRINTF_FORMAT_STRING const char *fmt,...)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:372
std::optional< Sint16 > TryReadS16LE() const
Use this function to read 16 bits of little-endian data from an IOStreamRef and return in native form...
Definition SDL3pp_iostream.h:850
std::optional< Sint8 > TryReadS8() const
Use this function to read a byte from an IOStreamRef.
Definition SDL3pp_iostream.h:802
std::optional< Uint32 > TryReadU32BE() const
Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format.
Definition SDL3pp_iostream.h:970
std::optional< Uint8 > TryReadU8() const
Use this function to read a byte from an IOStreamRef.
Definition SDL3pp_iostream.h:782
std::optional< Sint32 > TryReadS32BE() const
Use this function to read 32 bits of big-endian data from an IOStreamRef and return in native format.
Definition SDL3pp_iostream.h:994
size_t print(std::string_view fmt, auto... args)
Prints formatted string.
Definition SDL3pp_iostream.h:333
std::optional< Uint16 > TryReadU16BE() const
Use this function to read 16 bits of big-endian data from an IOStreamRef and return in native format.
Definition SDL3pp_iostream.h:874
std::optional< Sint32 > TryReadS32LE() const
Use this function to read 32 bits of little-endian data from an IOStreamRef and return in native form...
Definition SDL3pp_iostream.h:946
std::optional< Sint64 > TryReadS64BE() const
Use this function to read 64 bits of big-endian data from an IOStreamRef and return in native format.
Definition SDL3pp_iostream.h:1090
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
The read/write operation structure.
Definition SDL3pp_iostream.h:1332
constexpr IOStream(IOStreamRaw resource) noexcept
Constructs from raw IOStream.
Definition SDL3pp_iostream.h:1342
~IOStream()
Destructor.
Definition SDL3pp_iostream.h:1591
constexpr IOStream(IOStream &&other) noexcept
Move constructor.
Definition SDL3pp_iostream.h:1348
constexpr IOStream & operator=(IOStream &&other) noexcept
Assignment operator.
Definition SDL3pp_iostream.h:1594
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
A simple std::string-like interface for SDL allocated strings.
Definition SDL3pp_strings.h:156