Class FolderResourceDatabase¶
Defined in File folder_resource_database.h
Inheritance Relationships¶
Base Type¶
public portal::ResourceDatabase(Class ResourceDatabase)
Class Documentation¶
-
class FolderResourceDatabase : public portal::ResourceDatabase¶
Public Functions
-
~FolderResourceDatabase() override¶
-
virtual std::expected<SourceMetadata, DatabaseError> find(StringId resource_id) override¶
Find metadata for a resource by its ID.
- Parameters:
resource_id – StringId of the resource to find
- Returns:
SourceMetadata if found, or DatabaseError explaining why lookup failed
-
virtual DatabaseError add(StringId resource_id, SourceMetadata meta) override¶
Add a new resource to the database.
- Parameters:
resource_id – StringId for the new resource
meta – Complete metadata for the resource
- Returns:
Success or error flags indicating why the operation failed
-
virtual DatabaseError remove(StringId resource_id) override¶
Remove a resource from the database.
- Parameters:
resource_id – StringId of the resource to remove
- Returns:
Success if removed, NotFound if resource didn’t exist
-
virtual Reference<resources::ResourceSource> create_source(StringId resource_id, SourceMetadata meta) override¶
Create a ResourceSource for reading resource data.
- Parameters:
resource_id – StringId of the resource
meta – Metadata describing the resource
- Returns:
Unique pointer to a ResourceSource for reading bytes
-
virtual resources::DatabaseEntry &get_structure() const override¶
Public Static Functions
-
static std::unique_ptr<FolderResourceDatabase> create(const Project &project, const std::filesystem::path &database_path)¶
Public Static Attributes
-
static constexpr auto RESOURCE_METADATA_EXTENSION = ".pmeta"¶
-
static constexpr auto DATABASE_METADATA_EXTENSION = ".podb"¶
Protected Functions
-
FolderResourceDatabase(std::filesystem::path root_path, std::filesystem::path meta_path, DatabaseMetadata metadata)¶
-
void populate()¶
-
void populate_from_composite(const SourceMetadata &meta)¶
-
DatabaseError validate()¶
-
DatabaseError validate_metadata(const SourceMetadata &meta) const¶
-
void mend(DatabaseError error)¶
-
void clean_metadata()¶
-
virtual const std::filesystem::path &get_root_path() const override¶
Protected Static Functions
-
static void save_meta(const std::filesystem::path &meta_path, DatabaseMetadata &metadata)¶
-
static DatabaseMetadata load_meta(const std::filesystem::path &meta_path)¶
-
~FolderResourceDatabase() override¶