10 #ifndef SLPROJECT_SLFILESTORAGE_H
11 #define SLPROJECT_SLFILESTORAGE_H
16 #ifndef __EMSCRIPTEN__
17 # define SL_STORAGE_FS
20 # define SL_STORAGE_WEB
21 # include <emscripten.h>
22 # include <unordered_map>
72 virtual size_t read(
void* buffer,
size_t size) {
return 0; }
73 virtual size_t write(
const void* buffer,
size_t size) {
return 0; }
74 virtual size_t tell() {
return 0; }
75 virtual bool seek(
size_t offset,
Origin origin) {
return false; }
76 virtual size_t size() {
return 0; }
SLIOStreamMode
Enum of stream opening modes.
SLIOStreamKind
Enum of file kinds.
static WAI::ModeOrbSlam2 * mode
Interface for accessing external data using streams.
virtual bool seek(size_t offset, Origin origin)
virtual size_t write(const void *buffer, size_t size)
virtual size_t read(void *buffer, size_t size)
virtual ~SLIOStream()=default
Collection of functions to open, use and close streams.
void close(SLIOStream *stream)
Closes and deletes a stream.
SLIOBuffer readIntoBuffer(std::string path, SLIOStreamKind kind)
Reads an entire file into memory.
bool exists(std::string path, SLIOStreamKind kind)
Checks whether a given file exists.
SLIOStream * open(std::string path, SLIOStreamKind kind, SLIOStreamMode mode)
Opens a file stream for I/O operations.
std::string readIntoString(std::string path, SLIOStreamKind kind)
Reads an entire file into a string.
void writeString(std::string path, SLIOStreamKind kind, const std::string &string)
Writes a string to a file.
Utility struct that holds a pointer and its length.
SLIOBuffer copy()
Creates a copy of the data in the buffer.
void deallocate()
Deallocates the data owned by the buffer.