Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::asset_database Class Reference

Manages asset metadata and provides functionality for adding, removing, and querying assets. More...

#include <asset_storage.h>

Classes

struct  meta
 Metadata information for an asset including its location. More...
 

Public Types

using database_t = std::map<hpp::uuid, meta>
 Type definition for the asset database.
 

Public Member Functions

auto get_database () const -> const database_t &
 Gets the entire asset database.
 
void set_database (const database_t &rhs)
 Sets the asset database.
 
void remove_all ()
 Removes all assets from the database.
 
auto add_asset (const std::string &location, const asset_meta &meta, bool override) -> hpp::uuid
 Adds an asset to the database.
 
auto get_uuid (const std::string &location) const -> const hpp::uuid &
 Gets the UUID of an asset based on its location.
 
auto get_metadata (const hpp::uuid &id) const -> const meta &
 Gets the metadata of an asset based on its UUID.
 
void rename_asset (const std::string &key, const std::string &new_key)
 Renames an asset.
 
void remove_asset (const std::string &key)
 Removes an asset from the database.
 

Static Public Member Functions

static auto generate_id (const fs::path &p) -> hpp::uuid
 Generates a UUID based on the file path.
 

Detailed Description

Manages asset metadata and provides functionality for adding, removing, and querying assets.

Definition at line 139 of file asset_storage.h.

Member Typedef Documentation

◆ database_t

using unravel::asset_database::database_t = std::map<hpp::uuid, meta>

Type definition for the asset database.

Definition at line 155 of file asset_storage.h.

Member Function Documentation

◆ add_asset()

auto unravel::asset_database::add_asset ( const std::string & location,
const asset_meta & meta,
bool override ) -> hpp::uuid
inline

Adds an asset to the database.

Parameters
locationThe location of the asset.
metaThe metadata of the asset.
Returns
The UUID of the added asset.

Definition at line 201 of file asset_storage.h.

◆ generate_id()

static auto unravel::asset_database::generate_id ( const fs::path & p) -> hpp::uuid
inlinestatic

Generates a UUID based on the file path.

Parameters
pThe file path.
Returns
The generated UUID.

Definition at line 162 of file asset_storage.h.

◆ get_database()

auto unravel::asset_database::get_database ( ) const -> const database_t&
inline

Gets the entire asset database.

Returns
A constant reference to the asset database.

Definition at line 171 of file asset_storage.h.

◆ get_metadata()

auto unravel::asset_database::get_metadata ( const hpp::uuid & id) const -> const meta&
inline

Gets the metadata of an asset based on its UUID.

Parameters
idThe UUID of the asset.
Returns
The metadata of the asset.

Definition at line 255 of file asset_storage.h.

◆ get_uuid()

auto unravel::asset_database::get_uuid ( const std::string & location) const -> const hpp::uuid&
inline

Gets the UUID of an asset based on its location.

Parameters
locationThe location of the asset.
Returns
The UUID of the asset.

Definition at line 232 of file asset_storage.h.

◆ remove_all()

void unravel::asset_database::remove_all ( )
inline

Removes all assets from the database.

Definition at line 189 of file asset_storage.h.

◆ remove_asset()

void unravel::asset_database::remove_asset ( const std::string & key)
inline

Removes an asset from the database.

Parameters
keyThe key of the asset to remove.

Definition at line 294 of file asset_storage.h.

◆ rename_asset()

void unravel::asset_database::rename_asset ( const std::string & key,
const std::string & new_key )
inline

Renames an asset.

Parameters
keyThe current key of the asset.
new_keyThe new key for the asset.

Definition at line 274 of file asset_storage.h.

◆ set_database()

void unravel::asset_database::set_database ( const database_t & rhs)
inline

Sets the asset database.

Parameters
rhsThe asset database to set.

Definition at line 180 of file asset_storage.h.


The documentation for this class was generated from the following file: