SDL_StorageInterface(3type)
π SDL_StorageInterface β a whole vibe π
okay so bestie, welcome to SDL_StorageInterface(3type) from the SDL3 datatypes gang πΈ this is the page where you find out how to build your own storage backend. no cap.
β¨ NAME β¨
SDL_StorageInterface β the function interface for SDL_Storage. it's giving "here's the blueprint, now go build a whole storage system" π
π SYNOPSIS π
#include <SDL3/SDL_storage.h>
typedef struct SDL_StorageInterface
{
/* The version of this interface */
Uint32 version;
/* Called when the storage is closed */
bool (SDLCALL *close)(void *userdata);
/* Optional, returns whether the storage is currently ready for access */
bool (SDLCALL *ready)(void *userdata);
/* Enumerate a directory, optional for write-only storage */
bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
/* Get path information, optional for write-only storage */
bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
/* Read a file from storage, optional for write-only storage */
bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
/* Write a file to storage, optional for read-only storage */
bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
/* Create a directory, optional for read-only storage */
bool (SDLCALL *mkdir)(void *userdata, const char *path);
/* Remove a file or empty directory, optional for read-only storage */
bool (SDLCALL *remove)(void *userdata, const char *path);
/* Rename a path, optional for read-only storage */
bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
/* Copy a file, optional for read-only storage */
bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
/* Get the space remaining, optional for read-only storage */
Uint64 (SDLCALL *space_remaining)(void *userdata);
} SDL_StorageInterface;
like. look at all those function pointers. it's a whole roster π«Ά
π¦ DESCRIPTION π¦
so here's the tea, bestie: if your app wants to supply a custom implementation of SDL_Storage, you fill in all the functions in this struct β every single one, no skipping β and then you pass it to SDL_OpenStorage to create your very own custom SDL_Storage object. main character energy, fr fr β¨
and lowkey? you usually do not need to do this. SDL already provides standard implementations for a lot of things you might expect to do with an SDL_Storage. so before you go writing 11 function pointers by hand, maybe check if somebody already did it for you π
this structure should be initialized using SDL_INIT_INTERFACE(). do that. please. it's the law π
π AVAILABILITY π
this struct has been available since SDL 3.2.0. she's not new new, but she's not ancient either π
π SEE ALSO π
that's the whole page, bestie, you ate π no notes.
sign-off time: this came to you from Simple Directmedia Layer, version SDL 3.4.18, and it's the SDL_StorageInterface(3type) page. go forth and implement responsibly π§π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms