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"
52 SDL_IO_STATUS_NOT_READY;
55 SDL_IO_STATUS_READONLY;
58 SDL_IO_STATUS_WRITEONLY;
529 std::string
Read(
size_t size = -1)
532 if (
auto curSize = SDL_GetIOSize(
get()); curSize < 0 || pos < 0) {
533 if (size ==
size_t(-1))
return {};
534 }
else if (curSize - pos <= 0) {
536 }
else if (
size_t(curSize - pos) < size) {
537 size = curSize - pos;
539 std::string result(size, 0);
540 if (
auto actualSize =
Read(result); actualSize < size) {
541 result.resize(actualSize);
615 size_t print(std::string_view fmt,
auto... args)
617 return Write(std::vformat(fmt, std::make_format_args(args...)));
627 size_t println(std::string_view fmt,
auto... args)
630 std::vformat(fmt, std::make_format_args(args...)) +
"\n";
631 return Write(result);
654 size_t printf(SDL_PRINTF_FORMAT_STRING
const char* fmt, ...)
660 result = SDL_IOvprintf(
get(), fmt, ap);
685 size_t vprintf(SDL_PRINTF_FORMAT_STRING
const char* fmt, va_list ap);
744 auto data =
static_cast<T*
>(SDL_LoadFile_IO(
get(), &datasize,
false));
1066 if (
Uint8 value; SDL_ReadU8(
get(), &value))
return value;
1086 if (
Sint8 value; SDL_ReadS8(
get(), &value))
return value;
1110 if (
Uint16 value; SDL_ReadU16LE(
get(), &value))
return value;
1134 if (
Sint16 value; SDL_ReadS16LE(
get(), &value))
return value;
1158 if (
Uint16 value; SDL_ReadU16BE(
get(), &value))
return value;
1182 if (
Sint16 value; SDL_ReadS16BE(
get(), &value))
return value;
1206 if (
Uint32 value; SDL_ReadU32LE(
get(), &value))
return value;
1230 if (
Sint32 value; SDL_ReadS32LE(
get(), &value))
return value;
1254 if (
Uint32 value; SDL_ReadU32BE(
get(), &value))
return value;
1278 if (
Sint32 value; SDL_ReadS32BE(
get(), &value))
return value;
1302 if (
Uint64 value; SDL_ReadU64LE(
get(), &value))
return value;
1326 if (
Sint64 value; SDL_ReadS64LE(
get(), &value))
return value;
1350 if (
Uint64 value; SDL_ReadU64BE(
get(), &value))
return value;
1374 if (
Sint64 value; SDL_ReadS64BE(
get(), &value))
return value;
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;
1962 return {
CheckError(SDL_GetIOProperties(context))};
1990 return SDL_GetIOStatus(context);
2041 return SDL_SeekIO(context, offset, whence);
2173 SDL_PRINTF_FORMAT_STRING
const char* fmt,
2180 result = SDL_IOvprintf(context, fmt, ap);
2205 SDL_PRINTF_FORMAT_STRING
const char* fmt,
2208 return SDL_IOvprintf(context, fmt, ap);
2262 size_t datasize = 0;
2263 auto data =
static_cast<char*
>(SDL_LoadFile_IO(src, &datasize, closeio));
2290 size_t datasize = 0;
2291 auto data =
static_cast<T*
>(SDL_LoadFile(file, &datasize));
2315 size_t datasize = 0;
2316 auto data =
static_cast<char*
>(SDL_LoadFile(file, &datasize));
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Source byte stream.
Definition SDL3pp_strings.h:237
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:301
constexpr const char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:304
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
Target byte stream.
Definition SDL3pp_strings.h:323
constexpr char * data() const
Retrieves contained data.
Definition SDL3pp_strings.h:409
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_strings.h:406
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:2889
Sint8 ReadS8()
Use this function to read a signed byte from an IOStream.
Definition SDL3pp_iostream.h:2413
Sint64 GetSize() const
Use this function to get the size of the data stream in an IOStream.
Definition SDL3pp_iostream.h:2011
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:2098
void FlushIO(IOStreamRef context)
Flush any buffered data in the stream.
Definition SDL3pp_iostream.h:2234
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:3089
SDL_IOWhence IOWhence
Possible whence values for IOStream seeking.
Definition SDL3pp_iostream.h:68
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:2919
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:2994
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:2944
StringResult LoadFile(StringParam file)
Load all the data from a file path.
Definition SDL3pp_iostream.h:2313
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:3014
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:3069
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:3064
IOStream OpenIO(const IOStreamInterface &iface, void *userdata)
Create a custom IOStream.
Definition SDL3pp_iostream.h:1906
PropertiesRef GetIOProperties(IOStreamRef context)
Get the properties associated with an IOStream.
Definition SDL3pp_iostream.h:1960
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:2500
SDL_IOStatus IOStatus
IOStream status, set by a read or write operation.
Definition SDL3pp_iostream.h:41
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:2964
void SaveFile(SourceBytes data)
Save all the data into an SDL data stream.
Definition SDL3pp_iostream.h:2341
size_t WriteIO(IOStreamRef context, SourceBytes buf)
Write to an IOStream data stream.
Definition SDL3pp_iostream.h:2141
void WriteU8(IOStreamRef dst, Uint8 value)
Use this function to write a byte to an IOStream.
Definition SDL3pp_iostream.h:2774
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:2969
Sint64 TellIO(IOStreamRef context)
Determine the current read/write offset in an IOStream data stream.
Definition SDL3pp_iostream.h:2067
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:2645
void SaveFile_IO(IOStreamRef src, SourceBytes data, bool closeio=true)
Save all the data into an SDL data stream.
Definition SDL3pp_iostream.h:2336
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:2754
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:2844
void WriteS8(Sint8 value)
Use this function to write a signed byte to an IOStream.
Definition SDL3pp_iostream.h:2797
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:2939
SDL_IOStream * IOStreamRaw
Alias to raw representation for IOStream.
Definition SDL3pp_iostream.h:27
size_t IOprintf(IOStreamRef context, SDL_PRINTF_FORMAT_STRING const char *fmt,...)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:2172
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:2609
void Flush()
Flush any buffered data in the stream.
Definition SDL3pp_iostream.h:2236
IOStream IOFromConstMem(SourceBytes mem)
Use this function to prepare a read-only memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1838
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:2580
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:2638
size_t vprintf(SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:2211
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:2442
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:2989
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:2558
IOStream IOFromDynamicMem()
Use this function to create an IOStream that is backed by dynamically allocated memory.
Definition SDL3pp_iostream.h:1875
void Close()
Close and free an allocated IOStream structure.
Definition SDL3pp_iostream.h:1947
OwnArray< T > LoadFileAs(StringParam file)
Load all the data from a file path.
Definition SDL3pp_iostream.h:2288
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:3094
Uint8 ReadU8(IOStreamRef src)
Use this function to read a byte from an IOStream.
Definition SDL3pp_iostream.h:2381
constexpr IOStatus IO_STATUS_ERROR
Read or write I/O error.
Definition SDL3pp_iostream.h:46
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:2435
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:2894
static IOStream Open(const IOStreamInterface &iface, void *userdata)
Create a custom IOStream.
Definition SDL3pp_iostream.h:1911
Uint8 ReadU8()
Use this function to read a byte from an IOStream.
Definition SDL3pp_iostream.h:2388
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:3039
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:2616
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:49
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:2839
IOStatus GetIOStatus(IOStreamRef context)
Query the stream status of an IOStream.
Definition SDL3pp_iostream.h:1988
Sint64 GetIOSize(IOStreamRef context)
Use this function to get the size of the data stream in an IOStream.
Definition SDL3pp_iostream.h:2006
Sint64 Seek(Sint64 offset, IOWhence whence)
Seek within an IOStream data stream.
Definition SDL3pp_iostream.h:2044
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:2551
size_t Write(SourceBytes buf)
Write to an IOStream data stream.
Definition SDL3pp_iostream.h:2146
void WriteS8(IOStreamRef dst, Sint8 value)
Use this function to write a signed byte to an IOStream.
Definition SDL3pp_iostream.h:2792
Sint64 Tell() const
Determine the current read/write offset in an IOStream data stream.
Definition SDL3pp_iostream.h:2069
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:2696
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:2204
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:2869
ResourceRef< IOStream > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:34
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:2587
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:2529
SDL_IOStreamInterface IOStreamInterface
The function pointers that drive an IOStream.
Definition SDL3pp_iostream.h:93
constexpr IOStatus IO_STATUS_WRITEONLY
Tried to read a write-only buffer.
Definition SDL3pp_iostream.h:57
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:2493
Sint8 ReadS8(IOStreamRef src)
Use this function to read a signed byte from an IOStream.
Definition SDL3pp_iostream.h:2406
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:2522
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:2814
Sint64 SeekIO(IOStreamRef context, Sint64 offset, IOWhence whence)
Seek within an IOStream data stream.
Definition SDL3pp_iostream.h:2039
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:2761
static IOStream FromDynamicMem()
Use this function to create an IOStream that is backed by dynamically allocated memory.
Definition SDL3pp_iostream.h:1877
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:2914
static IOStream FromConstMem(SourceBytes mem)
Use this function to prepare a read-only memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1843
StringResult LoadFile()
Load all the data from an SDL data stream.
Definition SDL3pp_iostream.h:2267
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:2819
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:2725
void SaveFile(StringParam file, SourceBytes data)
Save all the data into a file path.
Definition SDL3pp_iostream.h:2360
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:2674
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:2464
constexpr IOWhence IO_SEEK_CUR
Seek relative to current read point.
Definition SDL3pp_iostream.h:73
void WriteU8(Uint8 value)
Use this function to write a byte to an IOStream.
Definition SDL3pp_iostream.h:2779
StringResult LoadFile_IO(IOStreamRef src, bool closeio=true)
Load all the data from an SDL data stream.
Definition SDL3pp_iostream.h:2260
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:2732
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:2703
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:2667
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:2864
constexpr IOStatus IO_STATUS_READONLY
Tried to write a read-only buffer.
Definition SDL3pp_iostream.h:54
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:3019
constexpr IOStatus IO_STATUS_READY
Everything is ready (no errors and not EOF).
Definition SDL3pp_iostream.h:43
constexpr IOStatus IO_STATUS_NOT_READY
Non blocking I/O, not ready.
Definition SDL3pp_iostream.h:51
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:1945
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:3044
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:2471
IOStatus GetStatus() const
Query the stream status of an IOStream.
Definition SDL3pp_iostream.h:1993
static IOStream FromMem(TargetBytes mem)
Use this function to prepare a read-write memory buffer for use with IOStream.
Definition SDL3pp_iostream.h:1790
constexpr IOWhence IO_SEEK_SET
Seek from the beginning of data.
Definition SDL3pp_iostream.h:70
constexpr IOWhence IO_SEEK_END
Seek relative to the end of data.
Definition SDL3pp_iostream.h:76
PropertiesRef GetProperties() const
Get the properties associated with an IOStream.
Definition SDL3pp_iostream.h:1965
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
::Sint32 Sint32
A signed 32-bit integer type.
Definition SDL3pp_stdinc.h:277
::Sint64 Sint64
A signed 64-bit integer type.
Definition SDL3pp_stdinc.h:305
::Uint16 Uint16
An unsigned 16-bit integer type.
Definition SDL3pp_stdinc.h:264
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:290
::Sint16 Sint16
A signed 16-bit integer type.
Definition SDL3pp_stdinc.h:251
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:238
::Sint8 Sint8
A signed 8-bit integer type.
Definition SDL3pp_stdinc.h:225
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:320
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.
The read/write operation structure.
Definition SDL3pp_iostream.h:108
constexpr IOStream(IOStreamRaw resource) noexcept
Constructs from raw IOStream.
Definition SDL3pp_iostream.h:118
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:1252
~IOStream()
Destructor.
Definition SDL3pp_iostream.h:376
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:1156
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:1228
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
OwnArray< T > LoadFileAs()
Load all the data from an SDL data stream.
Definition SDL3pp_iostream.h:741
size_t printf(SDL_PRINTF_FORMAT_STRING const char *fmt,...)
Print to an IOStream data stream.
Definition SDL3pp_iostream.h:654
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:1180
std::optional< Uint8 > TryReadU8() const
Use this function to read a byte from an IOStreamRef.
Definition SDL3pp_iostream.h:1064
constexpr IOStream(IOStream &&other) noexcept
Move constructor.
Definition SDL3pp_iostream.h:127
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:1324
size_t print(std::string_view fmt, auto... args)
Prints formatted string.
Definition SDL3pp_iostream.h:615
constexpr IOStream & operator=(IOStream &&other) noexcept
Assignment operator.
Definition SDL3pp_iostream.h:379
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:1276
std::optional< Sint8 > TryReadS8() const
Use this function to read a byte from an IOStreamRef.
Definition SDL3pp_iostream.h:1084
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:1204
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:1300
IOStream & operator=(const IOStream &other)=delete
Assignment operator.
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:1132
constexpr IOStream(const IOStream &other)=delete
Copy constructor.
size_t println(std::string_view fmt, auto... args)
Prints formatted string.
Definition SDL3pp_iostream.h:627
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:1348
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:1108
std::string Read(size_t size=-1)
Read from a data source.
Definition SDL3pp_iostream.h:529
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:1372
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:156
A simple std::string-like interface for SDL allocated strings.
Definition SDL3pp_strings.h:147