class EE::System::PackFileIndex¶
Overview¶
Path index over the files of every open Pack. More…
#include <packfileindex.hpp> class PackFileIndex: protected EE::System::Container { public: // structs struct Entry; struct IndexedDirectory; struct IndexedFile; // methods std::vector<std::string> filesGetInPath(std::string path); std::vector<Entry> listDirectory(std::string path); Pack* getPackFromFile(std::string path); IOStream* getFileFromPath(const std::string& path); bool extractFileToMemory(const std::string& path, std::vector<Uint8>& data); bool fileExists(const std::string& path); bool directoryExists(std::string path); Uint64 getGeneration() const; };
Inherited Members¶
public: // methods T* add(T* resource); bool remove(T* resource); Uint32 count();
Detailed Documentation¶
Path index over the files of every open Pack.
Maps virtual paths such as “fonts/DejaVuSans.ttf” to the Pack that provides them. When several packs provide the same path, the most recently opened one wins. This is the storage behind the res:// scheme of the eepp-vfs module (EE::VFS::ResourceProvider); it formerly was named VirtualFileSystem.
All methods are thread-safe.
Methods¶
std::vector<std::string> filesGetInPath(std::string path)
Returns:
The full paths of the files directly inside path.
std::vector<Entry> listDirectory(std::string path)
Returns:
The files and directories directly inside path, sorted by name. Directories are implicit: they exist while any file below them exists. The root is “” (or “/”).
Pack* getPackFromFile(std::string path)
Returns:
The pack that provides path, or nullptr. The pointer is only valid while the pack stays open.
IOStream* getFileFromPath(const std::string& path)
Returns:
A new stream for path (owned by the caller), or nullptr.
bool extractFileToMemory(const std::string& path, std::vector<Uint8>& data)
Extracts path into data.
Returns:
False if the file is not indexed or extraction failed.
Uint64 getGeneration() const
Returns:
A counter that changes every time a pack is added or removed.