Resource::PFIndexModifiable class

This class stores the metadata of all the files contained in a DBPF file.

It is used for indexing and accessing files.

Base classes

class IO::EAIOZoneObject
A class derived from EAIOZoneObject is able to be allocated from different heaps without the owner of the object needing to know or care which heap the object came from or even what kind of allocator the object is using.

Public types

using ItemsMap = eastl::hash_map<ResourceKey, DBPFItem, ICoreAllocatorAdapter>

Constructors, destructors, conversion operators

PFIndexModifiable(ICoreAllocator* pAllocator)
~PFIndexModifiable() virtual

Public functions

auto func04h() -> bool virtual
auto IsEmpty() -> bool virtual
Tells whether this PFIndex is empty (i.e.
auto GetFileCount() -> size_t virtual
Returns the number of files contained in this PFIndex.
auto Reset() -> bool virtual
Removes all the files from this PFIndex.
auto GetTotalDiskSize() -> size_t virtual
Gets the total amount of bytes occupied by the data of the files in this PFIndex.
auto GetDataEnd() -> size_t virtual
Returns the offset of the file where the data of this PFIndex' files ends.
auto GetFiles(vector<ResourceKey>& dstVector, IResourceFilter* filter = nullptr) -> size_t virtual
Adds all the files that match the criteria to the given vector.
auto GetAllFiles(vector<ResourceKey>& dstVector) -> size_t virtual
Adds all the file names (as ResourceKeys) in this PFIndex to the given vector.
auto func24h(int, size_t fileDataBegin, size_t fileDataEnd) -> bool virtual
auto GetFileInfo(const ResourceKey& fileName) -> DBPFItem* virtual
Returns the DBPFItem for the given file name, or NULL if the PFIndex does not contain that file.
auto PutFileInfo(const ResourceKey& fileName, DBPFItem& info) -> DBPFItem& virtual
Assigns the given file info to the specified file name.
auto RemoveFile(const ResourceKey& fileName, DBPFItem& dstInfo) -> bool virtual
Removes the specified file from this PFIndex, if it exists.
auto Read(void* pIndexData, size_t nIndexSize, size_t nIndexCount, bool) -> bool virtual
Reads the index items from the given buffer.
auto Write(void*& pDstIndexData, size_t& nDstIndexSize, size_t nIndexCount, bool arg_C) -> bool virtual
Creates a buffer to store the items and writes the index information on it.
void SetIsSaved() virtual
Sets the mIsSaved value of all files to true, meaning that the files have already been written into a DatabasePackedFile stream.
auto CheckFilesInRange(size_t fileDataBegin, size_t fileDataEnd) -> bool virtual
Tells whether the data of the files in this PFIndex are contained between the given range.
auto CheckFilesInSizeRange(size_t fileDataBegin, size_t size) -> bool virtual
Tells whether the data of the files in this PFIndex are contained between the given range.

Protected variables

ICoreAllocator* mpParentAllocator
FixedPoolAllocator mAllocator
ItemsMap mItemsMap

Function documentation

bool Resource::PFIndexModifiable::IsEmpty() virtual

Tells whether this PFIndex is empty (i.e.

contains no files) or not.

bool Resource::PFIndexModifiable::Reset() virtual

Removes all the files from this PFIndex.

This only deletes the files' metadata, not the file content.

size_t Resource::PFIndexModifiable::GetFiles(vector<ResourceKey>& dstVector, IResourceFilter* filter = nullptr) virtual

Adds all the files that match the criteria to the given vector.

Parameters
dstVector out The destination vector where the matching file names will be added.
filter The RequestFilter used to decide which file names must be added into the vector.
Returns The number of file names added to the vector.

The given filter will be applied on all the file names contained in this PFIndex. If a file matches the criteria, its name (as a ResourceKey) will be added to the vector.

size_t Resource::PFIndexModifiable::GetAllFiles(vector<ResourceKey>& dstVector) virtual

Adds all the file names (as ResourceKeys) in this PFIndex to the given vector.

Parameters
dstVector out The destination vector where the file names will be added.
Returns The number of file names added to the vector.

DBPFItem& Resource::PFIndexModifiable::PutFileInfo(const ResourceKey& fileName, DBPFItem& info) virtual

Assigns the given file info to the specified file name.

If the PFIndex does not contain a file with that name, a new entry will be created.

bool Resource::PFIndexModifiable::RemoveFile(const ResourceKey& fileName, DBPFItem& dstInfo) virtual

Removes the specified file from this PFIndex, if it exists.

Parameters
fileName The ResourceKey name of the file to be removed.
dstInfo out The destination DBPFItem that will be filled with the old information of the file, if it existed.
Returns True if the file was removed successfully, false if the file did not exist.

bool Resource::PFIndexModifiable::Read(void* pIndexData, size_t nIndexSize, size_t nIndexCount, bool) virtual

Reads the index items from the given buffer.

Returns true if all the items were successfully read, false otherwise.

It will be read according to the DBPF format. nIndexCount items will be read. The buffer is expected to have a size equal to nIndexSize.

bool Resource::PFIndexModifiable::Write(void*& pDstIndexData, size_t& nDstIndexSize, size_t nIndexCount, bool arg_C) virtual

Creates a buffer to store the items and writes the index information on it.

Parameters
pDstIndexData out The void* that will be assigned with the pointer to the buffer containing the written information.
nDstIndexSize
nIndexCount in The number of items to write.
arg_C
Returns true if all the items were successfully written, false otherwise.