Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
IDekiFileSystem Class Referenceabstract

Abstract interface for filesystem package operations. More...

#include <IDekiFileSystem.h>

Inherited by DesktopFileSystem.

Public Types

enum class  OpenMode { READ_BINARY , WRITE_BINARY , READ_TEXT , WRITE_TEXT }
 File open modes. More...
enum class  SeekOrigin { BEGIN , CURRENT , END }
 File seek origins. More...
typedef void * FileHandle
 File handle type - platform-specific implementation.

Public Member Functions

virtual ~IDekiFileSystem ()=default
virtual bool Initialize ()=0
 Initialize the file system.
virtual void Shutdown ()=0
 Shutdown the file system and cleanup resources.
virtual FileHandle OpenFile (const char *path, OpenMode mode)=0
 Open a file.
virtual void CloseFile (FileHandle handle)=0
 Close a file.
virtual size_t ReadFile (FileHandle handle, void *buffer, size_t size)=0
 Read data from a file.
virtual size_t WriteFile (FileHandle handle, const void *buffer, size_t size)=0
 Write data to a file.
virtual long SeekFile (FileHandle handle, long offset, SeekOrigin origin)=0
 Seek to a position in the file.
virtual long TellFile (FileHandle handle)=0
 Get current position in file.
virtual long GetFileSize (FileHandle handle)=0
 Get file size.
virtual bool FileExists (const char *path)=0
 Check if file exists.
virtual bool ConvertPath (const char *virtualPath, char *outBuffer, size_t bufferSize)=0
 Convert virtual path to platform-specific path.
virtual bool SupportsStorageMode () const
 Check if storage mode (USB MSC) is supported.
virtual bool SetStorageMode (bool enabled)
 Enter or exit storage mode (USB Mass Storage).
virtual bool IsStorageMode () const
 Check if currently in storage mode.

Detailed Description

Abstract interface for filesystem package operations.

This interface defines the contract that filesystem packages must implement to work with the Deki engine. It abstracts file operations, path handling, and storage management.

Member Typedef Documentation

◆ FileHandle

File handle type - platform-specific implementation.

Member Enumeration Documentation

◆ OpenMode

enum class IDekiFileSystem::OpenMode
strong

File open modes.

Enumerator
READ_BINARY 
WRITE_BINARY 
READ_TEXT 
WRITE_TEXT 

◆ SeekOrigin

enum class IDekiFileSystem::SeekOrigin
strong

File seek origins.

Enumerator
BEGIN 
CURRENT 
END 

Constructor & Destructor Documentation

◆ ~IDekiFileSystem()

virtual IDekiFileSystem::~IDekiFileSystem ( )
virtualdefault

Member Function Documentation

◆ Initialize()

virtual bool IDekiFileSystem::Initialize ( )
pure virtual

Initialize the file system.

Returns
true if successful, false otherwise

Implemented in DesktopFileSystem.

◆ Shutdown()

virtual void IDekiFileSystem::Shutdown ( )
pure virtual

Shutdown the file system and cleanup resources.

Implemented in DesktopFileSystem.

◆ OpenFile()

virtual FileHandle IDekiFileSystem::OpenFile ( const char * path,
OpenMode mode )
pure virtual

Open a file.

Parameters
pathPath to the file (platform-specific format)
modeOpen mode
Returns
File handle or nullptr if failed

Implemented in DesktopFileSystem.

◆ CloseFile()

virtual void IDekiFileSystem::CloseFile ( FileHandle handle)
pure virtual

Close a file.

Parameters
handleFile handle

Implemented in DesktopFileSystem.

◆ ReadFile()

virtual size_t IDekiFileSystem::ReadFile ( FileHandle handle,
void * buffer,
size_t size )
pure virtual

Read data from a file.

Parameters
handleFile handle
bufferBuffer to read into
sizeNumber of bytes to read
Returns
Number of bytes actually read

Implemented in DesktopFileSystem.

◆ WriteFile()

virtual size_t IDekiFileSystem::WriteFile ( FileHandle handle,
const void * buffer,
size_t size )
pure virtual

Write data to a file.

Parameters
handleFile handle
bufferBuffer to write from
sizeNumber of bytes to write
Returns
Number of bytes actually written

Implemented in DesktopFileSystem.

◆ SeekFile()

virtual long IDekiFileSystem::SeekFile ( FileHandle handle,
long offset,
SeekOrigin origin )
pure virtual

Seek to a position in the file.

Parameters
handleFile handle
offsetOffset in bytes
originSeek origin
Returns
New position, or -1 on error

Implemented in DesktopFileSystem.

◆ TellFile()

virtual long IDekiFileSystem::TellFile ( FileHandle handle)
pure virtual

Get current position in file.

Parameters
handleFile handle
Returns
Current position, or -1 on error

Implemented in DesktopFileSystem.

◆ GetFileSize()

virtual long IDekiFileSystem::GetFileSize ( FileHandle handle)
pure virtual

Get file size.

Parameters
handleFile handle
Returns
File size in bytes, or -1 on error

Implemented in DesktopFileSystem.

◆ FileExists()

virtual bool IDekiFileSystem::FileExists ( const char * path)
pure virtual

Check if file exists.

Parameters
pathPath to the file
Returns
true if file exists, false otherwise

Implemented in DesktopFileSystem.

◆ ConvertPath()

virtual bool IDekiFileSystem::ConvertPath ( const char * virtualPath,
char * outBuffer,
size_t bufferSize )
pure virtual

Convert virtual path to platform-specific path.

Parameters
virtualPathVirtual path (e.g., "S:/assets/texture.bin")
outBufferBuffer to store the converted path
bufferSizeSize of the output buffer
Returns
true if conversion successful, false if buffer too small

Implemented in DesktopFileSystem.

◆ SupportsStorageMode()

virtual bool IDekiFileSystem::SupportsStorageMode ( ) const
inlinevirtual

Check if storage mode (USB MSC) is supported.

Returns
true if the filesystem supports exposing storage via USB

◆ SetStorageMode()

virtual bool IDekiFileSystem::SetStorageMode ( bool enabled)
inlinevirtual

Enter or exit storage mode (USB Mass Storage).

Parameters
enabledtrue to enter storage mode, false to exit
Returns
true if mode change successful

When storage mode is enabled, the storage is exposed as a USB drive and normal file operations will fail. Used for asset deployment.

◆ IsStorageMode()

virtual bool IDekiFileSystem::IsStorageMode ( ) const
inlinevirtual

Check if currently in storage mode.

Returns
true if in storage mode (USB MSC active)

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