34class IVirtualDirectory;
70 virtual bool IsFile(
const std::string& path) = 0;
80 virtual bool Exists(
const std::string& path) = 0;
135 virtual void Read(uint8_t* buffer,
int num_bytes) = 0;
150 virtual const std::string&
Path() = 0;
172 std::shared_ptr<IVirtualDirectory>
OpenDirectory(
const std::string& path);
177 std::shared_ptr<IVirtualDirectory>
OpenDirectory(
const std::string& mount,
const std::string& path);
179 bool IsFile(
const std::string& path);
180 bool IsFile(
const std::string& mount,
const std::string& path);
182 bool IsDirectory(
const std::string& mount,
const std::string& path);
183 bool Exists(
const std::string& path);
184 bool Exists(
const std::string& mount,
const std::string& path);
210 size_t last = path.find_last_of(
"/\\");
211 if (last == std::string::npos) {
215 return path.substr(last + 1);
219 size_t last = path.find_last_of(
"/\\");
221 if (last == std::string::npos) {
224 return path.substr(0, last);
Meant to list all the files and sub files in the directory. This is sort of a replacement for directo...
Definition: vfs.h:88
virtual uint64_t GetSize()=0
Get number of files in directory
IVirtualDirectory()
Definition: vfs.h:90
virtual IVirtualFileSystem * GetFileSystem()=0
Get the filesystem this refers to.
virtual const std::string & GetRoot()=0
The root directory, relative to the filesystem.
virtual const std::string & GetFilename(int index)=0
Get file name relative to this directory
virtual IVirtualFilePtr GetFile(int index, FileModes modes=Text)=0
Opens file of index.
virtual ~IVirtualDirectory()
Definition: vfs.h:91
virtual uint64_t Size()=0
Size of file in bytes
virtual IVirtualFileSystem * GetFileSystem()=0
IVirtualFile()
Definition: vfs.h:122
virtual void Read(uint8_t *buffer, int num_bytes)=0
Reads num_bytes of bytes into buffer. Frees memory for the number
virtual ~IVirtualFile()
Definition: vfs.h:123
virtual const std::string & Path()=0
Get file path relative to the filesystem.
virtual uint64_t Tell()=0
Get current file position
virtual bool Seek(long offset, Offset origin=Offset::Cur)=0
Goto position of file, offset away from origin
The main functionality for this is to read files, so writing to files will not really be supported.
Definition: vfs.h:42
virtual IVirtualFilePtr Open(const std::string &path, FileModes modes=Text)=0
Opens file from the filesystem. Returns nullptr if file is invalid
virtual bool IsDirectory(const std::string &path)=0
Is the file a directory </summary
virtual IVirtualDirectoryPtr OpenDirectory(const std::string &path)=0
Lists all the files in the directory. Does not list directories in the list because for our purposes,...
virtual bool Exists(const std::string &path)=0
Does the file exist
virtual bool IsFile(const std::string &path)=0
Is the file a file
virtual ~IVirtualFileSystem()
Definition: vfs.h:45
virtual bool Initialize()=0
IVirtualFileSystem()
Definition: vfs.h:44
virtual void Close(IVirtualFilePtr &)=0
Closes the file.
IVirtualFilePtr Open(const std::string &path, FileModes mode=FileModes::Text)
Opens file.
Definition: vfs.cpp:34
void AddMountPoint(const std::string &path, IVirtualFileSystem *fs)
Definition: vfs.cpp:30
~VirtualMounter()
Definition: vfs.cpp:24
bool Exists(const std::string &path)
Definition: vfs.cpp:110
bool IsFile(const std::string &path)
Definition: vfs.cpp:75
bool IsDirectory(const std::string &path)
Definition: vfs.cpp:94
std::map< std::string, IVirtualFileSystem * > mount_points
Definition: vfs.h:187
std::shared_ptr< IVirtualDirectory > OpenDirectory(const std::string &path)
Opens directory
Definition: vfs.cpp:51
lib tracy file(GLOB_RECURSE CPP_FILES *.cpp) list(FILTER CPP_FILES EXCLUDE REGEX ".*main.cpp$") file(GLOB_RECURSE H_FILES *.h) set(SOURCE_FILES $
Definition: CMakeLists.txt:22
std::vector< uint8_t > ReadAllFromVFile(IVirtualFile *file)
Reads all the data from the virtual file.
Definition: vfs.cpp:126
std::string GetParentPath(const std::string &path)
Definition: vfs.h:218
std::string GetFilename(const std::string &path)
Gets filename from path.
Definition: vfs.h:209
std::string ReadAllFromVFileToString(IVirtualFile *file)
Don't really want this, but ah well, it cannot be helped.
Definition: vfs.cpp:134
std::shared_ptr< IVirtualFile > IVirtualFilePtr
Definition: vfs.h:34
Offset
Definition: vfs.h:31
FileModes
Definition: vfs.h:26
@ Text
Definition: vfs.h:27
@ Binary
Definition: vfs.h:28
std::shared_ptr< IVirtualDirectory > IVirtualDirectoryPtr
Definition: vfs.h:36
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21
glm::vec3 offset
Definition: starsystemview.cpp:72