SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::Storage Struct Reference

An abstract interface for filesystem access. More...

Inheritance diagram for SDL::Storage:
[legend]

Public Member Functions

constexpr Storage (StorageRaw resource) noexcept
 Constructs from raw Storage.
constexpr Storage (const Storage &other)=delete
 Copy constructor.
constexpr Storage (Storage &&other) noexcept
 Move constructor.
constexpr Storage (const StorageRef &other)=delete
constexpr Storage (StorageRef &&other)=delete
 Storage (StringParam override, PropertiesRef props)
 Opens up a read-only container for the application's filesystem.
 Storage (StringParam org, StringParam app, PropertiesRef props)
 Opens up a container for a user's unique read/write filesystem.
 Storage (StringParam path)
 Opens up a container for local filesystem storage.
 Storage (const StorageInterface &iface, void *userdata)
 Opens up a container using a client-provided storage interface.
 ~Storage ()
 Destructor.
constexpr Storageoperator= (Storage &&other) noexcept
 Assignment operator.
Storageoperator= (const Storage &other)=delete
 Assignment operator.
bool Close ()
 Closes and frees a storage container.
bool Ready ()
 Checks if the storage container is ready to use.
std::optional< Uint64GetFileSize (StringParam path)
 Query the size of a file within a storage container.
bool ReadFile (StringParam path, TargetBytes destination)
 Synchronously read a file from a storage container into a client-provided buffer.
std::string ReadFile (StringParam path)
 Synchronously read a file from a storage container into a client-provided buffer.
template<class T>
std::vector< T > ReadFileAs (StringParam path)
 Synchronously read a file from a storage container into a client-provided buffer.
void WriteFile (StringParam path, SourceBytes source)
 Synchronously write a file from client memory into a storage container.
void CreateDirectory (StringParam path)
 Create a directory in a writable storage container.
void EnumerateDirectory (StringParam path, EnumerateDirectoryCallback callback, void *userdata)
 Enumerate a directory in a storage container through a callback function.
std::vector< PathEnumerateDirectory (StringParam path)
 Enumerate a directory in a storage container through a callback function.
void EnumerateDirectory (StringParam path, EnumerateDirectoryCB callback)
 Enumerate a directory in a storage container through a callback function.
void RemovePath (StringParam path)
 Remove a file or an empty directory in a writable storage container.
void RenamePath (StringParam oldpath, StringParam newpath)
 Rename a file or directory in a writable storage container.
void CopyFile (StringParam oldpath, StringParam newpath)
 Copy a file in a writable storage container.
PathInfo GetPathInfo (StringParam path)
 Get information about a filesystem path in a storage container.
Uint64 GetSpaceRemaining ()
 Queries the remaining space in a storage container.
OwnArray< char * > GlobDirectory (StringParam path, StringParam pattern, GlobFlags flags)
 Enumerate a directory tree, filtered by pattern, and return a list.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< StorageRaw >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< StorageRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

An abstract interface for filesystem access.

This is an opaque datatype. One can create this object using standard SDL functions like OpenTitleStorage or OpenUserStorage, etc, or create an object with a custom implementation using OpenStorage.

Since
This struct is available since SDL 3.2.0.
Category:
Resource

Constructor & Destructor Documentation

◆ Storage()

SDL::Storage::Storage ( StorageRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw Storage.

Parameters
resourcea StorageRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.


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