.. index:: pair: class; EE::System::PackFileIndex .. _doxid-class_e_e_1_1_system_1_1_pack_file_index: class EE::System::PackFileIndex =============================== .. toctree:: :hidden: struct_EE_System_PackFileIndex_Entry.rst struct_EE_System_PackFileIndex_IndexedDirectory.rst struct_EE_System_PackFileIndex_IndexedFile.rst Overview ~~~~~~~~ Path index over the files of every open :ref:`Pack `. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class PackFileIndex: protected :ref:`EE::System::Container` { public: // structs struct :ref:`Entry`; struct :ref:`IndexedDirectory`; struct :ref:`IndexedFile`; // methods std::vector :ref:`filesGetInPath`(std::string path); std::vector<:ref:`Entry`> :ref:`listDirectory`(std::string path); :ref:`Pack`* :ref:`getPackFromFile`(std::string path); :ref:`IOStream`* :ref:`getFileFromPath`(const std::string& path); bool :ref:`extractFileToMemory`(const std::string& path, std::vector<:ref:`Uint8`>& data); bool :target:`fileExists`(const std::string& path); bool :target:`directoryExists`(std::string path); :ref:`Uint64` :ref:`getGeneration`() const; }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // methods T* :ref:`add`(T* resource); bool :ref:`remove`(T* resource); :ref:`Uint32` :ref:`count`(); .. _details-class_e_e_1_1_system_1_1_pack_file_index: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Path index over the files of every open :ref:`Pack `. Maps virtual paths such as "fonts/DejaVuSans.ttf" to the :ref:`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 ------- .. index:: pair: function; filesGetInPath .. _doxid-class_e_e_1_1_system_1_1_pack_file_index_1a9c3215167157de37e87b98b210ff81b5: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector filesGetInPath(std::string path) .. rubric:: Returns: The full paths of the files directly inside path. .. index:: pair: function; listDirectory .. _doxid-class_e_e_1_1_system_1_1_pack_file_index_1a7f3cb376441b4f5f7e75159fbf7d03ce: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`Entry`> listDirectory(std::string path) .. rubric:: 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 "/"). .. index:: pair: function; getPackFromFile .. _doxid-class_e_e_1_1_system_1_1_pack_file_index_1aea95aced135a4e4745edf5db1f620734: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Pack`* getPackFromFile(std::string path) .. rubric:: Returns: The pack that provides path, or nullptr. The pointer is only valid while the pack stays open. .. index:: pair: function; getFileFromPath .. _doxid-class_e_e_1_1_system_1_1_pack_file_index_1a22958f65b7c02744445c354eb1478ae1: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`IOStream`* getFileFromPath(const std::string& path) .. rubric:: Returns: A new stream for path (owned by the caller), or nullptr. .. index:: pair: function; extractFileToMemory .. _doxid-class_e_e_1_1_system_1_1_pack_file_index_1a5d9af177e98fb648ec2e613450c48c9d: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool extractFileToMemory(const std::string& path, std::vector<:ref:`Uint8`>& data) Extracts path into data. .. rubric:: Returns: False if the file is not indexed or extraction failed. .. index:: pair: function; getGeneration .. _doxid-class_e_e_1_1_system_1_1_pack_file_index_1acd6c131f14ba3bd820f5a9723f941c89: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint64` getGeneration() const .. rubric:: Returns: A counter that changes every time a pack is added or removed.