CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::IFileSystem Class Referenceabstract

Interface for accessing file systems. More...

#include <CeresEngine/Foundation/IO/FileSystem.hpp>

Inheritance diagram for CeresEngine::IFileSystem:
CeresEngine::RefCounted< IFileSystem > CeresEngine::LocalFileSystem CeresEngine::POSIXFileSystem CeresEngine::Win32FileSystem CeresEngine::AppleFileSystem CeresEngine::LinuxFileSystem

Public Member Functions

 IFileSystem ()
 
virtual ~IFileSystem ()
 
virtual FileHandle open (StringView path)=0
 Opens a file or directory in file system.
 
virtual FileHandle open (String &&path)=0
 Opens a file or directory in file system.
 
FileHandle open (const char *path)
 Opens a file or directory in file system.
 
virtual FileWatcher createFileWatcher (ExecutionContext &executionContext, const FileHandle &directory, const FileEvents &events=FileEvent::Default, bool recursive=true)=0
 Watches a directory for changes.
 
- Public Member Functions inherited from CeresEngine::RefCounted< IFileSystem >
 RefCounted (Args &&... args)
 Creates a new RefCounted object and constructs a new Deleter by forwarding Args to it.
 
void retain () noexcept
 Retains the object by increment it's reference count by one.
 
bool release () noexcept
 Relases the object by decrementing it's reference count by one.
 

Static Public Member Functions

static IFileSystemgetLocal () noexcept
 Gets the underlying platform local file system implementation.
 

Detailed Description

Interface for accessing file systems.

Constructor & Destructor Documentation

◆ IFileSystem()

CeresEngine::IFileSystem::IFileSystem ( )

◆ ~IFileSystem()

virtual CeresEngine::IFileSystem::~IFileSystem ( )
virtual

Member Function Documentation

◆ createFileWatcher()

virtual FileWatcher CeresEngine::IFileSystem::createFileWatcher ( ExecutionContext executionContext,
const FileHandle directory,
const FileEvents events = FileEvent::Default,
bool  recursive = true 
)
pure virtual

Watches a directory for changes.

Note
The file handle must belong to the same file system as the file watcher, otherwise it will be ignored. Therefore, one file watcher object can only be used to watch files on a single file system. Also note that file watching may not supported for some file systems.
Parameters
executionContextThe execution context where the callbacks will be called from.
directoryA handle to directory that shall be watched.
eventsThe events that are watched (combination of FileEvent values).
recursiveDetermines whether the directory will be recursively watched.

Implemented in CeresEngine::AppleFileSystem, CeresEngine::Win32FileSystem, and CeresEngine::LocalFileSystem.

◆ getLocal()

static IFileSystem * CeresEngine::IFileSystem::getLocal ( )
staticnoexcept

Gets the underlying platform local file system implementation.

Note
Can be null in case the underlying platform doesn't expose a file system.
The default implementation returns nullptr. Platform implementors should override this method and return the local file system implementation of their platform.
Returns
A pointer to the platform local file system implementation.

◆ open() [1/3]

FileHandle CeresEngine::IFileSystem::open ( const char path)

Opens a file or directory in file system.

Parameters
pathThe path to file or directory

◆ open() [2/3]

virtual FileHandle CeresEngine::IFileSystem::open ( String &&  path)
pure virtual

Opens a file or directory in file system.

Parameters
pathThe path to file or directory

Implemented in CeresEngine::Win32FileSystem, CeresEngine::LocalFileSystem, and CeresEngine::POSIXFileSystem.

◆ open() [3/3]

virtual FileHandle CeresEngine::IFileSystem::open ( StringView  path)
pure virtual

Opens a file or directory in file system.

Parameters
pathThe path to file or directory

Implemented in CeresEngine::Win32FileSystem, CeresEngine::LocalFileSystem, and CeresEngine::POSIXFileSystem.


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